o Save pointers to the chunks for root, home, swap, usr, var and tmp in
global variables. On ia64, save a pointer to the efi chunk as well. o At the same time, change checkLabels() to define these globals instead of having the caller of checkLabels() pass addresses to variables for these. Change the two callers correspondingly. o Spent a bit more time adjusting try_auto_label() to prepate for having the EFI partition created on ia64. o Remove efi_mountpoint(). The EFI chunk is now available without having to iterate over the disks and chunks to find it every time we need it. o On ia64, now that the root chunk is globally available, set the vfs.root.mountfrom tunable in loader.conf. This avoids that one cannot boot into FreeBSD after an install. The kernel cannot find the root device without a little help...
This commit is contained in:
parent
c7f9c5e137
commit
76dff61c02
@ -54,6 +54,16 @@ int BootMgr; /* Which boot manager we're using */
|
||||
int StatusLine; /* Where to stick our status messages */
|
||||
jmp_buf BailOut; /* Beam me up, scotty! The natives are pissed! */
|
||||
|
||||
Chunk *HomeChunk;
|
||||
Chunk *RootChunk;
|
||||
Chunk *SwapChunk;
|
||||
Chunk *TmpChunk;
|
||||
Chunk *UsrChunk;
|
||||
Chunk *VarChunk;
|
||||
#ifdef __ia64__
|
||||
Chunk *EfiChunk;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Yes, I know some of these are already automatically initialized as
|
||||
* globals. I simply find it clearer to set everything explicitly.
|
||||
@ -70,4 +80,14 @@ globalsInit(void)
|
||||
VarHead = NULL;
|
||||
mediaDevice = NULL;
|
||||
RunningAsInit = FALSE;
|
||||
|
||||
HomeChunk = NULL;
|
||||
RootChunk = NULL;
|
||||
SwapChunk = NULL;
|
||||
TmpChunk = NULL;
|
||||
UsrChunk = NULL;
|
||||
VarChunk = NULL;
|
||||
#ifdef __ia64__
|
||||
EfiChunk = NULL;
|
||||
#endif
|
||||
}
|
||||
|
@ -68,40 +68,14 @@ static void fixit_common(void);
|
||||
|
||||
static void installConfigure(void);
|
||||
|
||||
#ifdef __ia64__
|
||||
static const char *
|
||||
efi_mountpoint(void)
|
||||
{
|
||||
Device **devs;
|
||||
Disk *disk;
|
||||
Chunk *c;
|
||||
PartInfo *pi;
|
||||
int i;
|
||||
|
||||
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
|
||||
for (i = 0; devs[i] != NULL; i++) {
|
||||
if (!devs[i]->enabled)
|
||||
continue;
|
||||
disk = (Disk *)devs[i]->private;
|
||||
for (c = disk->chunks->part; c != NULL; c = c->next) {
|
||||
if (c->type == efi && c->private_data != NULL) {
|
||||
pi = (PartInfo *)c->private_data;
|
||||
if (pi->mountpoint[0] == '/')
|
||||
return (pi->mountpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
Boolean
|
||||
checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vdev, Chunk **tdev, Chunk **hdev)
|
||||
checkLabels(Boolean whinge)
|
||||
{
|
||||
Device **devs;
|
||||
Boolean status;
|
||||
Disk *disk;
|
||||
Chunk *c1, *c2, *rootdev, *swapdev, *usrdev, *vardev, *tmpdev, *homedev;
|
||||
PartInfo *pi;
|
||||
Chunk *c1, *c2;
|
||||
int i;
|
||||
|
||||
/* Don't allow whinging if noWarn is set */
|
||||
@ -109,19 +83,11 @@ checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vd
|
||||
whinge = FALSE;
|
||||
|
||||
status = TRUE;
|
||||
if (rdev)
|
||||
*rdev = NULL;
|
||||
if (sdev)
|
||||
*sdev = NULL;
|
||||
if (udev)
|
||||
*udev = NULL;
|
||||
if (vdev)
|
||||
*vdev = NULL;
|
||||
if (tdev)
|
||||
*tdev = NULL;
|
||||
if (hdev)
|
||||
*hdev = NULL;
|
||||
rootdev = swapdev = usrdev = vardev = tmpdev = homedev = NULL;
|
||||
HomeChunk = RootChunk = SwapChunk = NULL;
|
||||
TmpChunk = UsrChunk = VarChunk = NULL;
|
||||
#ifdef __ia64__
|
||||
EfiChunk = NULL;
|
||||
#endif
|
||||
|
||||
/* We don't need to worry about root/usr/swap if we're already multiuser */
|
||||
if (!RunningAsInit)
|
||||
@ -146,68 +112,70 @@ checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vd
|
||||
if (c1->type == freebsd) {
|
||||
for (c2 = c1->part; c2; c2 = c2->next) {
|
||||
#endif
|
||||
if (c2->type == part && c2->subtype != FS_SWAP && c2->private_data) {
|
||||
if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/")) {
|
||||
if (rootdev) {
|
||||
|
||||
pi = (PartInfo *)c2->private_data;
|
||||
if (c2->type == part && c2->subtype != FS_SWAP && pi != NULL) {
|
||||
if (!strcmp(pi->mountpoint, "/")) {
|
||||
if (RootChunk) {
|
||||
if (whinge)
|
||||
msgConfirm("WARNING: You have more than one root device set?!\n"
|
||||
"Using the first one found.");
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
rootdev = c2;
|
||||
RootChunk = c2;
|
||||
if (isDebug())
|
||||
msgDebug("Found rootdev at %s!\n", rootdev->name);
|
||||
msgDebug("Found rootdev at %s!\n", RootChunk->name);
|
||||
}
|
||||
}
|
||||
else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/usr")) {
|
||||
if (usrdev) {
|
||||
else if (!strcmp(pi->mountpoint, "/usr")) {
|
||||
if (UsrChunk) {
|
||||
if (whinge)
|
||||
msgConfirm("WARNING: You have more than one /usr filesystem.\n"
|
||||
"Using the first one found.");
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
usrdev = c2;
|
||||
UsrChunk = c2;
|
||||
if (isDebug())
|
||||
msgDebug("Found usrdev at %s!\n", usrdev->name);
|
||||
msgDebug("Found usrdev at %s!\n", UsrChunk->name);
|
||||
}
|
||||
}
|
||||
else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/var")) {
|
||||
if (vardev) {
|
||||
else if (!strcmp(pi->mountpoint, "/var")) {
|
||||
if (VarChunk) {
|
||||
if (whinge)
|
||||
msgConfirm("WARNING: You have more than one /var filesystem.\n"
|
||||
"Using the first one found.");
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
vardev = c2;
|
||||
VarChunk = c2;
|
||||
if (isDebug())
|
||||
msgDebug("Found vardev at %s!\n", vardev->name);
|
||||
msgDebug("Found vardev at %s!\n", VarChunk->name);
|
||||
}
|
||||
} else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/tmp")) {
|
||||
if (tmpdev) {
|
||||
} else if (!strcmp(pi->mountpoint, "/tmp")) {
|
||||
if (TmpChunk) {
|
||||
if (whinge)
|
||||
msgConfirm("WARNING: You have more than one /tmp filesystem.\n"
|
||||
"Using the first one found.");
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
tmpdev = c2;
|
||||
TmpChunk = c2;
|
||||
if (isDebug())
|
||||
msgDebug("Found tmpdev at %s!\n", tmpdev->name);
|
||||
msgDebug("Found tmpdev at %s!\n", TmpChunk->name);
|
||||
}
|
||||
} else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/home")) {
|
||||
if (homedev) {
|
||||
} else if (!strcmp(pi->mountpoint, "/home")) {
|
||||
if (HomeChunk) {
|
||||
if (whinge)
|
||||
msgConfirm("WARNING: You have more than one /home filesystem.\n"
|
||||
"Using the first one found.");
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
homedev = c2;
|
||||
HomeChunk = c2;
|
||||
if (isDebug())
|
||||
msgDebug("Found homedev at %s!\n", homedev->name);
|
||||
msgDebug("Found homedev at %s!\n", HomeChunk->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -237,10 +205,10 @@ checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vd
|
||||
if (c1->type == freebsd) {
|
||||
for (c2 = c1->part; c2; c2 = c2->next) {
|
||||
#endif
|
||||
if (c2->type == part && c2->subtype == FS_SWAP && !swapdev) {
|
||||
swapdev = c2;
|
||||
if (c2->type == part && c2->subtype == FS_SWAP && !SwapChunk) {
|
||||
SwapChunk = c2;
|
||||
if (isDebug())
|
||||
msgDebug("Found swapdev at %s!\n", swapdev->name);
|
||||
msgDebug("Found swapdev at %s!\n", SwapChunk->name);
|
||||
break;
|
||||
}
|
||||
#ifndef __ia64__
|
||||
@ -250,34 +218,33 @@ checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vd
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy our values over */
|
||||
if (rdev)
|
||||
*rdev = rootdev;
|
||||
if (sdev)
|
||||
*sdev = swapdev;
|
||||
if (udev)
|
||||
*udev = usrdev;
|
||||
if (vdev)
|
||||
*vdev = vardev;
|
||||
if (tdev)
|
||||
*tdev = tmpdev;
|
||||
if (hdev)
|
||||
*hdev = homedev;
|
||||
#ifdef __ia64__
|
||||
for (i = 0; devs[i] != NULL; i++) {
|
||||
if (!devs[i]->enabled)
|
||||
continue;
|
||||
disk = (Disk *)devs[i]->private;
|
||||
for (c1 = disk->chunks->part; c1 != NULL; c1 = c1->next) {
|
||||
pi = (PartInfo *)c1->private_data;
|
||||
if (c1->type == efi && pi != NULL && pi->mountpoint[0] == '/')
|
||||
EfiChunk = c1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!rootdev && whinge) {
|
||||
if (!RootChunk && whinge) {
|
||||
msgConfirm("No root device found - you must label a partition as /\n"
|
||||
"in the label editor.");
|
||||
status = FALSE;
|
||||
}
|
||||
if (!swapdev && whinge) {
|
||||
if (!SwapChunk && whinge) {
|
||||
if (msgYesNo("No swap devices found - you should create at least one\n"
|
||||
"swap partition. Without swap, the install will fail\n"
|
||||
"if you do not have enough RAM. Continue anyway?"))
|
||||
status = FALSE;
|
||||
}
|
||||
#ifdef __ia64__
|
||||
if (efi_mountpoint() == NULL && whinge) {
|
||||
if (msgYesNo("No EFI system partition found. Is this what you want?"))
|
||||
if (EfiChunk == NULL && whinge) {
|
||||
if (msgYesNo("No (mounted) EFI system partition found. Is this what you want?"))
|
||||
status = FALSE;
|
||||
}
|
||||
#endif
|
||||
@ -896,11 +863,13 @@ installFixupBase(dialogMenuItem *self)
|
||||
|
||||
#ifdef __ia64__
|
||||
/* Move /boot to the the EFI partition and make /boot a link to it. */
|
||||
efi_mntpt = efi_mountpoint();
|
||||
efi_mntpt = (EfiChunk != NULL) ? ((PartInfo *)EfiChunk->private_data)->mountpoint : NULL;
|
||||
if (efi_mntpt != NULL) {
|
||||
vsystem("if [ ! -L /boot ]; then mv /boot %s; fi", efi_mntpt);
|
||||
vsystem("if [ ! -e /boot ]; then ln -sf %s/boot /boot; fi",
|
||||
efi_mntpt + 1); /* Skip leading '/' */
|
||||
/* Make sure the kernel knows which partition is the root file system. */
|
||||
vsystem("echo 'vfs.root.mountfrom=\"ufs:/dev/%s\"' >> /boot/loader.conf", RootChunk->name);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -953,7 +922,7 @@ installFilesystems(dialogMenuItem *self)
|
||||
{
|
||||
int i;
|
||||
Disk *disk;
|
||||
Chunk *c1, *c2, *rootdev, *swapdev;
|
||||
Chunk *c1, *c2;
|
||||
Device **devs;
|
||||
PartInfo *root;
|
||||
char dname[80];
|
||||
@ -964,18 +933,15 @@ installFilesystems(dialogMenuItem *self)
|
||||
return DITEM_SUCCESS;
|
||||
|
||||
upgrade = !variable_cmp(SYSTEM_STATE, "upgrade");
|
||||
if (!checkLabels(TRUE, &rootdev, &swapdev, NULL, NULL, NULL, NULL))
|
||||
if (!checkLabels(TRUE))
|
||||
return DITEM_FAILURE;
|
||||
|
||||
if (rootdev)
|
||||
root = (PartInfo *)rootdev->private_data;
|
||||
else
|
||||
root = NULL;
|
||||
root = (RootChunk != NULL) ? (PartInfo *)RootChunk->private_data : NULL;
|
||||
|
||||
command_clear();
|
||||
if (swapdev && RunningAsInit) {
|
||||
if (SwapChunk && RunningAsInit) {
|
||||
/* As the very first thing, try to get ourselves some swap space */
|
||||
sprintf(dname, "/dev/%s", swapdev->name);
|
||||
sprintf(dname, "/dev/%s", SwapChunk->name);
|
||||
if (!Fake && !file_readable(dname)) {
|
||||
msgConfirm("Unable to find device node for %s in /dev!\n"
|
||||
"The creation of filesystems will be aborted.", dname);
|
||||
@ -995,16 +961,16 @@ installFilesystems(dialogMenuItem *self)
|
||||
}
|
||||
}
|
||||
|
||||
if (rootdev && RunningAsInit) {
|
||||
if (RootChunk && RunningAsInit) {
|
||||
/* Next, create and/or mount the root device */
|
||||
sprintf(dname, "/dev/%s", rootdev->name);
|
||||
sprintf(dname, "/dev/%s", RootChunk->name);
|
||||
if (!Fake && !file_readable(dname)) {
|
||||
msgConfirm("Unable to make device node for %s in /dev!\n"
|
||||
"The creation of filesystems will be aborted.", dname);
|
||||
return DITEM_FAILURE | DITEM_RESTORE;
|
||||
}
|
||||
if (strcmp(root->mountpoint, "/"))
|
||||
msgConfirm("Warning: %s is marked as a root partition but is mounted on %s", rootdev->name, root->mountpoint);
|
||||
msgConfirm("Warning: %s is marked as a root partition but is mounted on %s", RootChunk->name, root->mountpoint);
|
||||
|
||||
if (root->do_newfs && (!upgrade ||
|
||||
!msgNoYes("You are upgrading - are you SURE you want to newfs "
|
||||
@ -1046,7 +1012,7 @@ installFilesystems(dialogMenuItem *self)
|
||||
}
|
||||
|
||||
/* Switch to block device */
|
||||
sprintf(dname, "/dev/%s", rootdev->name);
|
||||
sprintf(dname, "/dev/%s", RootChunk->name);
|
||||
if (Mount("/mnt", dname)) {
|
||||
msgConfirm("Unable to mount the root file system on %s! Giving up.", dname);
|
||||
return DITEM_FAILURE | DITEM_RESTORE;
|
||||
@ -1102,7 +1068,7 @@ installFilesystems(dialogMenuItem *self)
|
||||
PartInfo *tmp = (PartInfo *)c2->private_data;
|
||||
|
||||
/* Already did root */
|
||||
if (c2 == rootdev)
|
||||
if (c2 == RootChunk)
|
||||
continue;
|
||||
|
||||
sprintf(dname, "%s/dev/%s",
|
||||
@ -1128,7 +1094,7 @@ installFilesystems(dialogMenuItem *self)
|
||||
char fname[80];
|
||||
int i;
|
||||
|
||||
if (c2 == swapdev)
|
||||
if (c2 == SwapChunk)
|
||||
continue;
|
||||
sprintf(fname, "%s/dev/%s", RunningAsInit ? "/mnt" : "", c2->name);
|
||||
i = (Fake || swapon(fname));
|
||||
|
@ -1385,42 +1385,37 @@ static char *
|
||||
try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
{
|
||||
daddr_t sz;
|
||||
struct chunk *root_chunk = NULL;
|
||||
struct chunk *swap_chunk = NULL;
|
||||
struct chunk *usr_chunk = NULL;
|
||||
struct chunk *var_chunk = NULL;
|
||||
struct chunk *tmp_chunk = NULL;
|
||||
struct chunk *home_chunk = NULL;
|
||||
Chunk *AutoHome, *AutoRoot, *AutoSwap;
|
||||
Chunk *AutoTmp, *AutoUsr, *AutoVar;
|
||||
int mib[2];
|
||||
unsigned long physmem;
|
||||
size_t size;
|
||||
Chunk *rootdev, *swapdev, *usrdev, *vardev;
|
||||
Chunk *tmpdev, *homedev;
|
||||
char *msg = NULL;
|
||||
|
||||
sz = space_free(label_chunk_info[here].c);
|
||||
if (sz <= FS_MIN_SIZE)
|
||||
return("Not enough free space to create a new partition in the slice");
|
||||
|
||||
(void)checkLabels(FALSE, &rootdev, &swapdev, &usrdev,
|
||||
&vardev, &tmpdev, &homedev);
|
||||
if (!rootdev) {
|
||||
(void)checkLabels(FALSE);
|
||||
AutoHome = AutoRoot = AutoSwap = NULL;
|
||||
AutoTmp = AutoUsr = AutoVar = NULL;
|
||||
if (RootChunk == NULL) {
|
||||
sz = requested_part_size(VAR_ROOT_SIZE, ROOT_NOMINAL_SIZE, ROOT_DEFAULT_SIZE, perc);
|
||||
|
||||
root_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
AutoRoot = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_IS_ROOT | CHUNK_AUTO_SIZE);
|
||||
if (!root_chunk) {
|
||||
if (!AutoRoot) {
|
||||
*req = 1;
|
||||
msg = "Unable to create the root partition. Too big?";
|
||||
goto done;
|
||||
}
|
||||
root_chunk->private_data = new_part(PART_FILESYSTEM, "/", TRUE);
|
||||
root_chunk->private_free = safe_free;
|
||||
root_chunk->flags |= CHUNK_NEWFS;
|
||||
AutoRoot->private_data = new_part(PART_FILESYSTEM, "/", TRUE);
|
||||
AutoRoot->private_free = safe_free;
|
||||
AutoRoot->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
if (!swapdev) {
|
||||
if (SwapChunk == NULL) {
|
||||
sz = requested_part_size(VAR_SWAP_SIZE, 0, 0, perc);
|
||||
if (sz == 0) {
|
||||
daddr_t nom;
|
||||
@ -1438,53 +1433,53 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
nom = (int)(physmem / 512) / 8;
|
||||
sz = nom + (def - nom) * perc / 100;
|
||||
}
|
||||
swap_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
AutoSwap = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_SWAP, CHUNK_AUTO_SIZE);
|
||||
if (!swap_chunk) {
|
||||
if (!AutoSwap) {
|
||||
*req = 1;
|
||||
msg = "Unable to create the swap partition. Too big?";
|
||||
goto done;
|
||||
}
|
||||
swap_chunk->private_data = 0;
|
||||
swap_chunk->private_free = safe_free;
|
||||
AutoSwap->private_data = 0;
|
||||
AutoSwap->private_free = safe_free;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
if (!vardev) {
|
||||
if (VarChunk == NULL) {
|
||||
sz = requested_part_size(VAR_VAR_SIZE, VAR_NOMINAL_SIZE, VAR_DEFAULT_SIZE, perc);
|
||||
|
||||
var_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
AutoVar = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_AUTO_SIZE);
|
||||
if (!var_chunk) {
|
||||
if (!AutoVar) {
|
||||
*req = 1;
|
||||
msg = "Not enough free space for /var - you will need to\n"
|
||||
"partition your disk manually with a custom install!";
|
||||
goto done;
|
||||
}
|
||||
var_chunk->private_data = new_part(PART_FILESYSTEM, "/var", TRUE);
|
||||
var_chunk->private_free = safe_free;
|
||||
var_chunk->flags |= CHUNK_NEWFS;
|
||||
AutoVar->private_data = new_part(PART_FILESYSTEM, "/var", TRUE);
|
||||
AutoVar->private_free = safe_free;
|
||||
AutoVar->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
if (!tmpdev && !variable_get(VAR_NO_TMP)) {
|
||||
if (TmpChunk == NULL && !variable_get(VAR_NO_TMP)) {
|
||||
sz = requested_part_size(VAR_TMP_SIZE, TMP_NOMINAL_SIZE, TMP_DEFAULT_SIZE, perc);
|
||||
|
||||
tmp_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
AutoTmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_AUTO_SIZE);
|
||||
if (!tmp_chunk) {
|
||||
if (!AutoTmp) {
|
||||
*req = 1;
|
||||
msg = "Not enough free space for /tmp - you will need to\n"
|
||||
"partition your disk manually with a custom install!";
|
||||
goto done;
|
||||
}
|
||||
tmp_chunk->private_data = new_part(PART_FILESYSTEM, "/tmp", TRUE);
|
||||
tmp_chunk->private_free = safe_free;
|
||||
tmp_chunk->flags |= CHUNK_NEWFS;
|
||||
AutoTmp->private_data = new_part(PART_FILESYSTEM, "/tmp", TRUE);
|
||||
AutoTmp->private_free = safe_free;
|
||||
AutoTmp->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
if (!usrdev && !variable_get(VAR_NO_USR)) {
|
||||
if (UsrChunk == NULL && !variable_get(VAR_NO_USR)) {
|
||||
sz = requested_part_size(VAR_USR_SIZE, USR_NOMINAL_SIZE, USR_DEFAULT_SIZE, perc);
|
||||
#if AUTO_HOME == 0
|
||||
sz = space_free(label_chunk_info[here].c);
|
||||
@ -1496,22 +1491,22 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
"partition your disk manually with a custom install!";
|
||||
}
|
||||
|
||||
usr_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
AutoUsr = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_AUTO_SIZE);
|
||||
if (!usr_chunk) {
|
||||
if (!AutoUsr) {
|
||||
msg = "Unable to create the /usr partition. Not enough space?\n"
|
||||
"You will need to partition your disk manually with a custom install!";
|
||||
goto done;
|
||||
}
|
||||
usr_chunk->private_data = new_part(PART_FILESYSTEM, "/usr", TRUE);
|
||||
usr_chunk->private_free = safe_free;
|
||||
usr_chunk->flags |= CHUNK_NEWFS;
|
||||
AutoUsr->private_data = new_part(PART_FILESYSTEM, "/usr", TRUE);
|
||||
AutoUsr->private_free = safe_free;
|
||||
AutoUsr->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
}
|
||||
#if AUTO_HOME == 1
|
||||
if (!homedev && !variable_get(VAR_NO_HOME)) {
|
||||
if (HomeChunk == NULL && !variable_get(VAR_NO_HOME)) {
|
||||
sz = requested_part_size(VAR_HOME_SIZE, HOME_NOMINAL_SIZE, HOME_DEFAULT_SIZE, perc);
|
||||
if (sz < space_free(label_chunk_info[here].c))
|
||||
sz = space_free(label_chunk_info[here].c);
|
||||
@ -1523,17 +1518,17 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
goto done;
|
||||
}
|
||||
|
||||
home_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
AutoHome = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_AUTO_SIZE);
|
||||
if (!home_chunk) {
|
||||
if (!AutoHome) {
|
||||
msg = "Unable to create the /home partition. Not enough space?\n"
|
||||
"You will need to partition your disk manually with a custom install!";
|
||||
goto done;
|
||||
}
|
||||
home_chunk->private_data = new_part(PART_FILESYSTEM, "/home", TRUE);
|
||||
home_chunk->private_free = safe_free;
|
||||
home_chunk->flags |= CHUNK_NEWFS;
|
||||
AutoHome->private_data = new_part(PART_FILESYSTEM, "/home", TRUE);
|
||||
AutoHome->private_free = safe_free;
|
||||
AutoHome->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
}
|
||||
@ -1545,18 +1540,18 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
|
||||
done:
|
||||
if (msg) {
|
||||
if (root_chunk)
|
||||
Delete_Chunk(root_chunk->disk, root_chunk);
|
||||
if (swap_chunk)
|
||||
Delete_Chunk(swap_chunk->disk, swap_chunk);
|
||||
if (var_chunk)
|
||||
Delete_Chunk(var_chunk->disk, var_chunk);
|
||||
if (tmp_chunk)
|
||||
Delete_Chunk(tmp_chunk->disk, tmp_chunk);
|
||||
if (usr_chunk)
|
||||
Delete_Chunk(usr_chunk->disk, usr_chunk);
|
||||
if (home_chunk)
|
||||
Delete_Chunk(home_chunk->disk, home_chunk);
|
||||
if (AutoRoot != NULL)
|
||||
Delete_Chunk(AutoRoot->disk, AutoRoot);
|
||||
if (AutoSwap != NULL)
|
||||
Delete_Chunk(AutoSwap->disk, AutoSwap);
|
||||
if (AutoVar != NULL)
|
||||
Delete_Chunk(AutoVar->disk, AutoVar);
|
||||
if (AutoTmp != NULL)
|
||||
Delete_Chunk(AutoTmp->disk, AutoTmp);
|
||||
if (AutoUsr != NULL)
|
||||
Delete_Chunk(AutoUsr->disk, AutoUsr);
|
||||
if (AutoHome != NULL)
|
||||
Delete_Chunk(AutoHome->disk, AutoHome);
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
return(msg);
|
||||
|
@ -480,6 +480,17 @@ extern DMenu MenuXF86Config; /* Select XFree86 configuration type */
|
||||
extern int FixItMode; /* FixItMode starts shell onc urrent device (ie Serial port) */
|
||||
extern const char * StartName; /* Which name we were started as */
|
||||
|
||||
/* Important chunks. */
|
||||
extern Chunk *HomeChunk;
|
||||
extern Chunk *RootChunk;
|
||||
extern Chunk *SwapChunk;
|
||||
extern Chunk *TmpChunk;
|
||||
extern Chunk *UsrChunk;
|
||||
extern Chunk *VarChunk;
|
||||
#ifdef __ia64__
|
||||
extern Chunk *EfiChunk;
|
||||
#endif
|
||||
|
||||
/* Stuff from libdialog which isn't properly declared outside */
|
||||
extern void display_helpfile(void);
|
||||
extern void display_helpline(WINDOW *w, int y, int width);
|
||||
@ -656,7 +667,7 @@ int index_initialize(char *path);
|
||||
PkgNodePtr index_search(PkgNodePtr top, char *str, PkgNodePtr *tp);
|
||||
|
||||
/* install.c */
|
||||
extern Boolean checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vdev, Chunk **vtdev, Chunk **hdev);
|
||||
extern Boolean checkLabels(Boolean whinge);
|
||||
extern int installCommit(dialogMenuItem *self);
|
||||
extern int installCustomCommit(dialogMenuItem *self);
|
||||
extern int installExpress(dialogMenuItem *self);
|
||||
|
@ -54,6 +54,16 @@ int BootMgr; /* Which boot manager we're using */
|
||||
int StatusLine; /* Where to stick our status messages */
|
||||
jmp_buf BailOut; /* Beam me up, scotty! The natives are pissed! */
|
||||
|
||||
Chunk *HomeChunk;
|
||||
Chunk *RootChunk;
|
||||
Chunk *SwapChunk;
|
||||
Chunk *TmpChunk;
|
||||
Chunk *UsrChunk;
|
||||
Chunk *VarChunk;
|
||||
#ifdef __ia64__
|
||||
Chunk *EfiChunk;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Yes, I know some of these are already automatically initialized as
|
||||
* globals. I simply find it clearer to set everything explicitly.
|
||||
@ -70,4 +80,14 @@ globalsInit(void)
|
||||
VarHead = NULL;
|
||||
mediaDevice = NULL;
|
||||
RunningAsInit = FALSE;
|
||||
|
||||
HomeChunk = NULL;
|
||||
RootChunk = NULL;
|
||||
SwapChunk = NULL;
|
||||
TmpChunk = NULL;
|
||||
UsrChunk = NULL;
|
||||
VarChunk = NULL;
|
||||
#ifdef __ia64__
|
||||
EfiChunk = NULL;
|
||||
#endif
|
||||
}
|
||||
|
@ -68,40 +68,14 @@ static void fixit_common(void);
|
||||
|
||||
static void installConfigure(void);
|
||||
|
||||
#ifdef __ia64__
|
||||
static const char *
|
||||
efi_mountpoint(void)
|
||||
{
|
||||
Device **devs;
|
||||
Disk *disk;
|
||||
Chunk *c;
|
||||
PartInfo *pi;
|
||||
int i;
|
||||
|
||||
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
|
||||
for (i = 0; devs[i] != NULL; i++) {
|
||||
if (!devs[i]->enabled)
|
||||
continue;
|
||||
disk = (Disk *)devs[i]->private;
|
||||
for (c = disk->chunks->part; c != NULL; c = c->next) {
|
||||
if (c->type == efi && c->private_data != NULL) {
|
||||
pi = (PartInfo *)c->private_data;
|
||||
if (pi->mountpoint[0] == '/')
|
||||
return (pi->mountpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
Boolean
|
||||
checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vdev, Chunk **tdev, Chunk **hdev)
|
||||
checkLabels(Boolean whinge)
|
||||
{
|
||||
Device **devs;
|
||||
Boolean status;
|
||||
Disk *disk;
|
||||
Chunk *c1, *c2, *rootdev, *swapdev, *usrdev, *vardev, *tmpdev, *homedev;
|
||||
PartInfo *pi;
|
||||
Chunk *c1, *c2;
|
||||
int i;
|
||||
|
||||
/* Don't allow whinging if noWarn is set */
|
||||
@ -109,19 +83,11 @@ checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vd
|
||||
whinge = FALSE;
|
||||
|
||||
status = TRUE;
|
||||
if (rdev)
|
||||
*rdev = NULL;
|
||||
if (sdev)
|
||||
*sdev = NULL;
|
||||
if (udev)
|
||||
*udev = NULL;
|
||||
if (vdev)
|
||||
*vdev = NULL;
|
||||
if (tdev)
|
||||
*tdev = NULL;
|
||||
if (hdev)
|
||||
*hdev = NULL;
|
||||
rootdev = swapdev = usrdev = vardev = tmpdev = homedev = NULL;
|
||||
HomeChunk = RootChunk = SwapChunk = NULL;
|
||||
TmpChunk = UsrChunk = VarChunk = NULL;
|
||||
#ifdef __ia64__
|
||||
EfiChunk = NULL;
|
||||
#endif
|
||||
|
||||
/* We don't need to worry about root/usr/swap if we're already multiuser */
|
||||
if (!RunningAsInit)
|
||||
@ -146,68 +112,70 @@ checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vd
|
||||
if (c1->type == freebsd) {
|
||||
for (c2 = c1->part; c2; c2 = c2->next) {
|
||||
#endif
|
||||
if (c2->type == part && c2->subtype != FS_SWAP && c2->private_data) {
|
||||
if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/")) {
|
||||
if (rootdev) {
|
||||
|
||||
pi = (PartInfo *)c2->private_data;
|
||||
if (c2->type == part && c2->subtype != FS_SWAP && pi != NULL) {
|
||||
if (!strcmp(pi->mountpoint, "/")) {
|
||||
if (RootChunk) {
|
||||
if (whinge)
|
||||
msgConfirm("WARNING: You have more than one root device set?!\n"
|
||||
"Using the first one found.");
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
rootdev = c2;
|
||||
RootChunk = c2;
|
||||
if (isDebug())
|
||||
msgDebug("Found rootdev at %s!\n", rootdev->name);
|
||||
msgDebug("Found rootdev at %s!\n", RootChunk->name);
|
||||
}
|
||||
}
|
||||
else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/usr")) {
|
||||
if (usrdev) {
|
||||
else if (!strcmp(pi->mountpoint, "/usr")) {
|
||||
if (UsrChunk) {
|
||||
if (whinge)
|
||||
msgConfirm("WARNING: You have more than one /usr filesystem.\n"
|
||||
"Using the first one found.");
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
usrdev = c2;
|
||||
UsrChunk = c2;
|
||||
if (isDebug())
|
||||
msgDebug("Found usrdev at %s!\n", usrdev->name);
|
||||
msgDebug("Found usrdev at %s!\n", UsrChunk->name);
|
||||
}
|
||||
}
|
||||
else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/var")) {
|
||||
if (vardev) {
|
||||
else if (!strcmp(pi->mountpoint, "/var")) {
|
||||
if (VarChunk) {
|
||||
if (whinge)
|
||||
msgConfirm("WARNING: You have more than one /var filesystem.\n"
|
||||
"Using the first one found.");
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
vardev = c2;
|
||||
VarChunk = c2;
|
||||
if (isDebug())
|
||||
msgDebug("Found vardev at %s!\n", vardev->name);
|
||||
msgDebug("Found vardev at %s!\n", VarChunk->name);
|
||||
}
|
||||
} else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/tmp")) {
|
||||
if (tmpdev) {
|
||||
} else if (!strcmp(pi->mountpoint, "/tmp")) {
|
||||
if (TmpChunk) {
|
||||
if (whinge)
|
||||
msgConfirm("WARNING: You have more than one /tmp filesystem.\n"
|
||||
"Using the first one found.");
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
tmpdev = c2;
|
||||
TmpChunk = c2;
|
||||
if (isDebug())
|
||||
msgDebug("Found tmpdev at %s!\n", tmpdev->name);
|
||||
msgDebug("Found tmpdev at %s!\n", TmpChunk->name);
|
||||
}
|
||||
} else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/home")) {
|
||||
if (homedev) {
|
||||
} else if (!strcmp(pi->mountpoint, "/home")) {
|
||||
if (HomeChunk) {
|
||||
if (whinge)
|
||||
msgConfirm("WARNING: You have more than one /home filesystem.\n"
|
||||
"Using the first one found.");
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
homedev = c2;
|
||||
HomeChunk = c2;
|
||||
if (isDebug())
|
||||
msgDebug("Found homedev at %s!\n", homedev->name);
|
||||
msgDebug("Found homedev at %s!\n", HomeChunk->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -237,10 +205,10 @@ checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vd
|
||||
if (c1->type == freebsd) {
|
||||
for (c2 = c1->part; c2; c2 = c2->next) {
|
||||
#endif
|
||||
if (c2->type == part && c2->subtype == FS_SWAP && !swapdev) {
|
||||
swapdev = c2;
|
||||
if (c2->type == part && c2->subtype == FS_SWAP && !SwapChunk) {
|
||||
SwapChunk = c2;
|
||||
if (isDebug())
|
||||
msgDebug("Found swapdev at %s!\n", swapdev->name);
|
||||
msgDebug("Found swapdev at %s!\n", SwapChunk->name);
|
||||
break;
|
||||
}
|
||||
#ifndef __ia64__
|
||||
@ -250,34 +218,33 @@ checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vd
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy our values over */
|
||||
if (rdev)
|
||||
*rdev = rootdev;
|
||||
if (sdev)
|
||||
*sdev = swapdev;
|
||||
if (udev)
|
||||
*udev = usrdev;
|
||||
if (vdev)
|
||||
*vdev = vardev;
|
||||
if (tdev)
|
||||
*tdev = tmpdev;
|
||||
if (hdev)
|
||||
*hdev = homedev;
|
||||
#ifdef __ia64__
|
||||
for (i = 0; devs[i] != NULL; i++) {
|
||||
if (!devs[i]->enabled)
|
||||
continue;
|
||||
disk = (Disk *)devs[i]->private;
|
||||
for (c1 = disk->chunks->part; c1 != NULL; c1 = c1->next) {
|
||||
pi = (PartInfo *)c1->private_data;
|
||||
if (c1->type == efi && pi != NULL && pi->mountpoint[0] == '/')
|
||||
EfiChunk = c1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!rootdev && whinge) {
|
||||
if (!RootChunk && whinge) {
|
||||
msgConfirm("No root device found - you must label a partition as /\n"
|
||||
"in the label editor.");
|
||||
status = FALSE;
|
||||
}
|
||||
if (!swapdev && whinge) {
|
||||
if (!SwapChunk && whinge) {
|
||||
if (msgYesNo("No swap devices found - you should create at least one\n"
|
||||
"swap partition. Without swap, the install will fail\n"
|
||||
"if you do not have enough RAM. Continue anyway?"))
|
||||
status = FALSE;
|
||||
}
|
||||
#ifdef __ia64__
|
||||
if (efi_mountpoint() == NULL && whinge) {
|
||||
if (msgYesNo("No EFI system partition found. Is this what you want?"))
|
||||
if (EfiChunk == NULL && whinge) {
|
||||
if (msgYesNo("No (mounted) EFI system partition found. Is this what you want?"))
|
||||
status = FALSE;
|
||||
}
|
||||
#endif
|
||||
@ -896,11 +863,13 @@ installFixupBase(dialogMenuItem *self)
|
||||
|
||||
#ifdef __ia64__
|
||||
/* Move /boot to the the EFI partition and make /boot a link to it. */
|
||||
efi_mntpt = efi_mountpoint();
|
||||
efi_mntpt = (EfiChunk != NULL) ? ((PartInfo *)EfiChunk->private_data)->mountpoint : NULL;
|
||||
if (efi_mntpt != NULL) {
|
||||
vsystem("if [ ! -L /boot ]; then mv /boot %s; fi", efi_mntpt);
|
||||
vsystem("if [ ! -e /boot ]; then ln -sf %s/boot /boot; fi",
|
||||
efi_mntpt + 1); /* Skip leading '/' */
|
||||
/* Make sure the kernel knows which partition is the root file system. */
|
||||
vsystem("echo 'vfs.root.mountfrom=\"ufs:/dev/%s\"' >> /boot/loader.conf", RootChunk->name);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -953,7 +922,7 @@ installFilesystems(dialogMenuItem *self)
|
||||
{
|
||||
int i;
|
||||
Disk *disk;
|
||||
Chunk *c1, *c2, *rootdev, *swapdev;
|
||||
Chunk *c1, *c2;
|
||||
Device **devs;
|
||||
PartInfo *root;
|
||||
char dname[80];
|
||||
@ -964,18 +933,15 @@ installFilesystems(dialogMenuItem *self)
|
||||
return DITEM_SUCCESS;
|
||||
|
||||
upgrade = !variable_cmp(SYSTEM_STATE, "upgrade");
|
||||
if (!checkLabels(TRUE, &rootdev, &swapdev, NULL, NULL, NULL, NULL))
|
||||
if (!checkLabels(TRUE))
|
||||
return DITEM_FAILURE;
|
||||
|
||||
if (rootdev)
|
||||
root = (PartInfo *)rootdev->private_data;
|
||||
else
|
||||
root = NULL;
|
||||
root = (RootChunk != NULL) ? (PartInfo *)RootChunk->private_data : NULL;
|
||||
|
||||
command_clear();
|
||||
if (swapdev && RunningAsInit) {
|
||||
if (SwapChunk && RunningAsInit) {
|
||||
/* As the very first thing, try to get ourselves some swap space */
|
||||
sprintf(dname, "/dev/%s", swapdev->name);
|
||||
sprintf(dname, "/dev/%s", SwapChunk->name);
|
||||
if (!Fake && !file_readable(dname)) {
|
||||
msgConfirm("Unable to find device node for %s in /dev!\n"
|
||||
"The creation of filesystems will be aborted.", dname);
|
||||
@ -995,16 +961,16 @@ installFilesystems(dialogMenuItem *self)
|
||||
}
|
||||
}
|
||||
|
||||
if (rootdev && RunningAsInit) {
|
||||
if (RootChunk && RunningAsInit) {
|
||||
/* Next, create and/or mount the root device */
|
||||
sprintf(dname, "/dev/%s", rootdev->name);
|
||||
sprintf(dname, "/dev/%s", RootChunk->name);
|
||||
if (!Fake && !file_readable(dname)) {
|
||||
msgConfirm("Unable to make device node for %s in /dev!\n"
|
||||
"The creation of filesystems will be aborted.", dname);
|
||||
return DITEM_FAILURE | DITEM_RESTORE;
|
||||
}
|
||||
if (strcmp(root->mountpoint, "/"))
|
||||
msgConfirm("Warning: %s is marked as a root partition but is mounted on %s", rootdev->name, root->mountpoint);
|
||||
msgConfirm("Warning: %s is marked as a root partition but is mounted on %s", RootChunk->name, root->mountpoint);
|
||||
|
||||
if (root->do_newfs && (!upgrade ||
|
||||
!msgNoYes("You are upgrading - are you SURE you want to newfs "
|
||||
@ -1046,7 +1012,7 @@ installFilesystems(dialogMenuItem *self)
|
||||
}
|
||||
|
||||
/* Switch to block device */
|
||||
sprintf(dname, "/dev/%s", rootdev->name);
|
||||
sprintf(dname, "/dev/%s", RootChunk->name);
|
||||
if (Mount("/mnt", dname)) {
|
||||
msgConfirm("Unable to mount the root file system on %s! Giving up.", dname);
|
||||
return DITEM_FAILURE | DITEM_RESTORE;
|
||||
@ -1102,7 +1068,7 @@ installFilesystems(dialogMenuItem *self)
|
||||
PartInfo *tmp = (PartInfo *)c2->private_data;
|
||||
|
||||
/* Already did root */
|
||||
if (c2 == rootdev)
|
||||
if (c2 == RootChunk)
|
||||
continue;
|
||||
|
||||
sprintf(dname, "%s/dev/%s",
|
||||
@ -1128,7 +1094,7 @@ installFilesystems(dialogMenuItem *self)
|
||||
char fname[80];
|
||||
int i;
|
||||
|
||||
if (c2 == swapdev)
|
||||
if (c2 == SwapChunk)
|
||||
continue;
|
||||
sprintf(fname, "%s/dev/%s", RunningAsInit ? "/mnt" : "", c2->name);
|
||||
i = (Fake || swapon(fname));
|
||||
|
@ -1385,42 +1385,37 @@ static char *
|
||||
try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
{
|
||||
daddr_t sz;
|
||||
struct chunk *root_chunk = NULL;
|
||||
struct chunk *swap_chunk = NULL;
|
||||
struct chunk *usr_chunk = NULL;
|
||||
struct chunk *var_chunk = NULL;
|
||||
struct chunk *tmp_chunk = NULL;
|
||||
struct chunk *home_chunk = NULL;
|
||||
Chunk *AutoHome, *AutoRoot, *AutoSwap;
|
||||
Chunk *AutoTmp, *AutoUsr, *AutoVar;
|
||||
int mib[2];
|
||||
unsigned long physmem;
|
||||
size_t size;
|
||||
Chunk *rootdev, *swapdev, *usrdev, *vardev;
|
||||
Chunk *tmpdev, *homedev;
|
||||
char *msg = NULL;
|
||||
|
||||
sz = space_free(label_chunk_info[here].c);
|
||||
if (sz <= FS_MIN_SIZE)
|
||||
return("Not enough free space to create a new partition in the slice");
|
||||
|
||||
(void)checkLabels(FALSE, &rootdev, &swapdev, &usrdev,
|
||||
&vardev, &tmpdev, &homedev);
|
||||
if (!rootdev) {
|
||||
(void)checkLabels(FALSE);
|
||||
AutoHome = AutoRoot = AutoSwap = NULL;
|
||||
AutoTmp = AutoUsr = AutoVar = NULL;
|
||||
if (RootChunk == NULL) {
|
||||
sz = requested_part_size(VAR_ROOT_SIZE, ROOT_NOMINAL_SIZE, ROOT_DEFAULT_SIZE, perc);
|
||||
|
||||
root_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
AutoRoot = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_IS_ROOT | CHUNK_AUTO_SIZE);
|
||||
if (!root_chunk) {
|
||||
if (!AutoRoot) {
|
||||
*req = 1;
|
||||
msg = "Unable to create the root partition. Too big?";
|
||||
goto done;
|
||||
}
|
||||
root_chunk->private_data = new_part(PART_FILESYSTEM, "/", TRUE);
|
||||
root_chunk->private_free = safe_free;
|
||||
root_chunk->flags |= CHUNK_NEWFS;
|
||||
AutoRoot->private_data = new_part(PART_FILESYSTEM, "/", TRUE);
|
||||
AutoRoot->private_free = safe_free;
|
||||
AutoRoot->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
if (!swapdev) {
|
||||
if (SwapChunk == NULL) {
|
||||
sz = requested_part_size(VAR_SWAP_SIZE, 0, 0, perc);
|
||||
if (sz == 0) {
|
||||
daddr_t nom;
|
||||
@ -1438,53 +1433,53 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
nom = (int)(physmem / 512) / 8;
|
||||
sz = nom + (def - nom) * perc / 100;
|
||||
}
|
||||
swap_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
AutoSwap = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_SWAP, CHUNK_AUTO_SIZE);
|
||||
if (!swap_chunk) {
|
||||
if (!AutoSwap) {
|
||||
*req = 1;
|
||||
msg = "Unable to create the swap partition. Too big?";
|
||||
goto done;
|
||||
}
|
||||
swap_chunk->private_data = 0;
|
||||
swap_chunk->private_free = safe_free;
|
||||
AutoSwap->private_data = 0;
|
||||
AutoSwap->private_free = safe_free;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
if (!vardev) {
|
||||
if (VarChunk == NULL) {
|
||||
sz = requested_part_size(VAR_VAR_SIZE, VAR_NOMINAL_SIZE, VAR_DEFAULT_SIZE, perc);
|
||||
|
||||
var_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
AutoVar = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_AUTO_SIZE);
|
||||
if (!var_chunk) {
|
||||
if (!AutoVar) {
|
||||
*req = 1;
|
||||
msg = "Not enough free space for /var - you will need to\n"
|
||||
"partition your disk manually with a custom install!";
|
||||
goto done;
|
||||
}
|
||||
var_chunk->private_data = new_part(PART_FILESYSTEM, "/var", TRUE);
|
||||
var_chunk->private_free = safe_free;
|
||||
var_chunk->flags |= CHUNK_NEWFS;
|
||||
AutoVar->private_data = new_part(PART_FILESYSTEM, "/var", TRUE);
|
||||
AutoVar->private_free = safe_free;
|
||||
AutoVar->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
if (!tmpdev && !variable_get(VAR_NO_TMP)) {
|
||||
if (TmpChunk == NULL && !variable_get(VAR_NO_TMP)) {
|
||||
sz = requested_part_size(VAR_TMP_SIZE, TMP_NOMINAL_SIZE, TMP_DEFAULT_SIZE, perc);
|
||||
|
||||
tmp_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
AutoTmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_AUTO_SIZE);
|
||||
if (!tmp_chunk) {
|
||||
if (!AutoTmp) {
|
||||
*req = 1;
|
||||
msg = "Not enough free space for /tmp - you will need to\n"
|
||||
"partition your disk manually with a custom install!";
|
||||
goto done;
|
||||
}
|
||||
tmp_chunk->private_data = new_part(PART_FILESYSTEM, "/tmp", TRUE);
|
||||
tmp_chunk->private_free = safe_free;
|
||||
tmp_chunk->flags |= CHUNK_NEWFS;
|
||||
AutoTmp->private_data = new_part(PART_FILESYSTEM, "/tmp", TRUE);
|
||||
AutoTmp->private_free = safe_free;
|
||||
AutoTmp->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
if (!usrdev && !variable_get(VAR_NO_USR)) {
|
||||
if (UsrChunk == NULL && !variable_get(VAR_NO_USR)) {
|
||||
sz = requested_part_size(VAR_USR_SIZE, USR_NOMINAL_SIZE, USR_DEFAULT_SIZE, perc);
|
||||
#if AUTO_HOME == 0
|
||||
sz = space_free(label_chunk_info[here].c);
|
||||
@ -1496,22 +1491,22 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
"partition your disk manually with a custom install!";
|
||||
}
|
||||
|
||||
usr_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
AutoUsr = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_AUTO_SIZE);
|
||||
if (!usr_chunk) {
|
||||
if (!AutoUsr) {
|
||||
msg = "Unable to create the /usr partition. Not enough space?\n"
|
||||
"You will need to partition your disk manually with a custom install!";
|
||||
goto done;
|
||||
}
|
||||
usr_chunk->private_data = new_part(PART_FILESYSTEM, "/usr", TRUE);
|
||||
usr_chunk->private_free = safe_free;
|
||||
usr_chunk->flags |= CHUNK_NEWFS;
|
||||
AutoUsr->private_data = new_part(PART_FILESYSTEM, "/usr", TRUE);
|
||||
AutoUsr->private_free = safe_free;
|
||||
AutoUsr->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
}
|
||||
#if AUTO_HOME == 1
|
||||
if (!homedev && !variable_get(VAR_NO_HOME)) {
|
||||
if (HomeChunk == NULL && !variable_get(VAR_NO_HOME)) {
|
||||
sz = requested_part_size(VAR_HOME_SIZE, HOME_NOMINAL_SIZE, HOME_DEFAULT_SIZE, perc);
|
||||
if (sz < space_free(label_chunk_info[here].c))
|
||||
sz = space_free(label_chunk_info[here].c);
|
||||
@ -1523,17 +1518,17 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
goto done;
|
||||
}
|
||||
|
||||
home_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
AutoHome = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_AUTO_SIZE);
|
||||
if (!home_chunk) {
|
||||
if (!AutoHome) {
|
||||
msg = "Unable to create the /home partition. Not enough space?\n"
|
||||
"You will need to partition your disk manually with a custom install!";
|
||||
goto done;
|
||||
}
|
||||
home_chunk->private_data = new_part(PART_FILESYSTEM, "/home", TRUE);
|
||||
home_chunk->private_free = safe_free;
|
||||
home_chunk->flags |= CHUNK_NEWFS;
|
||||
AutoHome->private_data = new_part(PART_FILESYSTEM, "/home", TRUE);
|
||||
AutoHome->private_free = safe_free;
|
||||
AutoHome->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
}
|
||||
@ -1545,18 +1540,18 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
|
||||
done:
|
||||
if (msg) {
|
||||
if (root_chunk)
|
||||
Delete_Chunk(root_chunk->disk, root_chunk);
|
||||
if (swap_chunk)
|
||||
Delete_Chunk(swap_chunk->disk, swap_chunk);
|
||||
if (var_chunk)
|
||||
Delete_Chunk(var_chunk->disk, var_chunk);
|
||||
if (tmp_chunk)
|
||||
Delete_Chunk(tmp_chunk->disk, tmp_chunk);
|
||||
if (usr_chunk)
|
||||
Delete_Chunk(usr_chunk->disk, usr_chunk);
|
||||
if (home_chunk)
|
||||
Delete_Chunk(home_chunk->disk, home_chunk);
|
||||
if (AutoRoot != NULL)
|
||||
Delete_Chunk(AutoRoot->disk, AutoRoot);
|
||||
if (AutoSwap != NULL)
|
||||
Delete_Chunk(AutoSwap->disk, AutoSwap);
|
||||
if (AutoVar != NULL)
|
||||
Delete_Chunk(AutoVar->disk, AutoVar);
|
||||
if (AutoTmp != NULL)
|
||||
Delete_Chunk(AutoTmp->disk, AutoTmp);
|
||||
if (AutoUsr != NULL)
|
||||
Delete_Chunk(AutoUsr->disk, AutoUsr);
|
||||
if (AutoHome != NULL)
|
||||
Delete_Chunk(AutoHome->disk, AutoHome);
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
return(msg);
|
||||
|
@ -480,6 +480,17 @@ extern DMenu MenuXF86Config; /* Select XFree86 configuration type */
|
||||
extern int FixItMode; /* FixItMode starts shell onc urrent device (ie Serial port) */
|
||||
extern const char * StartName; /* Which name we were started as */
|
||||
|
||||
/* Important chunks. */
|
||||
extern Chunk *HomeChunk;
|
||||
extern Chunk *RootChunk;
|
||||
extern Chunk *SwapChunk;
|
||||
extern Chunk *TmpChunk;
|
||||
extern Chunk *UsrChunk;
|
||||
extern Chunk *VarChunk;
|
||||
#ifdef __ia64__
|
||||
extern Chunk *EfiChunk;
|
||||
#endif
|
||||
|
||||
/* Stuff from libdialog which isn't properly declared outside */
|
||||
extern void display_helpfile(void);
|
||||
extern void display_helpline(WINDOW *w, int y, int width);
|
||||
@ -656,7 +667,7 @@ int index_initialize(char *path);
|
||||
PkgNodePtr index_search(PkgNodePtr top, char *str, PkgNodePtr *tp);
|
||||
|
||||
/* install.c */
|
||||
extern Boolean checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vdev, Chunk **vtdev, Chunk **hdev);
|
||||
extern Boolean checkLabels(Boolean whinge);
|
||||
extern int installCommit(dialogMenuItem *self);
|
||||
extern int installCustomCommit(dialogMenuItem *self);
|
||||
extern int installExpress(dialogMenuItem *self);
|
||||
|
Loading…
Reference in New Issue
Block a user