1995-04-27 12:50:35 +00:00
|
|
|
/*
|
1999-08-28 01:35:59 +00:00
|
|
|
* $FreeBSD$
|
1995-04-27 12:50:35 +00:00
|
|
|
*
|
|
|
|
* Copyright (c) 1995
|
|
|
|
* Jordan Hubbard. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
1995-05-30 08:29:07 +00:00
|
|
|
* notice, this list of conditions and the following disclaimer,
|
|
|
|
* verbatim and that no modifications are made prior to this
|
1995-04-27 12:50:35 +00:00
|
|
|
* point in the file.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-08-07 23:35:49 +00:00
|
|
|
#include "sade.h"
|
1995-12-07 10:34:59 +00:00
|
|
|
#include <ctype.h>
|
2005-03-02 22:27:22 +00:00
|
|
|
#include <sys/consio.h>
|
1995-05-08 06:06:30 +00:00
|
|
|
#include <sys/disklabel.h>
|
|
|
|
#include <sys/errno.h>
|
1995-05-25 18:48:33 +00:00
|
|
|
#include <sys/ioctl.h>
|
1995-05-08 06:06:30 +00:00
|
|
|
#include <sys/fcntl.h>
|
1995-05-20 10:33:14 +00:00
|
|
|
#include <sys/wait.h>
|
2002-10-21 21:41:19 +00:00
|
|
|
#include <sys/uio.h>
|
1995-12-07 10:34:59 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#define MSDOSFS
|
|
|
|
#include <sys/mount.h>
|
1997-04-03 13:44:59 +00:00
|
|
|
#include <ufs/ufs/ufsmount.h>
|
2001-05-25 08:14:14 +00:00
|
|
|
#include <fs/msdosfs/msdosfsmount.h>
|
1995-12-07 10:34:59 +00:00
|
|
|
#undef MSDOSFS
|
1995-09-18 16:53:06 +00:00
|
|
|
#include <sys/stat.h>
|
1998-11-24 00:18:57 +00:00
|
|
|
#include <sys/sysctl.h>
|
2004-08-02 23:18:48 +00:00
|
|
|
#include <libdisk.h>
|
Reformulate how sysinstall handles file system options in the label
editor, in order to support specifying UFS2 as a newfs option.
(1) Support three different newfs types: NEWFS_UFS, NEWFS_MSDOS, and
NEWFS_CUSTOM. Don't mix up the arguments to them: you can't use
soft updates on an msdos file system.
(2) Distinguish adding new arguments to the newfs command line from
replacing it. Permit the addition of new arguments by the user for
NEWFS_UFS. If we entirely replace the command line provided by
sysinstall, call it NEWFS_CUSTOM. 'N' will now add additional
arguments; 'Z' will opt to replace the newfs command line entirely,
but will prompt the user with their current command line as a
starting point.
(3) Construct the newfs command line dynamically based on the options
provided by the user at label-time. Right now, this means selecting
UFS1 vs. UFS2, and the soft updates flag. Drop in some variables
to support ACLs and MAC Multilabel in the future also, but don't
expose them now.
This provides sysinstall with the ability to do more "in band" editing
of the newfs command line, so we can provide more support for the user,
but doesn't sacrifice the ability to entirely specify the newfs command
line of the user is willing to give up on the cushiness factor. It
also makes it easier for us to specify defaults in the future, and
define conditional behavior based on user configuration selections.
For now, we default to UFS1, and permit UFS2 to be used as the root
only on non-i386 systems.
While I was there, I dropped the default fragment and block sizes,
since newfs has much more sensible defaults now.
Reviewed by: jhb, marcel
Approved by: re
ia64 bits from: marcel
2002-12-03 22:25:47 +00:00
|
|
|
#include <limits.h>
|
1995-05-08 06:06:30 +00:00
|
|
|
#include <unistd.h>
|
1999-09-04 16:01:15 +00:00
|
|
|
#include <termios.h>
|
1995-04-27 12:50:35 +00:00
|
|
|
|
1995-12-07 10:34:59 +00:00
|
|
|
#define TERMCAP_FILE "/usr/share/misc/termcap"
|
1995-05-22 14:10:25 +00:00
|
|
|
|
1996-07-31 06:20:59 +00:00
|
|
|
Boolean
|
2004-08-07 01:19:54 +00:00
|
|
|
checkLabels(Boolean whinge)
|
1995-05-22 14:10:25 +00:00
|
|
|
{
|
1995-12-07 10:34:59 +00:00
|
|
|
Boolean status;
|
1995-05-22 14:10:25 +00:00
|
|
|
|
1997-06-18 05:11:37 +00:00
|
|
|
/* Don't allow whinging if noWarn is set */
|
|
|
|
if (variable_get(VAR_NO_WARN))
|
|
|
|
whinge = FALSE;
|
|
|
|
|
1995-12-07 10:34:59 +00:00
|
|
|
status = TRUE;
|
2004-08-07 01:19:54 +00:00
|
|
|
HomeChunk = RootChunk = SwapChunk = NULL;
|
|
|
|
TmpChunk = UsrChunk = VarChunk = NULL;
|
|
|
|
#ifdef __ia64__
|
|
|
|
EfiChunk = NULL;
|
|
|
|
#endif
|
1996-07-09 07:17:03 +00:00
|
|
|
|
1996-07-31 06:20:59 +00:00
|
|
|
/* We don't need to worry about root/usr/swap if we're already multiuser */
|
1995-12-07 10:34:59 +00:00
|
|
|
return status;
|
1995-05-22 14:10:25 +00:00
|
|
|
}
|
|
|
|
|
Reformulate how sysinstall handles file system options in the label
editor, in order to support specifying UFS2 as a newfs option.
(1) Support three different newfs types: NEWFS_UFS, NEWFS_MSDOS, and
NEWFS_CUSTOM. Don't mix up the arguments to them: you can't use
soft updates on an msdos file system.
(2) Distinguish adding new arguments to the newfs command line from
replacing it. Permit the addition of new arguments by the user for
NEWFS_UFS. If we entirely replace the command line provided by
sysinstall, call it NEWFS_CUSTOM. 'N' will now add additional
arguments; 'Z' will opt to replace the newfs command line entirely,
but will prompt the user with their current command line as a
starting point.
(3) Construct the newfs command line dynamically based on the options
provided by the user at label-time. Right now, this means selecting
UFS1 vs. UFS2, and the soft updates flag. Drop in some variables
to support ACLs and MAC Multilabel in the future also, but don't
expose them now.
This provides sysinstall with the ability to do more "in band" editing
of the newfs command line, so we can provide more support for the user,
but doesn't sacrifice the ability to entirely specify the newfs command
line of the user is willing to give up on the cushiness factor. It
also makes it easier for us to specify defaults in the future, and
define conditional behavior based on user configuration selections.
For now, we default to UFS1, and permit UFS2 to be used as the root
only on non-i386 systems.
While I was there, I dropped the default fragment and block sizes,
since newfs has much more sensible defaults now.
Reviewed by: jhb, marcel
Approved by: re
ia64 bits from: marcel
2002-12-03 22:25:47 +00:00
|
|
|
#define QUEUE_YES 1
|
|
|
|
#define QUEUE_NO 0
|
|
|
|
static int
|
|
|
|
performNewfs(PartInfo *pi, char *dname, int queue)
|
|
|
|
{
|
|
|
|
char buffer[LINE_MAX];
|
|
|
|
|
|
|
|
if (pi->do_newfs) {
|
|
|
|
switch(pi->newfs_type) {
|
|
|
|
case NEWFS_UFS:
|
|
|
|
snprintf(buffer, LINE_MAX, "%s %s %s %s %s",
|
|
|
|
NEWFS_UFS_CMD,
|
|
|
|
pi->newfs_data.newfs_ufs.softupdates ? "-U" : "",
|
2003-04-20 14:08:05 +00:00
|
|
|
pi->newfs_data.newfs_ufs.ufs1 ? "-O1" : "-O2",
|
Reformulate how sysinstall handles file system options in the label
editor, in order to support specifying UFS2 as a newfs option.
(1) Support three different newfs types: NEWFS_UFS, NEWFS_MSDOS, and
NEWFS_CUSTOM. Don't mix up the arguments to them: you can't use
soft updates on an msdos file system.
(2) Distinguish adding new arguments to the newfs command line from
replacing it. Permit the addition of new arguments by the user for
NEWFS_UFS. If we entirely replace the command line provided by
sysinstall, call it NEWFS_CUSTOM. 'N' will now add additional
arguments; 'Z' will opt to replace the newfs command line entirely,
but will prompt the user with their current command line as a
starting point.
(3) Construct the newfs command line dynamically based on the options
provided by the user at label-time. Right now, this means selecting
UFS1 vs. UFS2, and the soft updates flag. Drop in some variables
to support ACLs and MAC Multilabel in the future also, but don't
expose them now.
This provides sysinstall with the ability to do more "in band" editing
of the newfs command line, so we can provide more support for the user,
but doesn't sacrifice the ability to entirely specify the newfs command
line of the user is willing to give up on the cushiness factor. It
also makes it easier for us to specify defaults in the future, and
define conditional behavior based on user configuration selections.
For now, we default to UFS1, and permit UFS2 to be used as the root
only on non-i386 systems.
While I was there, I dropped the default fragment and block sizes,
since newfs has much more sensible defaults now.
Reviewed by: jhb, marcel
Approved by: re
ia64 bits from: marcel
2002-12-03 22:25:47 +00:00
|
|
|
pi->newfs_data.newfs_ufs.user_options,
|
|
|
|
dname);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NEWFS_MSDOS:
|
|
|
|
snprintf(buffer, LINE_MAX, "%s %s", NEWFS_MSDOS_CMD,
|
|
|
|
dname);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NEWFS_CUSTOM:
|
|
|
|
snprintf(buffer, LINE_MAX, "%s %s",
|
|
|
|
pi->newfs_data.newfs_custom.command, dname);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (queue == QUEUE_YES) {
|
|
|
|
command_shell_add(pi->mountpoint, buffer);
|
|
|
|
return (0);
|
|
|
|
} else
|
|
|
|
return (vsystem(buffer));
|
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
1995-05-06 09:34:24 +00:00
|
|
|
/* Go newfs and/or mount all the filesystems we've been asked to */
|
1995-12-07 10:34:59 +00:00
|
|
|
int
|
1996-04-07 03:52:36 +00:00
|
|
|
installFilesystems(dialogMenuItem *self)
|
1995-05-06 09:34:24 +00:00
|
|
|
{
|
2002-10-22 15:07:17 +00:00
|
|
|
int i;
|
1995-05-16 02:53:31 +00:00
|
|
|
Disk *disk;
|
2004-08-07 01:19:54 +00:00
|
|
|
Chunk *c1, *c2;
|
1995-05-16 11:37:27 +00:00
|
|
|
Device **devs;
|
1995-12-07 10:34:59 +00:00
|
|
|
PartInfo *root;
|
1997-10-12 16:21:21 +00:00
|
|
|
char dname[80];
|
1995-12-07 10:34:59 +00:00
|
|
|
Boolean upgrade = FALSE;
|
|
|
|
|
1996-10-04 13:33:49 +00:00
|
|
|
/* If we've already done this, bail out */
|
1997-10-12 16:21:21 +00:00
|
|
|
if (!variable_cmp(DISK_LABELLED, "written"))
|
1996-10-04 13:33:49 +00:00
|
|
|
return DITEM_SUCCESS;
|
|
|
|
|
1997-10-12 16:21:21 +00:00
|
|
|
upgrade = !variable_cmp(SYSTEM_STATE, "upgrade");
|
2004-08-07 01:19:54 +00:00
|
|
|
if (!checkLabels(TRUE))
|
1996-04-13 13:32:15 +00:00
|
|
|
return DITEM_FAILURE;
|
1995-05-06 09:34:24 +00:00
|
|
|
|
2004-08-07 01:19:54 +00:00
|
|
|
root = (RootChunk != NULL) ? (PartInfo *)RootChunk->private_data : NULL;
|
1996-07-09 07:17:03 +00:00
|
|
|
|
1995-05-08 06:06:30 +00:00
|
|
|
command_clear();
|
1995-05-16 11:37:27 +00:00
|
|
|
|
1995-05-18 09:02:06 +00:00
|
|
|
/* Now buzz through the rest of the partitions and mount them too */
|
1995-12-07 10:34:59 +00:00
|
|
|
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
|
1995-05-16 11:37:27 +00:00
|
|
|
for (i = 0; devs[i]; i++) {
|
1995-05-28 20:28:15 +00:00
|
|
|
if (!devs[i]->enabled)
|
|
|
|
continue;
|
|
|
|
|
1995-05-16 11:37:27 +00:00
|
|
|
disk = (Disk *)devs[i]->private;
|
1995-06-11 19:33:05 +00:00
|
|
|
if (!disk->chunks) {
|
|
|
|
msgConfirm("No chunk list found for %s!", disk->name);
|
1999-12-19 06:50:44 +00:00
|
|
|
return DITEM_FAILURE | DITEM_RESTORE;
|
1995-06-11 19:33:05 +00:00
|
|
|
}
|
1995-05-16 11:37:27 +00:00
|
|
|
for (c1 = disk->chunks->part; c1; c1 = c1->next) {
|
2004-05-15 05:06:19 +00:00
|
|
|
#ifdef __ia64__
|
2004-05-07 19:15:56 +00:00
|
|
|
if (c1->type == part) {
|
|
|
|
c2 = c1;
|
|
|
|
{
|
2004-05-15 05:06:19 +00:00
|
|
|
#elif defined(__powerpc__)
|
|
|
|
if (c1->type == apple) {
|
|
|
|
for (c2 = c1->part; c2; c2 = c2->next) {
|
|
|
|
#else
|
|
|
|
if (c1->type == freebsd) {
|
|
|
|
for (c2 = c1->part; c2; c2 = c2->next) {
|
2004-05-07 19:15:56 +00:00
|
|
|
#endif
|
1996-03-24 18:57:37 +00:00
|
|
|
if (c2->type == part && c2->subtype != FS_SWAP && c2->private_data) {
|
|
|
|
PartInfo *tmp = (PartInfo *)c2->private_data;
|
1995-05-08 06:06:30 +00:00
|
|
|
|
1995-12-07 10:34:59 +00:00
|
|
|
/* Already did root */
|
2004-08-07 01:19:54 +00:00
|
|
|
if (c2 == RootChunk)
|
1995-05-16 11:37:27 +00:00
|
|
|
continue;
|
|
|
|
|
2006-08-08 13:45:46 +00:00
|
|
|
sprintf(dname, "/dev/%s", c2->name);
|
Reformulate how sysinstall handles file system options in the label
editor, in order to support specifying UFS2 as a newfs option.
(1) Support three different newfs types: NEWFS_UFS, NEWFS_MSDOS, and
NEWFS_CUSTOM. Don't mix up the arguments to them: you can't use
soft updates on an msdos file system.
(2) Distinguish adding new arguments to the newfs command line from
replacing it. Permit the addition of new arguments by the user for
NEWFS_UFS. If we entirely replace the command line provided by
sysinstall, call it NEWFS_CUSTOM. 'N' will now add additional
arguments; 'Z' will opt to replace the newfs command line entirely,
but will prompt the user with their current command line as a
starting point.
(3) Construct the newfs command line dynamically based on the options
provided by the user at label-time. Right now, this means selecting
UFS1 vs. UFS2, and the soft updates flag. Drop in some variables
to support ACLs and MAC Multilabel in the future also, but don't
expose them now.
This provides sysinstall with the ability to do more "in band" editing
of the newfs command line, so we can provide more support for the user,
but doesn't sacrifice the ability to entirely specify the newfs command
line of the user is willing to give up on the cushiness factor. It
also makes it easier for us to specify defaults in the future, and
define conditional behavior based on user configuration selections.
For now, we default to UFS1, and permit UFS2 to be used as the root
only on non-i386 systems.
While I was there, I dropped the default fragment and block sizes,
since newfs has much more sensible defaults now.
Reviewed by: jhb, marcel
Approved by: re
ia64 bits from: marcel
2002-12-03 22:25:47 +00:00
|
|
|
|
|
|
|
if (tmp->do_newfs && (!upgrade ||
|
|
|
|
!msgNoYes("You are upgrading - are you SURE you"
|
|
|
|
" want to newfs /dev/%s?", c2->name)))
|
|
|
|
performNewfs(tmp, dname, QUEUE_YES);
|
1995-05-24 17:49:20 +00:00
|
|
|
else
|
Reformulate how sysinstall handles file system options in the label
editor, in order to support specifying UFS2 as a newfs option.
(1) Support three different newfs types: NEWFS_UFS, NEWFS_MSDOS, and
NEWFS_CUSTOM. Don't mix up the arguments to them: you can't use
soft updates on an msdos file system.
(2) Distinguish adding new arguments to the newfs command line from
replacing it. Permit the addition of new arguments by the user for
NEWFS_UFS. If we entirely replace the command line provided by
sysinstall, call it NEWFS_CUSTOM. 'N' will now add additional
arguments; 'Z' will opt to replace the newfs command line entirely,
but will prompt the user with their current command line as a
starting point.
(3) Construct the newfs command line dynamically based on the options
provided by the user at label-time. Right now, this means selecting
UFS1 vs. UFS2, and the soft updates flag. Drop in some variables
to support ACLs and MAC Multilabel in the future also, but don't
expose them now.
This provides sysinstall with the ability to do more "in band" editing
of the newfs command line, so we can provide more support for the user,
but doesn't sacrifice the ability to entirely specify the newfs command
line of the user is willing to give up on the cushiness factor. It
also makes it easier for us to specify defaults in the future, and
define conditional behavior based on user configuration selections.
For now, we default to UFS1, and permit UFS2 to be used as the root
only on non-i386 systems.
While I was there, I dropped the default fragment and block sizes,
since newfs has much more sensible defaults now.
Reviewed by: jhb, marcel
Approved by: re
ia64 bits from: marcel
2002-12-03 22:25:47 +00:00
|
|
|
command_shell_add(tmp->mountpoint,
|
2006-08-08 13:45:46 +00:00
|
|
|
"fsck_ffs -y /dev/%s", c2->name);
|
1995-05-16 02:53:31 +00:00
|
|
|
command_func_add(tmp->mountpoint, Mount, c2->name);
|
1995-05-08 06:06:30 +00:00
|
|
|
}
|
1995-05-22 14:10:25 +00:00
|
|
|
else if (c2->type == part && c2->subtype == FS_SWAP) {
|
|
|
|
char fname[80];
|
|
|
|
int i;
|
|
|
|
|
2004-08-07 01:19:54 +00:00
|
|
|
if (c2 == SwapChunk)
|
1995-12-07 10:34:59 +00:00
|
|
|
continue;
|
2006-08-08 13:45:46 +00:00
|
|
|
sprintf(fname, "/dev/%s", c2->name);
|
1996-06-25 18:41:10 +00:00
|
|
|
i = (Fake || swapon(fname));
|
1999-12-19 06:50:44 +00:00
|
|
|
if (!i) {
|
|
|
|
dialog_clear_norefresh();
|
1995-12-07 10:34:59 +00:00
|
|
|
msgNotify("Added %s as an additional swap device", fname);
|
1999-12-19 06:50:44 +00:00
|
|
|
}
|
|
|
|
else {
|
1995-05-22 14:10:25 +00:00
|
|
|
msgConfirm("Unable to add %s as a swap device: %s", fname, strerror(errno));
|
1999-12-19 06:50:44 +00:00
|
|
|
}
|
1995-05-22 14:10:25 +00:00
|
|
|
}
|
1995-05-06 09:34:24 +00:00
|
|
|
}
|
|
|
|
}
|
Reformulate how sysinstall handles file system options in the label
editor, in order to support specifying UFS2 as a newfs option.
(1) Support three different newfs types: NEWFS_UFS, NEWFS_MSDOS, and
NEWFS_CUSTOM. Don't mix up the arguments to them: you can't use
soft updates on an msdos file system.
(2) Distinguish adding new arguments to the newfs command line from
replacing it. Permit the addition of new arguments by the user for
NEWFS_UFS. If we entirely replace the command line provided by
sysinstall, call it NEWFS_CUSTOM. 'N' will now add additional
arguments; 'Z' will opt to replace the newfs command line entirely,
but will prompt the user with their current command line as a
starting point.
(3) Construct the newfs command line dynamically based on the options
provided by the user at label-time. Right now, this means selecting
UFS1 vs. UFS2, and the soft updates flag. Drop in some variables
to support ACLs and MAC Multilabel in the future also, but don't
expose them now.
This provides sysinstall with the ability to do more "in band" editing
of the newfs command line, so we can provide more support for the user,
but doesn't sacrifice the ability to entirely specify the newfs command
line of the user is willing to give up on the cushiness factor. It
also makes it easier for us to specify defaults in the future, and
define conditional behavior based on user configuration selections.
For now, we default to UFS1, and permit UFS2 to be used as the root
only on non-i386 systems.
While I was there, I dropped the default fragment and block sizes,
since newfs has much more sensible defaults now.
Reviewed by: jhb, marcel
Approved by: re
ia64 bits from: marcel
2002-12-03 22:25:47 +00:00
|
|
|
else if (c1->type == fat && c1->private_data &&
|
|
|
|
(root->do_newfs || upgrade)) {
|
1995-06-11 19:33:05 +00:00
|
|
|
char name[FILENAME_MAX];
|
1995-05-24 17:49:20 +00:00
|
|
|
|
2006-08-08 13:45:46 +00:00
|
|
|
sprintf(name, "/%s", ((PartInfo *)c1->private_data)->mountpoint);
|
1996-07-08 08:54:36 +00:00
|
|
|
Mkdir(name);
|
1995-05-24 17:49:20 +00:00
|
|
|
}
|
2002-11-14 01:46:20 +00:00
|
|
|
#if defined(__ia64__)
|
|
|
|
else if (c1->type == efi && c1->private_data) {
|
|
|
|
PartInfo *pi = (PartInfo *)c1->private_data;
|
|
|
|
|
2006-08-07 23:35:49 +00:00
|
|
|
sprintf(dname, "/dev/%s", c1->name);
|
Reformulate how sysinstall handles file system options in the label
editor, in order to support specifying UFS2 as a newfs option.
(1) Support three different newfs types: NEWFS_UFS, NEWFS_MSDOS, and
NEWFS_CUSTOM. Don't mix up the arguments to them: you can't use
soft updates on an msdos file system.
(2) Distinguish adding new arguments to the newfs command line from
replacing it. Permit the addition of new arguments by the user for
NEWFS_UFS. If we entirely replace the command line provided by
sysinstall, call it NEWFS_CUSTOM. 'N' will now add additional
arguments; 'Z' will opt to replace the newfs command line entirely,
but will prompt the user with their current command line as a
starting point.
(3) Construct the newfs command line dynamically based on the options
provided by the user at label-time. Right now, this means selecting
UFS1 vs. UFS2, and the soft updates flag. Drop in some variables
to support ACLs and MAC Multilabel in the future also, but don't
expose them now.
This provides sysinstall with the ability to do more "in band" editing
of the newfs command line, so we can provide more support for the user,
but doesn't sacrifice the ability to entirely specify the newfs command
line of the user is willing to give up on the cushiness factor. It
also makes it easier for us to specify defaults in the future, and
define conditional behavior based on user configuration selections.
For now, we default to UFS1, and permit UFS2 to be used as the root
only on non-i386 systems.
While I was there, I dropped the default fragment and block sizes,
since newfs has much more sensible defaults now.
Reviewed by: jhb, marcel
Approved by: re
ia64 bits from: marcel
2002-12-03 22:25:47 +00:00
|
|
|
|
|
|
|
if (pi->do_newfs && (!upgrade ||
|
|
|
|
!msgNoYes("You are upgrading - are you SURE you want to "
|
|
|
|
"newfs /dev/%s?", c1->name)))
|
|
|
|
performNewfs(pi, dname, QUEUE_YES);
|
2002-11-14 01:46:20 +00:00
|
|
|
}
|
|
|
|
#endif
|
1995-05-06 09:34:24 +00:00
|
|
|
}
|
|
|
|
}
|
1995-06-11 19:33:05 +00:00
|
|
|
|
1995-05-08 06:06:30 +00:00
|
|
|
command_sort();
|
|
|
|
command_execute();
|
1999-12-17 02:46:04 +00:00
|
|
|
dialog_clear_norefresh();
|
1999-12-19 06:50:44 +00:00
|
|
|
return DITEM_SUCCESS | DITEM_RESTORE;
|
1995-12-07 10:34:59 +00:00
|
|
|
}
|
|
|
|
|
1998-11-24 00:18:57 +00:00
|
|
|
static char *
|
|
|
|
getRelname(void)
|
|
|
|
{
|
|
|
|
static char buf[64];
|
2001-09-22 23:17:37 +00:00
|
|
|
size_t sz = (sizeof buf) - 1;
|
1998-11-24 00:18:57 +00:00
|
|
|
|
|
|
|
if (sysctlbyname("kern.osrelease", buf, &sz, NULL, 0) != -1) {
|
|
|
|
buf[sz] = '\0';
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return "<unknown>";
|
|
|
|
}
|
|
|
|
|
1996-04-28 20:54:11 +00:00
|
|
|
/* Initialize various user-settable values to their defaults */
|
1995-12-07 10:34:59 +00:00
|
|
|
int
|
1996-04-07 03:52:36 +00:00
|
|
|
installVarDefaults(dialogMenuItem *self)
|
1995-12-07 10:34:59 +00:00
|
|
|
{
|
1996-07-09 14:28:22 +00:00
|
|
|
|
1995-12-07 10:34:59 +00:00
|
|
|
/* Set default startup options */
|
1999-02-05 22:15:52 +00:00
|
|
|
variable_set2(VAR_RELNAME, getRelname(), 0);
|
2006-08-07 23:35:49 +00:00
|
|
|
variable_set2(SYSTEM_STATE, "update", 0);
|
2001-12-11 16:21:40 +00:00
|
|
|
variable_set2(VAR_NEWFS_ARGS, "-b 16384 -f 2048", 0);
|
2001-07-17 04:09:50 +00:00
|
|
|
variable_set2(VAR_CONSTERM, "NO", 0);
|
1996-04-13 13:32:15 +00:00
|
|
|
return DITEM_SUCCESS;
|
1995-05-06 09:34:24 +00:00
|
|
|
}
|
|
|
|
|
1997-02-15 15:24:14 +00:00
|
|
|
/* Load the environment up from various system configuration files */
|
|
|
|
void
|
|
|
|
installEnvironment(void)
|
|
|
|
{
|
1995-05-19 15:56:02 +00:00
|
|
|
}
|
|
|
|
|