1995-04-27 12:50:35 +00:00
|
|
|
/*
|
|
|
|
* The new sysinstall program.
|
|
|
|
*
|
|
|
|
* This is probably the last program in the `sysinstall' line - the next
|
|
|
|
* generation being essentially a complete rewrite.
|
|
|
|
*
|
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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "sysinstall.h"
|
1995-12-07 10:34:59 +00:00
|
|
|
#include <ctype.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>
|
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
|
|
|
|
2000-03-18 08:46:23 +00:00
|
|
|
/* Hack for rsaref package add, which displays interactive license.
|
|
|
|
* Used by package.c
|
|
|
|
*/
|
|
|
|
int _interactiveHack;
|
2000-07-18 09:14:06 +00:00
|
|
|
int FixItMode = 0;
|
2000-03-18 08:46:23 +00:00
|
|
|
|
1995-12-07 10:34:59 +00:00
|
|
|
static void create_termcap(void);
|
1996-12-29 05:51:40 +00:00
|
|
|
static void fixit_common(void);
|
1995-05-04 23:36:23 +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-04-29 19:34:25 +00:00
|
|
|
static void installConfigure(void);
|
|
|
|
|
1996-07-31 06:20:59 +00:00
|
|
|
Boolean
|
2001-12-09 23:40:02 +00:00
|
|
|
checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vdev, Chunk **tdev, Chunk **hdev)
|
1995-05-22 14:10:25 +00:00
|
|
|
{
|
|
|
|
Device **devs;
|
1995-12-07 10:34:59 +00:00
|
|
|
Boolean status;
|
1995-05-22 14:10:25 +00:00
|
|
|
Disk *disk;
|
2001-12-09 23:40:02 +00:00
|
|
|
Chunk *c1, *c2, *rootdev, *swapdev, *usrdev, *vardev, *tmpdev, *homedev;
|
1995-05-22 14:10:25 +00:00
|
|
|
int i;
|
|
|
|
|
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;
|
2001-12-09 09:47:09 +00:00
|
|
|
if (rdev)
|
|
|
|
*rdev = NULL;
|
|
|
|
if (sdev)
|
|
|
|
*sdev = NULL;
|
|
|
|
if (udev)
|
|
|
|
*udev = NULL;
|
|
|
|
if (vdev)
|
|
|
|
*vdev = NULL;
|
2001-12-09 23:40:02 +00:00
|
|
|
if (tdev)
|
|
|
|
*tdev = NULL;
|
2001-12-09 09:47:09 +00:00
|
|
|
if (hdev)
|
|
|
|
*hdev = NULL;
|
2001-12-09 23:40:02 +00:00
|
|
|
rootdev = swapdev = usrdev = vardev = tmpdev = homedev = NULL;
|
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 */
|
1996-07-09 07:17:03 +00:00
|
|
|
if (!RunningAsInit)
|
|
|
|
return status;
|
|
|
|
|
1995-05-22 14:10:25 +00:00
|
|
|
devs = deviceFind(NULL, DEVICE_TYPE_DISK);
|
|
|
|
/* First verify that we have a root device */
|
|
|
|
for (i = 0; devs[i]; i++) {
|
|
|
|
if (!devs[i]->enabled)
|
|
|
|
continue;
|
|
|
|
disk = (Disk *)devs[i]->private;
|
|
|
|
msgDebug("Scanning disk %s for root filesystem\n", disk->name);
|
|
|
|
if (!disk->chunks)
|
|
|
|
msgFatal("No chunk list found for %s!", disk->name);
|
|
|
|
for (c1 = disk->chunks->part; c1; c1 = c1->next) {
|
|
|
|
if (c1->type == freebsd) {
|
|
|
|
for (c2 = c1->part; c2; c2 = c2->next) {
|
1996-03-24 18:57:37 +00:00
|
|
|
if (c2->type == part && c2->subtype != FS_SWAP && c2->private_data) {
|
1998-07-18 09:42:02 +00:00
|
|
|
if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/")) {
|
1995-06-11 19:33:05 +00:00
|
|
|
if (rootdev) {
|
1996-07-31 09:29:35 +00:00
|
|
|
if (whinge)
|
|
|
|
msgConfirm("WARNING: You have more than one root device set?!\n"
|
|
|
|
"Using the first one found.");
|
1995-06-11 19:33:05 +00:00
|
|
|
continue;
|
|
|
|
}
|
1996-07-09 07:17:03 +00:00
|
|
|
else {
|
|
|
|
rootdev = c2;
|
|
|
|
if (isDebug())
|
|
|
|
msgDebug("Found rootdev at %s!\n", rootdev->name);
|
|
|
|
}
|
1995-06-11 19:33:05 +00:00
|
|
|
}
|
1996-03-24 18:57:37 +00:00
|
|
|
else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/usr")) {
|
1995-06-11 19:33:05 +00:00
|
|
|
if (usrdev) {
|
1996-07-31 09:29:35 +00:00
|
|
|
if (whinge)
|
|
|
|
msgConfirm("WARNING: You have more than one /usr filesystem.\n"
|
|
|
|
"Using the first one found.");
|
1995-06-11 19:33:05 +00:00
|
|
|
continue;
|
|
|
|
}
|
1996-07-09 07:17:03 +00:00
|
|
|
else {
|
|
|
|
usrdev = c2;
|
|
|
|
if (isDebug())
|
|
|
|
msgDebug("Found usrdev at %s!\n", usrdev->name);
|
|
|
|
}
|
1995-06-11 19:33:05 +00:00
|
|
|
}
|
1996-07-31 06:20:59 +00:00
|
|
|
else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/var")) {
|
|
|
|
if (vardev) {
|
1996-07-31 09:29:35 +00:00
|
|
|
if (whinge)
|
|
|
|
msgConfirm("WARNING: You have more than one /var filesystem.\n"
|
|
|
|
"Using the first one found.");
|
1996-07-31 06:20:59 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
vardev = c2;
|
|
|
|
if (isDebug())
|
|
|
|
msgDebug("Found vardev at %s!\n", vardev->name);
|
|
|
|
}
|
2001-12-09 23:40:02 +00:00
|
|
|
} else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/tmp")) {
|
|
|
|
if (tmpdev) {
|
2001-12-09 09:47:09 +00:00
|
|
|
if (whinge)
|
2001-12-09 23:40:02 +00:00
|
|
|
msgConfirm("WARNING: You have more than one /tmp filesystem.\n"
|
2001-12-09 09:47:09 +00:00
|
|
|
"Using the first one found.");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else {
|
2001-12-09 23:40:02 +00:00
|
|
|
tmpdev = c2;
|
2001-12-09 09:47:09 +00:00
|
|
|
if (isDebug())
|
2001-12-09 23:40:02 +00:00
|
|
|
msgDebug("Found tmpdev at %s!\n", tmpdev->name);
|
2001-12-09 09:47:09 +00:00
|
|
|
}
|
|
|
|
} else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/home")) {
|
|
|
|
if (homedev) {
|
|
|
|
if (whinge)
|
|
|
|
msgConfirm("WARNING: You have more than one /home filesystem.\n"
|
|
|
|
"Using the first one found.");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
homedev = c2;
|
|
|
|
if (isDebug())
|
|
|
|
msgDebug("Found homedev at %s!\n", homedev->name);
|
|
|
|
}
|
1996-07-31 06:20:59 +00:00
|
|
|
}
|
1995-05-22 14:10:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1995-05-23 02:41:18 +00:00
|
|
|
/* Now check for swap devices */
|
1995-05-22 14:10:25 +00:00
|
|
|
for (i = 0; devs[i]; i++) {
|
1996-01-14 11:45:05 +00:00
|
|
|
if (!devs[i]->enabled)
|
|
|
|
continue;
|
1995-05-22 14:10:25 +00:00
|
|
|
disk = (Disk *)devs[i]->private;
|
|
|
|
msgDebug("Scanning disk %s for swap partitions\n", disk->name);
|
|
|
|
if (!disk->chunks)
|
|
|
|
msgFatal("No chunk list found for %s!", disk->name);
|
|
|
|
for (c1 = disk->chunks->part; c1; c1 = c1->next) {
|
|
|
|
if (c1->type == freebsd) {
|
|
|
|
for (c2 = c1->part; c2; c2 = c2->next) {
|
1995-12-07 10:34:59 +00:00
|
|
|
if (c2->type == part && c2->subtype == FS_SWAP && !swapdev) {
|
1995-05-22 14:10:25 +00:00
|
|
|
swapdev = c2;
|
1995-12-07 10:34:59 +00:00
|
|
|
if (isDebug())
|
|
|
|
msgDebug("Found swapdev at %s!\n", swapdev->name);
|
1995-05-22 14:10:25 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1996-07-09 07:17:03 +00:00
|
|
|
/* Copy our values over */
|
2001-12-09 09:47:09 +00:00
|
|
|
if (rdev)
|
|
|
|
*rdev = rootdev;
|
|
|
|
if (sdev)
|
|
|
|
*sdev = swapdev;
|
|
|
|
if (udev)
|
|
|
|
*udev = usrdev;
|
|
|
|
if (vdev)
|
|
|
|
*vdev = vardev;
|
2001-12-09 23:40:02 +00:00
|
|
|
if (tdev)
|
|
|
|
*tdev = tmpdev;
|
2001-12-09 09:47:09 +00:00
|
|
|
if (hdev)
|
|
|
|
*hdev = homedev;
|
1996-07-09 07:17:03 +00:00
|
|
|
|
1996-07-31 09:29:35 +00:00
|
|
|
if (!rootdev && whinge) {
|
1995-12-07 10:34:59 +00:00
|
|
|
msgConfirm("No root device found - you must label a partition as /\n"
|
|
|
|
"in the label editor.");
|
|
|
|
status = FALSE;
|
1995-05-28 23:12:09 +00:00
|
|
|
}
|
1996-07-31 09:29:35 +00:00
|
|
|
if (!swapdev && whinge) {
|
2003-08-10 01:04:05 +00:00
|
|
|
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;
|
1995-05-22 14:10:25 +00:00
|
|
|
}
|
1995-12-07 10:34:59 +00:00
|
|
|
return status;
|
1995-05-22 14:10:25 +00:00
|
|
|
}
|
|
|
|
|
1995-12-07 10:34:59 +00:00
|
|
|
static int
|
1995-05-20 00:13:14 +00:00
|
|
|
installInitial(void)
|
1995-05-18 09:02:06 +00:00
|
|
|
{
|
1995-05-20 00:13:14 +00:00
|
|
|
static Boolean alreadyDone = FALSE;
|
1998-11-15 09:06:20 +00:00
|
|
|
int status = DITEM_SUCCESS;
|
1995-05-20 00:13:14 +00:00
|
|
|
|
|
|
|
if (alreadyDone)
|
1996-04-13 13:32:15 +00:00
|
|
|
return DITEM_SUCCESS;
|
1995-05-18 09:02:06 +00:00
|
|
|
|
1995-12-07 10:34:59 +00:00
|
|
|
if (!variable_get(DISK_LABELLED)) {
|
1996-04-28 20:54:11 +00:00
|
|
|
msgConfirm("You need to assign disk labels before you can proceed with\n"
|
|
|
|
"the installation.");
|
1996-04-13 13:32:15 +00:00
|
|
|
return DITEM_FAILURE;
|
1995-05-21 15:40:54 +00:00
|
|
|
}
|
1995-12-07 10:34:59 +00:00
|
|
|
/* If it's labelled, assume it's also partitioned */
|
|
|
|
if (!variable_get(DISK_PARTITIONED))
|
1999-02-05 22:15:52 +00:00
|
|
|
variable_set2(DISK_PARTITIONED, "yes", 0);
|
1995-05-21 15:40:54 +00:00
|
|
|
|
|
|
|
/* If we refuse to proceed, bail. */
|
1996-08-03 10:11:56 +00:00
|
|
|
dialog_clear_norefresh();
|
2001-09-14 18:29:08 +00:00
|
|
|
if (!variable_get(VAR_NO_WARN)) {
|
1998-07-18 09:42:02 +00:00
|
|
|
if (msgYesNo(
|
|
|
|
"Last Chance! Are you SURE you want continue the installation?\n\n"
|
2000-02-29 09:09:36 +00:00
|
|
|
"If you're running this on a disk with data you wish to save\n"
|
|
|
|
"then WE STRONGLY ENCOURAGE YOU TO MAKE PROPER BACKUPS before\n"
|
|
|
|
"proceeding!\n\n"
|
|
|
|
"We can take no responsibility for lost disk contents!") != 0)
|
1999-12-14 04:25:29 +00:00
|
|
|
return DITEM_FAILURE;
|
2001-09-14 18:29:08 +00:00
|
|
|
}
|
1995-12-07 10:34:59 +00:00
|
|
|
|
1996-04-28 03:27:26 +00:00
|
|
|
if (DITEM_STATUS(diskLabelCommit(NULL)) != DITEM_SUCCESS) {
|
1995-06-11 19:33:05 +00:00
|
|
|
msgConfirm("Couldn't make filesystems properly. Aborting.");
|
1996-04-13 13:32:15 +00:00
|
|
|
return DITEM_FAILURE;
|
1995-06-11 19:33:05 +00:00
|
|
|
}
|
1995-09-18 16:53:06 +00:00
|
|
|
|
1995-12-07 10:34:59 +00:00
|
|
|
if (!copySelf()) {
|
1998-03-10 13:42:05 +00:00
|
|
|
msgConfirm("installInitial: Couldn't clone the boot floppy onto the\n"
|
|
|
|
"root file system. Aborting!");
|
1996-04-13 13:32:15 +00:00
|
|
|
return DITEM_FAILURE;
|
1995-06-11 19:33:05 +00:00
|
|
|
}
|
1995-09-18 16:53:06 +00:00
|
|
|
|
2001-10-12 07:36:34 +00:00
|
|
|
if (!Restarting && chroot("/mnt") == -1) {
|
1998-03-10 13:42:05 +00:00
|
|
|
msgConfirm("installInitial: Unable to chroot to %s - this is bad!",
|
|
|
|
"/mnt");
|
1996-04-13 13:32:15 +00:00
|
|
|
return DITEM_FAILURE;
|
1995-12-07 10:34:59 +00:00
|
|
|
}
|
|
|
|
|
1995-05-20 23:33:14 +00:00
|
|
|
chdir("/");
|
1999-02-05 22:15:52 +00:00
|
|
|
variable_set2(RUNNING_ON_ROOT, "yes", 0);
|
1998-11-15 09:06:20 +00:00
|
|
|
|
|
|
|
/* Configure various files in /etc */
|
|
|
|
if (DITEM_STATUS(configResolv(NULL)) == DITEM_FAILURE)
|
|
|
|
status = DITEM_FAILURE;
|
|
|
|
if (DITEM_STATUS(configFstab(NULL)) == DITEM_FAILURE)
|
|
|
|
status = DITEM_FAILURE;
|
1995-12-07 10:34:59 +00:00
|
|
|
|
1996-03-23 07:28:22 +00:00
|
|
|
/* stick a helpful shell over on the 4th VTY */
|
2001-03-12 21:26:06 +00:00
|
|
|
if (!variable_get(VAR_NO_HOLOSHELL))
|
|
|
|
systemCreateHoloshell();
|
1996-03-23 07:28:22 +00:00
|
|
|
|
1995-12-07 10:34:59 +00:00
|
|
|
alreadyDone = TRUE;
|
1998-11-15 09:06:20 +00:00
|
|
|
return status;
|
1995-12-07 10:34:59 +00:00
|
|
|
}
|
|
|
|
|
1996-12-29 05:51:40 +00:00
|
|
|
int
|
|
|
|
installFixitHoloShell(dialogMenuItem *self)
|
|
|
|
{
|
2000-07-18 09:14:06 +00:00
|
|
|
FixItMode = 1;
|
1996-12-29 05:51:40 +00:00
|
|
|
systemCreateHoloshell();
|
|
|
|
return DITEM_SUCCESS;
|
2000-07-18 09:14:06 +00:00
|
|
|
FixItMode = 0;
|
1996-12-29 05:51:40 +00:00
|
|
|
}
|
|
|
|
|
1995-12-07 10:34:59 +00:00
|
|
|
int
|
1996-04-13 13:32:15 +00:00
|
|
|
installFixitCDROM(dialogMenuItem *self)
|
|
|
|
{
|
1996-12-29 05:51:40 +00:00
|
|
|
struct stat sb;
|
|
|
|
|
1997-01-12 11:13:43 +00:00
|
|
|
if (!RunningAsInit)
|
|
|
|
return DITEM_SUCCESS;
|
|
|
|
|
1999-02-05 22:15:52 +00:00
|
|
|
variable_set2(SYSTEM_STATE, "fixit", 0);
|
1996-12-29 05:51:40 +00:00
|
|
|
(void)unlink("/mnt2");
|
|
|
|
(void)rmdir("/mnt2");
|
|
|
|
|
|
|
|
while (1) {
|
2001-07-02 00:24:23 +00:00
|
|
|
msgConfirm("Please insert a FreeBSD live filesystem CD/DVD and press return");
|
2001-07-02 00:18:04 +00:00
|
|
|
if (DITEM_STATUS(mediaSetCDROM(NULL)) != DITEM_SUCCESS
|
|
|
|
|| !DEVICE_INIT(mediaDevice)) {
|
1996-12-29 05:51:40 +00:00
|
|
|
/* If we can't initialize it, it's probably not a FreeBSD CDROM so punt on it */
|
1999-02-15 00:49:33 +00:00
|
|
|
mediaClose();
|
2001-06-27 17:48:43 +00:00
|
|
|
if (msgYesNo("Unable to mount the disc - do you want to try again?") != 0)
|
1996-12-29 05:51:40 +00:00
|
|
|
return DITEM_FAILURE;
|
|
|
|
}
|
1997-01-12 11:13:43 +00:00
|
|
|
else
|
|
|
|
break;
|
1996-12-29 05:51:40 +00:00
|
|
|
}
|
|
|
|
|
1997-01-27 09:51:56 +00:00
|
|
|
/* Since the fixit code expects everything to be in /mnt2, and the CDROM mounting stuff /dist, do
|
1996-12-29 05:51:40 +00:00
|
|
|
* a little kludge dance here..
|
|
|
|
*/
|
1997-01-27 09:51:56 +00:00
|
|
|
if (symlink("/dist", "/mnt2")) {
|
2001-06-27 17:48:43 +00:00
|
|
|
msgConfirm("Unable to symlink /mnt2 to the disc mount point. Please report this\n"
|
1997-03-18 07:02:32 +00:00
|
|
|
"unexpected failure to freebsd-bugs@FreeBSD.org.");
|
1996-12-29 05:51:40 +00:00
|
|
|
return DITEM_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If /tmp points to /mnt2/tmp from a previous fixit floppy session, it's
|
1997-01-06 11:10:25 +00:00
|
|
|
* not very good for us if we point it to the CDROM now. Rather make it
|
1996-12-29 05:51:40 +00:00
|
|
|
* a directory in the root MFS then. Experienced admins will still be
|
|
|
|
* able to mount their disk's /tmp over this if they need.
|
|
|
|
*/
|
|
|
|
if (lstat("/tmp", &sb) == 0 && (sb.st_mode & S_IFMT) == S_IFLNK)
|
|
|
|
(void)unlink("/tmp");
|
|
|
|
Mkdir("/tmp");
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Since setuid binaries ignore LD_LIBRARY_PATH, we indeed need the
|
|
|
|
* ld.so.hints file. Fortunately, it's fairly small (~ 3 KB).
|
|
|
|
*/
|
|
|
|
if (!file_readable("/var/run/ld.so.hints")) {
|
|
|
|
Mkdir("/var/run");
|
|
|
|
if (vsystem("/mnt2/sbin/ldconfig -s /mnt2/usr/lib")) {
|
|
|
|
msgConfirm("Warning: ldconfig could not create the ld.so hints file.\n"
|
2001-06-27 17:48:43 +00:00
|
|
|
"Dynamic executables from the disc likely won't work.");
|
1996-12-29 05:51:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-03-11 09:38:06 +00:00
|
|
|
/* Yet more iggly hardcoded pathnames. */
|
|
|
|
Mkdir("/usr/libexec");
|
2000-02-18 18:33:15 +00:00
|
|
|
if (!file_readable("/usr/libexec/ld.so") && file_readable("/mnt2/usr/libexec/ld.so")) {
|
1999-03-11 09:38:06 +00:00
|
|
|
if (symlink("/mnt2/usr/libexec/ld.so", "/usr/libexec/ld.so"))
|
|
|
|
msgDebug("Couldn't link to ld.so - not necessarily a problem for ELF\n");
|
|
|
|
}
|
|
|
|
if (!file_readable("/usr/libexec/ld-elf.so.1")) {
|
|
|
|
if (symlink("/mnt2/usr/libexec/ld-elf.so.1", "/usr/libexec/ld-elf.so.1")) {
|
|
|
|
msgConfirm("Warning: could not create the symlink for ld-elf.so.1\n"
|
2001-06-27 17:48:43 +00:00
|
|
|
"Dynamic executables from the disc likely won't work.");
|
1996-12-29 05:51:40 +00:00
|
|
|
}
|
|
|
|
}
|
1999-03-11 09:38:06 +00:00
|
|
|
/* optional nicety */
|
|
|
|
if (!file_readable("/usr/bin/vi"))
|
|
|
|
symlink("/mnt2/usr/bin/vi", "/usr/bin/vi");
|
1996-12-29 05:51:40 +00:00
|
|
|
fixit_common();
|
1999-02-15 00:49:33 +00:00
|
|
|
mediaClose();
|
2002-02-08 13:42:35 +00:00
|
|
|
msgConfirm("Please remove the FreeBSD fixit CDROM/DVD now.");
|
1996-04-13 13:32:15 +00:00
|
|
|
return DITEM_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
installFixitFloppy(dialogMenuItem *self)
|
1995-12-07 10:34:59 +00:00
|
|
|
{
|
|
|
|
struct ufs_args args;
|
1999-02-15 00:49:33 +00:00
|
|
|
extern char *distWanted;
|
1995-12-07 10:34:59 +00:00
|
|
|
|
1997-01-12 11:13:43 +00:00
|
|
|
if (!RunningAsInit)
|
|
|
|
return DITEM_SUCCESS;
|
|
|
|
|
1998-07-18 09:42:02 +00:00
|
|
|
/* Try to open the floppy drive */
|
1999-02-15 00:49:33 +00:00
|
|
|
if (DITEM_STATUS(mediaSetFloppy(NULL)) == DITEM_FAILURE || !mediaDevice) {
|
1998-07-18 09:42:02 +00:00
|
|
|
msgConfirm("Unable to set media device to floppy.");
|
|
|
|
mediaClose();
|
|
|
|
return DITEM_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(&args, 0, sizeof(args));
|
|
|
|
args.fspec = mediaDevice->devname;
|
1999-02-15 00:49:33 +00:00
|
|
|
mediaDevice->private = "/mnt2";
|
|
|
|
distWanted = NULL;
|
|
|
|
Mkdir("/mnt2");
|
|
|
|
|
|
|
|
variable_set2(SYSTEM_STATE, "fixit", 0);
|
1998-07-18 09:42:02 +00:00
|
|
|
|
1995-12-07 10:34:59 +00:00
|
|
|
while (1) {
|
2001-07-02 00:18:04 +00:00
|
|
|
if (!DEVICE_INIT(mediaDevice)) {
|
1998-10-12 23:45:07 +00:00
|
|
|
if (msgYesNo("The attempt to mount the fixit floppy failed, bad floppy\n"
|
1998-10-13 10:07:43 +00:00
|
|
|
"or unclean filesystem. Do you want to try again?"))
|
1998-10-12 23:45:07 +00:00
|
|
|
return DITEM_FAILURE;
|
|
|
|
}
|
1998-12-06 10:13:57 +00:00
|
|
|
else
|
|
|
|
break;
|
1995-12-07 10:34:59 +00:00
|
|
|
}
|
1996-03-18 15:28:10 +00:00
|
|
|
if (!directory_exists("/tmp"))
|
1995-12-07 10:34:59 +00:00
|
|
|
(void)symlink("/mnt2/tmp", "/tmp");
|
1996-12-29 05:51:40 +00:00
|
|
|
fixit_common();
|
1999-02-15 00:49:33 +00:00
|
|
|
mediaClose();
|
1997-03-08 12:58:29 +00:00
|
|
|
msgConfirm("Please remove the fixit floppy now.");
|
1996-12-29 05:51:40 +00:00
|
|
|
return DITEM_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The common code for both fixit variants.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
fixit_common(void)
|
|
|
|
{
|
|
|
|
pid_t child;
|
|
|
|
int waitstatus;
|
|
|
|
|
1996-03-18 15:28:10 +00:00
|
|
|
if (!directory_exists("/var/tmp/vi.recover")) {
|
1996-07-08 08:54:36 +00:00
|
|
|
if (DITEM_STATUS(Mkdir("/var/tmp/vi.recover")) != DITEM_SUCCESS) {
|
1995-12-07 10:34:59 +00:00
|
|
|
msgConfirm("Warning: Was unable to create a /var/tmp/vi.recover directory.\n"
|
|
|
|
"vi will kvetch and moan about it as a result but should still\n"
|
|
|
|
"be essentially usable.");
|
|
|
|
}
|
|
|
|
}
|
1996-11-16 22:42:13 +00:00
|
|
|
if (!directory_exists("/bin"))
|
|
|
|
(void)Mkdir("/bin");
|
|
|
|
(void)symlink("/stand/sh", "/bin/sh");
|
1996-11-09 16:25:47 +00:00
|
|
|
/* Link the /etc/ files */
|
1996-07-08 08:54:36 +00:00
|
|
|
if (DITEM_STATUS(Mkdir("/etc")) != DITEM_SUCCESS)
|
1995-12-07 10:34:59 +00:00
|
|
|
msgConfirm("Unable to create an /etc directory! Things are weird on this floppy..");
|
1996-11-09 16:25:47 +00:00
|
|
|
else if ((symlink("/mnt2/etc/spwd.db", "/etc/spwd.db") == -1 && errno != EEXIST) ||
|
|
|
|
(symlink("/mnt2/etc/protocols", "/etc/protocols") == -1 && errno != EEXIST) ||
|
2002-09-28 17:06:07 +00:00
|
|
|
(symlink("/mnt2/etc/group", "/etc/group") == -1 && errno != EEXIST) ||
|
1996-11-09 16:25:47 +00:00
|
|
|
(symlink("/mnt2/etc/services", "/etc/services") == -1 && errno != EEXIST))
|
|
|
|
msgConfirm("Couldn't symlink the /etc/ files! I'm not sure I like this..");
|
1995-12-07 10:34:59 +00:00
|
|
|
if (!file_readable(TERMCAP_FILE))
|
|
|
|
create_termcap();
|
2000-10-30 23:46:12 +00:00
|
|
|
if (strcmp(variable_get(VAR_FIXIT_TTY), "serial") == 0)
|
2000-07-18 09:14:06 +00:00
|
|
|
systemSuspendDialog(); /* must be before the fork() */
|
1995-12-07 10:34:59 +00:00
|
|
|
if (!(child = fork())) {
|
2000-10-30 23:46:12 +00:00
|
|
|
int i, fd;
|
1995-12-07 10:34:59 +00:00
|
|
|
struct termios foo;
|
1996-12-26 03:32:50 +00:00
|
|
|
extern int login_tty(int);
|
|
|
|
|
|
|
|
ioctl(0, TIOCNOTTY, NULL);
|
2000-10-30 23:46:12 +00:00
|
|
|
for (i = getdtablesize(); i >= 0; --i)
|
1996-12-26 03:32:50 +00:00
|
|
|
close(i);
|
2000-10-30 23:46:12 +00:00
|
|
|
|
|
|
|
if (strcmp(variable_get(VAR_FIXIT_TTY), "serial") == 0)
|
|
|
|
fd = open("/dev/console", O_RDWR);
|
|
|
|
else
|
2000-05-16 22:05:32 +00:00
|
|
|
fd = open("/dev/ttyv3", O_RDWR);
|
2000-10-30 23:46:12 +00:00
|
|
|
ioctl(0, TIOCSCTTY, &fd);
|
|
|
|
dup2(0, 1);
|
|
|
|
dup2(0, 2);
|
1996-12-26 03:32:50 +00:00
|
|
|
DebugFD = 2;
|
|
|
|
if (login_tty(fd) == -1)
|
|
|
|
msgDebug("fixit: I can't set the controlling terminal.\n");
|
1995-12-07 10:34:59 +00:00
|
|
|
|
|
|
|
signal(SIGTTOU, SIG_IGN);
|
|
|
|
if (tcgetattr(0, &foo) != -1) {
|
|
|
|
foo.c_cc[VERASE] = '\010';
|
|
|
|
if (tcsetattr(0, TCSANOW, &foo) == -1)
|
|
|
|
msgDebug("fixit shell: Unable to set erase character.\n");
|
1995-05-29 00:50:05 +00:00
|
|
|
}
|
1995-12-07 10:34:59 +00:00
|
|
|
else
|
|
|
|
msgDebug("fixit shell: Unable to get terminal attributes!\n");
|
1996-12-29 05:51:40 +00:00
|
|
|
setenv("PATH", "/bin:/sbin:/usr/bin:/usr/sbin:/stand:"
|
|
|
|
"/mnt2/stand:/mnt2/bin:/mnt2/sbin:/mnt2/usr/bin:/mnt2/usr/sbin", 1);
|
2000-10-30 23:46:12 +00:00
|
|
|
if (strcmp(variable_get(VAR_FIXIT_TTY), "serial") == 0) {
|
|
|
|
printf("Waiting for fixit shell to exit.\n"
|
|
|
|
"When you are done, type ``exit'' to exit\n"
|
|
|
|
"the fixit shell and be returned here.\n\n");
|
|
|
|
fflush(stdout);
|
|
|
|
}
|
|
|
|
|
1996-12-29 05:51:40 +00:00
|
|
|
/* use the .profile from the fixit medium */
|
1996-11-09 16:25:47 +00:00
|
|
|
setenv("HOME", "/mnt2", 1);
|
|
|
|
chdir("/mnt2");
|
2001-07-09 09:24:06 +00:00
|
|
|
execlp("sh", "-sh", (char *)0);
|
1995-12-07 10:34:59 +00:00
|
|
|
msgDebug("fixit shell: Failed to execute shell!\n");
|
1996-12-29 05:51:40 +00:00
|
|
|
_exit(1);;
|
1995-05-25 18:48:33 +00:00
|
|
|
}
|
1996-12-26 03:32:50 +00:00
|
|
|
else {
|
2000-05-16 22:05:32 +00:00
|
|
|
if (strcmp(variable_get(VAR_FIXIT_TTY), "standard") == 0) {
|
2000-10-30 23:46:12 +00:00
|
|
|
dialog_clear_norefresh();
|
2000-05-16 22:05:32 +00:00
|
|
|
msgNotify("Waiting for fixit shell to exit. Go to VTY4 now by\n"
|
|
|
|
"typing ALT-F4. When you are done, type ``exit'' to exit\n"
|
2000-10-30 23:46:12 +00:00
|
|
|
"the fixit shell and be returned here\n.");
|
2000-05-16 22:05:32 +00:00
|
|
|
}
|
1995-12-07 10:34:59 +00:00
|
|
|
(void)waitpid(child, &waitstatus, 0);
|
2000-10-30 23:46:12 +00:00
|
|
|
if (strcmp(variable_get(VAR_FIXIT_TTY), "serial") == 0)
|
|
|
|
systemResumeDialog();
|
1996-12-26 03:32:50 +00:00
|
|
|
}
|
|
|
|
dialog_clear();
|
1995-12-07 10:34:59 +00:00
|
|
|
}
|
1996-12-29 05:51:40 +00:00
|
|
|
|
|
|
|
|
1995-09-18 16:53:06 +00:00
|
|
|
int
|
1996-04-07 03:52:36 +00:00
|
|
|
installExpress(dialogMenuItem *self)
|
1995-09-18 16:53:06 +00:00
|
|
|
{
|
1996-04-29 19:34:25 +00:00
|
|
|
int i;
|
|
|
|
|
1999-12-14 04:25:29 +00:00
|
|
|
dialog_clear_norefresh();
|
1999-02-05 22:15:52 +00:00
|
|
|
variable_set2(SYSTEM_STATE, "express", 0);
|
2002-11-27 19:45:10 +00:00
|
|
|
#ifdef WITH_SLICES
|
1996-04-29 19:34:25 +00:00
|
|
|
if (DITEM_STATUS((i = diskPartitionEditor(self))) == DITEM_FAILURE)
|
|
|
|
return i;
|
1999-01-08 00:14:22 +00:00
|
|
|
#endif
|
1995-09-18 16:53:06 +00:00
|
|
|
|
1996-04-29 19:34:25 +00:00
|
|
|
if (DITEM_STATUS((i = diskLabelEditor(self))) == DITEM_FAILURE)
|
|
|
|
return i;
|
1995-12-07 10:34:59 +00:00
|
|
|
|
1996-04-29 19:34:25 +00:00
|
|
|
if (DITEM_STATUS((i = installCommit(self))) == DITEM_SUCCESS) {
|
|
|
|
i |= DITEM_LEAVE_MENU;
|
2000-09-22 19:12:41 +00:00
|
|
|
/* Set default security level */
|
2000-09-24 06:44:00 +00:00
|
|
|
configSecurityModerate(NULL);
|
2000-09-22 19:12:41 +00:00
|
|
|
|
1996-05-16 11:47:46 +00:00
|
|
|
/* Give user the option of one last configuration spree */
|
1996-04-29 19:34:25 +00:00
|
|
|
installConfigure();
|
|
|
|
}
|
1999-12-14 04:25:29 +00:00
|
|
|
return i;
|
1995-12-07 10:34:59 +00:00
|
|
|
}
|
|
|
|
|
2000-02-18 07:09:45 +00:00
|
|
|
/* Standard mode installation */
|
1995-12-07 10:34:59 +00:00
|
|
|
int
|
2000-02-18 07:09:45 +00:00
|
|
|
installStandard(dialogMenuItem *self)
|
1995-12-07 10:34:59 +00:00
|
|
|
{
|
1997-10-12 16:21:21 +00:00
|
|
|
int i, tries = 0;
|
|
|
|
Device **devs;
|
1996-04-29 19:34:25 +00:00
|
|
|
|
2000-02-18 07:09:45 +00:00
|
|
|
variable_set2(SYSTEM_STATE, "standard", 0);
|
1996-08-03 10:11:56 +00:00
|
|
|
dialog_clear_norefresh();
|
2002-11-27 19:45:10 +00:00
|
|
|
#ifdef WITH_SLICES
|
1995-12-07 10:34:59 +00:00
|
|
|
msgConfirm("In the next menu, you will need to set up a DOS-style (\"fdisk\") partitioning\n"
|
|
|
|
"scheme for your hard disk. If you simply wish to devote all disk space\n"
|
1997-05-30 01:03:09 +00:00
|
|
|
"to FreeBSD (overwriting anything else that might be on the disk(s) selected)\n"
|
1995-12-07 10:34:59 +00:00
|
|
|
"then use the (A)ll command to select the default partitioning scheme followed\n"
|
|
|
|
"by a (Q)uit. If you wish to allocate only free space to FreeBSD, move to a\n"
|
|
|
|
"partition marked \"unused\" and use the (C)reate command.");
|
|
|
|
|
1997-10-12 16:21:21 +00:00
|
|
|
nodisks:
|
1996-04-28 03:27:26 +00:00
|
|
|
if (DITEM_STATUS(diskPartitionEditor(self)) == DITEM_FAILURE)
|
1996-04-13 13:32:15 +00:00
|
|
|
return DITEM_FAILURE;
|
1997-10-12 16:21:21 +00:00
|
|
|
|
|
|
|
if (diskGetSelectCount(&devs) <= 0 && tries < 3) {
|
|
|
|
msgConfirm("You need to select some disks to operate on! Be sure to use SPACE\n"
|
|
|
|
"instead of RETURN in the disk selection menu when selecting a disk.");
|
|
|
|
++tries;
|
|
|
|
goto nodisks;
|
|
|
|
}
|
|
|
|
|
2002-10-11 22:30:09 +00:00
|
|
|
msgConfirm("Now you need to create BSD partitions inside of the fdisk partition(s)\n"
|
|
|
|
"just created. If you have a reasonable amount of disk space (200MB or more)\n"
|
1999-01-08 00:14:22 +00:00
|
|
|
"and don't have any special requirements, simply use the (A)uto command to\n"
|
|
|
|
"allocate space automatically. If you have more specific needs or just don't\n"
|
|
|
|
"care for the layout chosen by (A)uto, press F1 for more information on\n"
|
|
|
|
"manual layout.");
|
|
|
|
#else
|
2002-11-27 19:45:10 +00:00
|
|
|
msgConfirm("First you need to create BSD partitions on the disk which you are\n"
|
2002-10-11 22:30:09 +00:00
|
|
|
"installing to. If you have a reasonable amount of disk space (200MB or more)\n"
|
1995-12-07 10:34:59 +00:00
|
|
|
"and don't have any special requirements, simply use the (A)uto command to\n"
|
|
|
|
"allocate space automatically. If you have more specific needs or just don't\n"
|
|
|
|
"care for the layout chosen by (A)uto, press F1 for more information on\n"
|
|
|
|
"manual layout.");
|
1999-01-08 00:14:22 +00:00
|
|
|
#endif
|
1995-12-07 10:34:59 +00:00
|
|
|
|
1996-04-28 03:27:26 +00:00
|
|
|
if (DITEM_STATUS(diskLabelEditor(self)) == DITEM_FAILURE)
|
1996-04-13 13:32:15 +00:00
|
|
|
return DITEM_FAILURE;
|
1995-12-07 10:34:59 +00:00
|
|
|
|
1996-04-29 19:34:25 +00:00
|
|
|
if (DITEM_STATUS((i = installCommit(self))) == DITEM_FAILURE) {
|
1999-12-19 07:02:46 +00:00
|
|
|
dialog_clear();
|
1996-04-29 19:34:25 +00:00
|
|
|
msgConfirm("Installation completed with some errors. You may wish to\n"
|
|
|
|
"scroll through the debugging messages on VTY1 with the\n"
|
2000-03-10 19:53:53 +00:00
|
|
|
"scroll-lock feature. You can also choose \"No\" at the next\n"
|
2003-02-19 21:48:28 +00:00
|
|
|
"prompt and go back into the installation menus to retry\n"
|
1996-04-29 19:34:25 +00:00
|
|
|
"whichever operations have failed.");
|
1999-12-14 04:25:29 +00:00
|
|
|
return i;
|
1996-04-29 19:34:25 +00:00
|
|
|
|
|
|
|
}
|
1996-10-03 06:01:44 +00:00
|
|
|
else {
|
1999-12-19 07:02:46 +00:00
|
|
|
dialog_clear();
|
1996-09-29 10:03:30 +00:00
|
|
|
msgConfirm("Congratulations! You now have FreeBSD installed on your system.\n\n"
|
1996-04-29 19:34:25 +00:00
|
|
|
"We will now move on to the final configuration questions.\n"
|
|
|
|
"For any option you do not wish to configure, simply select\n"
|
1996-04-30 05:23:49 +00:00
|
|
|
"No.\n\n"
|
1996-04-29 19:34:25 +00:00
|
|
|
"If you wish to re-enter this utility after the system is up, you\n"
|
2001-09-04 20:22:41 +00:00
|
|
|
"may do so by typing: /usr/sbin/sysinstall.");
|
1996-10-03 06:01:44 +00:00
|
|
|
}
|
1996-04-29 19:34:25 +00:00
|
|
|
if (mediaDevice->type != DEVICE_TYPE_FTP && mediaDevice->type != DEVICE_TYPE_NFS) {
|
1997-04-02 12:07:39 +00:00
|
|
|
if (!msgYesNo("Would you like to configure any Ethernet or SLIP/PPP network devices?")) {
|
1999-12-14 04:25:29 +00:00
|
|
|
Device *tmp = tcpDeviceSelect();
|
1996-04-29 19:34:25 +00:00
|
|
|
|
1999-09-02 00:51:16 +00:00
|
|
|
if (tmp && !((DevInfo *)tmp->private)->use_dhcp && !msgYesNo("Would you like to bring the %s interface up right now?", tmp->name))
|
2001-07-02 00:18:04 +00:00
|
|
|
if (!DEVICE_INIT(tmp))
|
1997-02-17 13:29:47 +00:00
|
|
|
msgConfirm("Initialization of %s device failed.", tmp->name);
|
1996-04-29 19:34:25 +00:00
|
|
|
}
|
1999-12-19 07:02:46 +00:00
|
|
|
dialog_clear_norefresh();
|
1996-04-29 19:34:25 +00:00
|
|
|
}
|
|
|
|
|
2000-12-14 02:49:02 +00:00
|
|
|
if (!msgNoYes("Do you want this machine to function as a network gateway?"))
|
1999-02-05 22:15:52 +00:00
|
|
|
variable_set2("gateway_enable", "YES", 1);
|
1996-04-29 19:34:25 +00:00
|
|
|
|
Compensate for default disabling of network services in inetd.conf(5)
by providing the opportunity to edit inetd.conf during the system
installation process. The following modifications were made:
(1) Expand the Anonymous FTP description dialog to indicate that inetd
and ftpd must be enabled before it can be used.
(2) Introduce a new configInetd() pair of dialogs, the first describing
inetd, giving a couple of examples of services that require it, and
hinting at potential risk, then asking the user if they wish to
enable it. The second indicates that inetd.conf must be configured
to enabled specific services, and asks if the user would like to
load inetd.conf into the editor to modify it. Add this
configuration action to the index.
There are some further improvements that might be considered:
(1) Provide a more inetd.conf-specific configuration tool that speaks
inetd.conf(5). However, this is made difficult by the "yet another
configuration format" nature of inetd.conf, as well as its use of
commenting to disable services, rather than an in-syntax way to
disable a service without commenting it out. Submissions here
would probably be welcome.
(2) There's some overlap between settings in the somewhat obtuse
Security Profile mechanism and other settings, including the inetd
setting, and NFS server configuration. As features become
individually tunable, they should probably be removed from the
security profile mechanism. Otherwise, somewhat counter-intuitively,
sysinstall (in practice) queries multiple times whether inetd, nfsd,
etc, should be enabled/disabled. A possible future direction might
be to drive profiles not by degree of paranoia, rather, the set
of services desired. Or simply to remove the Security Profile
mechanism and resort to feature-driven configuration.
Reviewed by: imp, chris, jake, nate, -arch, -stable
2001-08-02 03:25:16 +00:00
|
|
|
dialog_clear_norefresh();
|
2001-09-05 00:45:13 +00:00
|
|
|
if (!msgNoYes("Do you want to configure inetd and the network services that it provides?"))
|
Compensate for default disabling of network services in inetd.conf(5)
by providing the opportunity to edit inetd.conf during the system
installation process. The following modifications were made:
(1) Expand the Anonymous FTP description dialog to indicate that inetd
and ftpd must be enabled before it can be used.
(2) Introduce a new configInetd() pair of dialogs, the first describing
inetd, giving a couple of examples of services that require it, and
hinting at potential risk, then asking the user if they wish to
enable it. The second indicates that inetd.conf must be configured
to enabled specific services, and asks if the user would like to
load inetd.conf into the editor to modify it. Add this
configuration action to the index.
There are some further improvements that might be considered:
(1) Provide a more inetd.conf-specific configuration tool that speaks
inetd.conf(5). However, this is made difficult by the "yet another
configuration format" nature of inetd.conf, as well as its use of
commenting to disable services, rather than an in-syntax way to
disable a service without commenting it out. Submissions here
would probably be welcome.
(2) There's some overlap between settings in the somewhat obtuse
Security Profile mechanism and other settings, including the inetd
setting, and NFS server configuration. As features become
individually tunable, they should probably be removed from the
security profile mechanism. Otherwise, somewhat counter-intuitively,
sysinstall (in practice) queries multiple times whether inetd, nfsd,
etc, should be enabled/disabled. A possible future direction might
be to drive profiles not by degree of paranoia, rather, the set
of services desired. Or simply to remove the Security Profile
mechanism and resort to feature-driven configuration.
Reviewed by: imp, chris, jake, nate, -arch, -stable
2001-08-02 03:25:16 +00:00
|
|
|
configInetd(self);
|
|
|
|
|
2000-09-22 19:12:41 +00:00
|
|
|
dialog_clear_norefresh();
|
2000-12-14 02:49:02 +00:00
|
|
|
if (!msgNoYes("Do you want to have anonymous FTP access to this machine?"))
|
1996-04-29 19:34:25 +00:00
|
|
|
configAnonFTP(self);
|
|
|
|
|
2000-09-22 19:12:41 +00:00
|
|
|
dialog_clear_norefresh();
|
2000-12-14 02:49:02 +00:00
|
|
|
if (!msgNoYes("Do you want to configure this machine as an NFS server?"))
|
1996-04-29 19:34:25 +00:00
|
|
|
configNFSServer(self);
|
|
|
|
|
1999-12-19 07:02:46 +00:00
|
|
|
dialog_clear_norefresh();
|
2000-12-14 02:49:02 +00:00
|
|
|
if (!msgNoYes("Do you want to configure this machine as an NFS client?"))
|
1999-02-05 22:15:52 +00:00
|
|
|
variable_set2("nfs_client_enable", "YES", 1);
|
1996-04-29 19:34:25 +00:00
|
|
|
|
2000-12-14 02:49:02 +00:00
|
|
|
if (!msgNoYes("Do you want to select a default security profile for\n"
|
2001-08-15 19:39:11 +00:00
|
|
|
"this host (select No for \"moderate\" security)?"))
|
2000-09-22 19:12:41 +00:00
|
|
|
configSecurityProfile(self);
|
|
|
|
else
|
|
|
|
configSecurityModerate(self);
|
|
|
|
|
2002-11-27 19:45:10 +00:00
|
|
|
#ifdef WITH_SYSCONS
|
2000-09-22 19:12:41 +00:00
|
|
|
dialog_clear_norefresh();
|
2000-12-14 02:49:02 +00:00
|
|
|
if (!msgNoYes("Would you like to customize your system console settings?"))
|
1996-07-02 01:03:55 +00:00
|
|
|
dmenuOpenSimple(&MenuSyscons, FALSE);
|
2002-11-27 19:45:10 +00:00
|
|
|
#endif
|
1996-04-29 19:34:25 +00:00
|
|
|
|
1999-12-19 07:02:46 +00:00
|
|
|
dialog_clear_norefresh();
|
1999-12-14 04:25:29 +00:00
|
|
|
if (!msgYesNo("Would you like to set this machine's time zone now?"))
|
1997-02-16 23:54:58 +00:00
|
|
|
systemExecute("tzsetup");
|
1996-04-29 19:34:25 +00:00
|
|
|
|
2002-11-27 19:45:10 +00:00
|
|
|
#ifdef WITH_LINUX
|
1999-12-19 07:02:46 +00:00
|
|
|
dialog_clear_norefresh();
|
1999-07-06 08:45:40 +00:00
|
|
|
if (!msgYesNo("Would you like to enable Linux binary compatibility?"))
|
|
|
|
(void)configLinux(self);
|
1999-07-06 09:19:36 +00:00
|
|
|
#endif
|
1999-07-06 08:45:40 +00:00
|
|
|
|
2002-11-27 19:45:10 +00:00
|
|
|
#ifdef __alpha__
|
|
|
|
dialog_clear_norefresh();
|
|
|
|
if (!msgYesNo("Would you like to enable OSF/1 binary compatibility?"))
|
|
|
|
(void)configOSF1(self);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef WITH_MICE
|
1999-12-19 07:02:46 +00:00
|
|
|
dialog_clear_norefresh();
|
2003-05-13 19:16:00 +00:00
|
|
|
if (!msgNoYes("Does this system have a PS/2, serial, or bus mouse?"))
|
1996-07-02 01:03:55 +00:00
|
|
|
dmenuOpenSimple(&MenuMouse, FALSE);
|
2002-11-27 19:45:10 +00:00
|
|
|
#endif
|
1996-04-29 19:34:25 +00:00
|
|
|
|
2003-05-31 11:28:28 +00:00
|
|
|
#ifdef __i386__
|
|
|
|
if (checkLoaderACPI() != 0) {
|
|
|
|
dialog_clear_norefresh();
|
|
|
|
if (!msgNoYes("ACPI was disabled during boot.\n"
|
|
|
|
"Would you like to disable it permanently?"))
|
|
|
|
(void)configLoaderACPI(1 /*disable*/);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1997-03-08 16:17:49 +00:00
|
|
|
/* Now would be a good time to checkpoint the configuration data */
|
1999-02-09 22:18:10 +00:00
|
|
|
configRC_conf();
|
1997-03-08 16:17:49 +00:00
|
|
|
sync();
|
|
|
|
|
1996-04-29 19:34:25 +00:00
|
|
|
if (directory_exists("/usr/X11R6")) {
|
1999-12-19 07:02:46 +00:00
|
|
|
dialog_clear_norefresh();
|
1996-04-29 19:34:25 +00:00
|
|
|
if (!msgYesNo("Would you like to configure your X server at this time?"))
|
1999-07-06 08:45:40 +00:00
|
|
|
(void)configXSetup(self);
|
1996-04-29 19:34:25 +00:00
|
|
|
}
|
|
|
|
|
1999-12-19 07:02:46 +00:00
|
|
|
dialog_clear_norefresh();
|
2000-02-18 07:09:45 +00:00
|
|
|
if (!msgYesNo("The FreeBSD package collection is a collection of thousands of ready-to-run\n"
|
1997-02-10 10:21:07 +00:00
|
|
|
"applications, from text editors to games to WEB servers and more. Would you\n"
|
1999-09-19 08:24:32 +00:00
|
|
|
"like to browse the collection now?")) {
|
1999-07-06 08:45:40 +00:00
|
|
|
(void)configPackages(self);
|
1999-09-19 08:24:32 +00:00
|
|
|
}
|
1996-04-29 19:34:25 +00:00
|
|
|
|
1997-01-15 03:57:50 +00:00
|
|
|
if (!msgYesNo("Would you like to add any initial user accounts to the system?\n"
|
|
|
|
"Adding at least one account for yourself at this stage is suggested\n"
|
|
|
|
"since working as the \"root\" user is dangerous (it is easy to do\n"
|
|
|
|
"things which adversely affect the entire system)."))
|
1999-07-06 08:45:40 +00:00
|
|
|
(void)configUsers(self);
|
1997-01-15 03:57:50 +00:00
|
|
|
|
1997-04-02 12:07:39 +00:00
|
|
|
msgConfirm("Now you must set the system manager's password.\n"
|
|
|
|
"This is the password you'll use to log in as \"root\".");
|
1999-12-14 04:25:29 +00:00
|
|
|
if (!systemExecute("passwd root"))
|
|
|
|
variable_set2("root_password", "YES", 0);
|
1997-01-15 03:57:50 +00:00
|
|
|
|
1996-04-29 19:34:25 +00:00
|
|
|
/* XXX Put whatever other nice configuration questions you'd like to ask the user here XXX */
|
|
|
|
|
1996-05-16 11:47:46 +00:00
|
|
|
/* Give user the option of one last configuration spree */
|
1999-12-19 07:02:46 +00:00
|
|
|
dialog_clear_norefresh();
|
1996-04-29 19:34:25 +00:00
|
|
|
installConfigure();
|
1999-12-14 04:25:29 +00:00
|
|
|
return DITEM_LEAVE_MENU;
|
1995-09-18 16:53:06 +00:00
|
|
|
}
|
|
|
|
|
1996-05-16 11:47:46 +00:00
|
|
|
/* The version of commit we call from the Install Custom menu */
|
|
|
|
int
|
|
|
|
installCustomCommit(dialogMenuItem *self)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = installCommit(self);
|
|
|
|
if (DITEM_STATUS(i) == DITEM_SUCCESS) {
|
2000-09-22 19:12:41 +00:00
|
|
|
/* Set default security level */
|
2000-09-24 06:44:00 +00:00
|
|
|
configSecurityModerate(NULL);
|
2000-09-22 19:12:41 +00:00
|
|
|
|
1996-05-16 11:47:46 +00:00
|
|
|
/* Give user the option of one last configuration spree */
|
|
|
|
installConfigure();
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
msgConfirm("The commit operation completed with errors. Not\n"
|
|
|
|
"updating /etc files.");
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
1995-05-21 15:40:54 +00:00
|
|
|
/*
|
1996-05-16 11:47:46 +00:00
|
|
|
* What happens when we finally decide to going ahead with the installation.
|
1995-09-18 16:53:06 +00:00
|
|
|
*
|
1996-05-16 11:47:46 +00:00
|
|
|
* This is broken into multiple stages so that the user can do a full
|
|
|
|
* installation but come back here again to load more distributions,
|
|
|
|
* perhaps from a different media type. This would allow, for
|
|
|
|
* example, the user to load the majority of the system from CDROM and
|
2000-02-29 09:09:36 +00:00
|
|
|
* then use ftp to load just the CRYPTO dist.
|
1995-05-21 15:40:54 +00:00
|
|
|
*/
|
1995-05-20 00:13:14 +00:00
|
|
|
int
|
1996-04-07 03:52:36 +00:00
|
|
|
installCommit(dialogMenuItem *self)
|
1995-05-20 00:13:14 +00:00
|
|
|
{
|
1995-06-11 19:33:05 +00:00
|
|
|
int i;
|
1997-01-24 07:47:17 +00:00
|
|
|
char *str;
|
1995-05-28 09:31:44 +00:00
|
|
|
|
1999-12-14 04:25:29 +00:00
|
|
|
dialog_clear_norefresh();
|
1997-05-05 05:16:03 +00:00
|
|
|
if (!Dists)
|
|
|
|
distConfig(NULL);
|
|
|
|
|
2000-10-05 18:02:09 +00:00
|
|
|
if (!Dists) {
|
|
|
|
(void)dmenuOpenSimple(&MenuDistributions, FALSE);
|
|
|
|
/* select reasonable defaults if necessary */
|
|
|
|
if (!Dists)
|
|
|
|
Dists = _DIST_USER;
|
|
|
|
}
|
1997-01-15 06:30:50 +00:00
|
|
|
|
1997-03-07 16:39:32 +00:00
|
|
|
if (!mediaVerify())
|
1999-12-14 04:25:29 +00:00
|
|
|
return DITEM_FAILURE;
|
1995-12-07 10:34:59 +00:00
|
|
|
|
1997-01-24 07:47:17 +00:00
|
|
|
str = variable_get(SYSTEM_STATE);
|
|
|
|
if (isDebug())
|
|
|
|
msgDebug("installCommit: System state is `%s'\n", str);
|
|
|
|
|
1998-11-15 09:06:20 +00:00
|
|
|
/* Installation stuff we wouldn't do to a running system */
|
|
|
|
if (RunningAsInit && DITEM_STATUS((i = installInitial())) == DITEM_FAILURE)
|
|
|
|
return i;
|
1995-09-18 16:53:06 +00:00
|
|
|
|
OK, I've got two ideas to file in the "really seemed like a good idea
at the time, but on further reflection..." bucket with these changes.
1. Checking the media before frobbing the disks was a fine idea, and
I wish it could have worked, but that leads to a rather difficult
situation when you need to mount the media someplace and you're about
to:
a) Chroot away from your present root.
b) Newfs the root to be.
You're basically screwed since there's no place to stick the mount
point where it will be found following the newfs/chroot (and eliminating
the chroot in favor of just using the "root bias" feature would work
great for the distributions but not the pkg_add calls done by the
package installer).
2. Automatic timeout handling. I don't know why, but alarm() frequently
returns no residual even when the alarm didn't go off, which defies
the man page but hey, since when was that so unusual? Take out timeouts
but retain the code which temporarily replaces the SIGINT handler in
favor of a more media-specific handler. This way, at least, if it's hanging
you can at least whap it. I think the timeout code would have been losing
over *really slow* links anyway, so it's probably best that it go.
This should fix NFS, tape & CDROM installs again (serves me right for getting
complacent and using just the FTP installs in my testing).
1997-01-24 19:24:51 +00:00
|
|
|
try_media:
|
2001-07-02 00:18:04 +00:00
|
|
|
if (!DEVICE_INIT(mediaDevice)) {
|
OK, I've got two ideas to file in the "really seemed like a good idea
at the time, but on further reflection..." bucket with these changes.
1. Checking the media before frobbing the disks was a fine idea, and
I wish it could have worked, but that leads to a rather difficult
situation when you need to mount the media someplace and you're about
to:
a) Chroot away from your present root.
b) Newfs the root to be.
You're basically screwed since there's no place to stick the mount
point where it will be found following the newfs/chroot (and eliminating
the chroot in favor of just using the "root bias" feature would work
great for the distributions but not the pkg_add calls done by the
package installer).
2. Automatic timeout handling. I don't know why, but alarm() frequently
returns no residual even when the alarm didn't go off, which defies
the man page but hey, since when was that so unusual? Take out timeouts
but retain the code which temporarily replaces the SIGINT handler in
favor of a more media-specific handler. This way, at least, if it's hanging
you can at least whap it. I think the timeout code would have been losing
over *really slow* links anyway, so it's probably best that it go.
This should fix NFS, tape & CDROM installs again (serves me right for getting
complacent and using just the FTP installs in my testing).
1997-01-24 19:24:51 +00:00
|
|
|
if (!msgYesNo("Unable to initialize selected media. Would you like to\n"
|
|
|
|
"adjust your media configuration and try again?")) {
|
1997-03-07 16:39:32 +00:00
|
|
|
mediaDevice = NULL;
|
|
|
|
if (!mediaVerify())
|
1999-12-14 04:25:29 +00:00
|
|
|
return DITEM_FAILURE;
|
OK, I've got two ideas to file in the "really seemed like a good idea
at the time, but on further reflection..." bucket with these changes.
1. Checking the media before frobbing the disks was a fine idea, and
I wish it could have worked, but that leads to a rather difficult
situation when you need to mount the media someplace and you're about
to:
a) Chroot away from your present root.
b) Newfs the root to be.
You're basically screwed since there's no place to stick the mount
point where it will be found following the newfs/chroot (and eliminating
the chroot in favor of just using the "root bias" feature would work
great for the distributions but not the pkg_add calls done by the
package installer).
2. Automatic timeout handling. I don't know why, but alarm() frequently
returns no residual even when the alarm didn't go off, which defies
the man page but hey, since when was that so unusual? Take out timeouts
but retain the code which temporarily replaces the SIGINT handler in
favor of a more media-specific handler. This way, at least, if it's hanging
you can at least whap it. I think the timeout code would have been losing
over *really slow* links anyway, so it's probably best that it go.
This should fix NFS, tape & CDROM installs again (serves me right for getting
complacent and using just the FTP installs in my testing).
1997-01-24 19:24:51 +00:00
|
|
|
else
|
|
|
|
goto try_media;
|
|
|
|
}
|
|
|
|
else
|
1999-12-14 04:25:29 +00:00
|
|
|
return DITEM_FAILURE;
|
OK, I've got two ideas to file in the "really seemed like a good idea
at the time, but on further reflection..." bucket with these changes.
1. Checking the media before frobbing the disks was a fine idea, and
I wish it could have worked, but that leads to a rather difficult
situation when you need to mount the media someplace and you're about
to:
a) Chroot away from your present root.
b) Newfs the root to be.
You're basically screwed since there's no place to stick the mount
point where it will be found following the newfs/chroot (and eliminating
the chroot in favor of just using the "root bias" feature would work
great for the distributions but not the pkg_add calls done by the
package installer).
2. Automatic timeout handling. I don't know why, but alarm() frequently
returns no residual even when the alarm didn't go off, which defies
the man page but hey, since when was that so unusual? Take out timeouts
but retain the code which temporarily replaces the SIGINT handler in
favor of a more media-specific handler. This way, at least, if it's hanging
you can at least whap it. I think the timeout code would have been losing
over *really slow* links anyway, so it's probably best that it go.
This should fix NFS, tape & CDROM installs again (serves me right for getting
complacent and using just the FTP installs in my testing).
1997-01-24 19:24:51 +00:00
|
|
|
}
|
|
|
|
|
1998-11-15 09:06:20 +00:00
|
|
|
/* Now go get it all */
|
1996-04-29 19:34:25 +00:00
|
|
|
i = distExtractAll(self);
|
1998-11-15 09:06:20 +00:00
|
|
|
|
1998-03-10 13:42:05 +00:00
|
|
|
/* When running as init, *now* it's safe to grab the rc.foo vars */
|
|
|
|
installEnvironment();
|
|
|
|
|
1999-02-05 22:15:52 +00:00
|
|
|
variable_set2(SYSTEM_STATE, DITEM_STATUS(i) == DITEM_FAILURE ? "error-install" : "full-install", 0);
|
1997-06-21 15:45:15 +00:00
|
|
|
|
1999-12-14 04:25:29 +00:00
|
|
|
return i;
|
1995-12-07 10:34:59 +00:00
|
|
|
}
|
|
|
|
|
1996-04-29 19:34:25 +00:00
|
|
|
static void
|
|
|
|
installConfigure(void)
|
|
|
|
{
|
|
|
|
/* Final menu of last resort */
|
2000-12-14 02:49:02 +00:00
|
|
|
if (!msgNoYes("Visit the general configuration menu for a chance to set\n"
|
1999-12-14 04:25:29 +00:00
|
|
|
"any last options?"))
|
1996-07-02 01:03:55 +00:00
|
|
|
dmenuOpenSimple(&MenuConfigure, FALSE);
|
1999-02-09 22:18:10 +00:00
|
|
|
configRC_conf();
|
1997-05-22 04:04:30 +00:00
|
|
|
sync();
|
1996-04-29 19:34:25 +00:00
|
|
|
}
|
|
|
|
|
1995-12-07 10:34:59 +00:00
|
|
|
int
|
- Rename installFixupBin to installFixupBase to finish up the 'bin' to
'base' dist rename.
- Rework struct dist to allow for different types of dists. There are
currently three types of dists: DT_TARBALL, the traditonal gzipped and
split tar file; DT_PACKAGE, a package; and DT_SUBDIST, a meta-dist in
the tree that has its own array of dists as its contents. For example,
the 'base' dist is a DT_TARBALL dist, the 'perl' dist is a DT_PACKAGE
dist, and the 'src' dist is a DT_SUBDIST dist with its own dist table
that contains 'sbase', 'ssys', etc.
- Add helper macros for defining array entries for the different types of
dists to try and make the statically defined dist table in dist.c more
readable.
- Split the logic to deal with a DT_TARBALL dist out of distExtract()
and into its own distExtractTarball() function. distExtract() now
calls other functions to extract each dist.
- Tweak the percentage complete calculation in distExtractTarball() to
do the multiply prior to the divide so it doesn't have to use floating
point.
- Axe the installPackage() function along with the special handling for
the perl and XFree86 dists in distExtractAll() since distExtract()
handles package dists directly now.
- Add back in subdists for the X packages based on the split up packages
that XFree86-4 uses that as closely map to the X dists we used with
X 3.3.x.
- Lots of things like distSetX() and the X dist masks are no longer
#ifndef X_AS_PKG since we use them in both cases now.
- Make the entire installFixupXFree() function #ifndef X_AS_PKG, we only
call it in that case anyways, and it's not suitable for the X_AS_PKG
case.
- Add in X dist menus for the X_AS_PKG case.
Approved by: re
2003-01-17 19:05:32 +00:00
|
|
|
installFixupBase(dialogMenuItem *self)
|
1995-12-07 10:34:59 +00:00
|
|
|
{
|
|
|
|
Device **devs;
|
1999-05-07 11:02:58 +00:00
|
|
|
char *cp;
|
1995-12-07 10:34:59 +00:00
|
|
|
int i;
|
1999-11-24 09:45:36 +00:00
|
|
|
FILE *fp;
|
1999-11-25 17:56:00 +00:00
|
|
|
int kstat = 1;
|
1995-12-07 10:34:59 +00:00
|
|
|
|
1998-11-15 09:06:20 +00:00
|
|
|
/* All of this is done only as init, just to be safe */
|
|
|
|
if (RunningAsInit) {
|
2003-05-24 21:12:14 +00:00
|
|
|
#if defined(__i386__) || defined(__amd64__)
|
2000-09-29 07:47:19 +00:00
|
|
|
if ((fp = fopen("/boot/loader.conf", "a")) != NULL) {
|
|
|
|
if (!kstat || !OnVTY)
|
|
|
|
fprintf(fp, "# -- sysinstall generated deltas -- #\n");
|
|
|
|
if (!kstat)
|
|
|
|
fprintf(fp, "userconfig_script_load=\"YES\"\n");
|
|
|
|
if (!OnVTY)
|
|
|
|
fprintf(fp, "console=\"comconsole\"\n");
|
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
#endif
|
1998-11-15 09:06:20 +00:00
|
|
|
|
1995-12-07 10:34:59 +00:00
|
|
|
/* BOGON #2: We leave /etc in a bad state */
|
|
|
|
chmod("/etc", 0755);
|
1998-11-15 09:06:20 +00:00
|
|
|
|
1995-12-07 10:34:59 +00:00
|
|
|
/* BOGON #3: No /var/db/mountdtab complains */
|
1996-07-08 08:54:36 +00:00
|
|
|
Mkdir("/var/db");
|
1995-12-07 10:34:59 +00:00
|
|
|
creat("/var/db/mountdtab", 0644);
|
1998-11-15 09:06:20 +00:00
|
|
|
|
1997-07-16 11:45:48 +00:00
|
|
|
/* BOGON #4: /compat created by default in root fs */
|
1997-07-16 15:22:18 +00:00
|
|
|
Mkdir("/usr/compat");
|
2001-05-19 19:08:56 +00:00
|
|
|
vsystem("ln -s usr/compat /compat");
|
|
|
|
|
1997-07-23 15:13:18 +00:00
|
|
|
/* BOGON #5: aliases database not build for bin */
|
|
|
|
vsystem("newaliases");
|
|
|
|
|
1995-12-07 10:34:59 +00:00
|
|
|
/* Now run all the mtree stuff to fix things up */
|
|
|
|
vsystem("mtree -deU -f /etc/mtree/BSD.root.dist -p /");
|
|
|
|
vsystem("mtree -deU -f /etc/mtree/BSD.var.dist -p /var");
|
|
|
|
vsystem("mtree -deU -f /etc/mtree/BSD.usr.dist -p /usr");
|
1998-11-15 09:06:20 +00:00
|
|
|
|
|
|
|
/* Do all the last ugly work-arounds here */
|
|
|
|
}
|
1999-12-19 06:50:44 +00:00
|
|
|
return DITEM_SUCCESS | DITEM_RESTORE;
|
1998-11-15 09:06:20 +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;
|
2001-12-09 09:47:09 +00:00
|
|
|
Chunk *c1, *c2, *rootdev, *swapdev;
|
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;
|
2002-12-02 20:15:16 +00:00
|
|
|
#if defined(__ia64__)
|
|
|
|
char efi_bootdir[FILENAME_MAX];
|
|
|
|
#endif
|
1995-12-07 10:34:59 +00:00
|
|
|
|
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");
|
2001-12-09 09:47:09 +00:00
|
|
|
if (!checkLabels(TRUE, &rootdev, &swapdev, NULL, NULL, NULL, NULL))
|
1996-04-13 13:32:15 +00:00
|
|
|
return DITEM_FAILURE;
|
1995-05-06 09:34:24 +00:00
|
|
|
|
1996-07-09 07:17:03 +00:00
|
|
|
if (rootdev)
|
|
|
|
root = (PartInfo *)rootdev->private_data;
|
|
|
|
else
|
|
|
|
root = NULL;
|
|
|
|
|
1995-05-08 06:06:30 +00:00
|
|
|
command_clear();
|
1997-01-15 07:06:39 +00:00
|
|
|
if (swapdev && RunningAsInit) {
|
1996-07-09 07:17:03 +00:00
|
|
|
/* As the very first thing, try to get ourselves some swap space */
|
|
|
|
sprintf(dname, "/dev/%s", swapdev->name);
|
2002-10-22 15:25:19 +00:00
|
|
|
if (!Fake && !file_readable(dname)) {
|
|
|
|
msgConfirm("Unable to find device node for %s in /dev!\n"
|
1996-07-09 07:17:03 +00:00
|
|
|
"The creation of filesystems will be aborted.", dname);
|
|
|
|
return DITEM_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!Fake) {
|
1999-12-19 06:50:44 +00:00
|
|
|
if (!swapon(dname)) {
|
|
|
|
dialog_clear_norefresh();
|
1996-07-09 07:17:03 +00:00
|
|
|
msgNotify("Added %s as initial swap device", dname);
|
1999-12-19 06:50:44 +00:00
|
|
|
}
|
|
|
|
else {
|
1996-07-09 07:17:03 +00:00
|
|
|
msgConfirm("WARNING! Unable to swap to %s: %s\n"
|
|
|
|
"This may cause the installation to fail at some point\n"
|
|
|
|
"if you don't have a lot of memory.", dname, strerror(errno));
|
1999-12-19 06:50:44 +00:00
|
|
|
}
|
1996-07-09 07:17:03 +00:00
|
|
|
}
|
1995-12-07 10:34:59 +00:00
|
|
|
}
|
1995-05-16 02:53:31 +00:00
|
|
|
|
1997-01-15 07:06:39 +00:00
|
|
|
if (rootdev && RunningAsInit) {
|
1996-07-09 07:17:03 +00:00
|
|
|
/* Next, create and/or mount the root device */
|
2000-05-31 00:57:48 +00:00
|
|
|
sprintf(dname, "/dev/%s", rootdev->name);
|
2002-10-22 15:25:19 +00:00
|
|
|
if (!Fake && !file_readable(dname)) {
|
1996-07-09 07:17:03 +00:00
|
|
|
msgConfirm("Unable to make device node for %s in /dev!\n"
|
|
|
|
"The creation of filesystems will be aborted.", dname);
|
1999-12-19 06:50:44 +00:00
|
|
|
return DITEM_FAILURE | DITEM_RESTORE;
|
1996-07-09 07:17:03 +00:00
|
|
|
}
|
|
|
|
if (strcmp(root->mountpoint, "/"))
|
|
|
|
msgConfirm("Warning: %s is marked as a root partition but is mounted on %s", rootdev->name, root->mountpoint);
|
1995-05-16 11:37:27 +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
|
|
|
if (root->do_newfs && (!upgrade ||
|
|
|
|
!msgNoYes("You are upgrading - are you SURE you want to newfs "
|
|
|
|
"the root partition?"))) {
|
1996-07-09 07:17:03 +00:00
|
|
|
int i;
|
1995-05-22 14:10:25 +00:00
|
|
|
|
1999-12-19 06:50:44 +00:00
|
|
|
dialog_clear_norefresh();
|
1996-07-09 07:17:03 +00:00
|
|
|
msgNotify("Making a new root filesystem on %s", dname);
|
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
|
|
|
i = performNewfs(root, dname, QUEUE_NO);
|
1996-07-09 07:17:03 +00:00
|
|
|
if (i) {
|
|
|
|
msgConfirm("Unable to make new root filesystem on %s!\n"
|
|
|
|
"Command returned status %d", dname, i);
|
1999-12-19 06:50:44 +00:00
|
|
|
return DITEM_FAILURE | DITEM_RESTORE;
|
1996-07-09 07:17:03 +00:00
|
|
|
}
|
1995-05-16 11:37:27 +00:00
|
|
|
}
|
1996-07-09 07:17:03 +00:00
|
|
|
else {
|
|
|
|
if (!upgrade) {
|
1996-07-12 11:14:15 +00:00
|
|
|
msgConfirm("Warning: Using existing root partition. It will be assumed\n"
|
1996-07-09 07:17:03 +00:00
|
|
|
"that you have the appropriate device entries already in /dev.");
|
|
|
|
}
|
1999-12-19 06:50:44 +00:00
|
|
|
dialog_clear_norefresh();
|
1996-07-09 07:17:03 +00:00
|
|
|
msgNotify("Checking integrity of existing %s filesystem.", dname);
|
2001-12-02 04:47:46 +00:00
|
|
|
i = vsystem("fsck_ffs -y %s", dname);
|
1996-07-09 07:17:03 +00:00
|
|
|
if (i)
|
|
|
|
msgConfirm("Warning: fsck returned status of %d for %s.\n"
|
|
|
|
"This partition may be unsafe to use.", i, dname);
|
|
|
|
}
|
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 soft updates was enabled in the editor but we didn't newfs,
|
|
|
|
* use tunefs to update the soft updates flag on the file system.
|
|
|
|
*/
|
|
|
|
if (!root->do_newfs && root->newfs_type == NEWFS_UFS &&
|
|
|
|
root->newfs_data.newfs_ufs.softupdates) {
|
|
|
|
i = vsystem("tunefs -n enable %s", dname);
|
|
|
|
if (i)
|
|
|
|
msgConfirm("Warning: Unable to enable soft updates"
|
|
|
|
" for root file system on %s", dname);
|
2001-03-10 19:51:04 +00:00
|
|
|
}
|
1996-07-09 07:17:03 +00:00
|
|
|
|
|
|
|
/* Switch to block device */
|
1998-02-10 18:31:27 +00:00
|
|
|
sprintf(dname, "/dev/%s", rootdev->name);
|
1996-07-09 07:17:03 +00:00
|
|
|
if (Mount("/mnt", dname)) {
|
|
|
|
msgConfirm("Unable to mount the root file system on %s! Giving up.", dname);
|
1999-12-19 06:50:44 +00:00
|
|
|
return DITEM_FAILURE | DITEM_RESTORE;
|
1995-12-07 10:34:59 +00:00
|
|
|
}
|
2001-12-02 04:47:46 +00:00
|
|
|
|
|
|
|
/* Mount devfs for other partitions to mount */
|
|
|
|
Mkdir("/mnt/dev");
|
2002-10-21 21:41:19 +00:00
|
|
|
if (!Fake) {
|
|
|
|
struct iovec iov[4];
|
|
|
|
|
|
|
|
iov[0].iov_base = "fstype";
|
|
|
|
iov[0].iov_len = strlen(iov[0].iov_base) + 1;
|
|
|
|
iov[1].iov_base = "devfs";
|
|
|
|
iov[1].iov_len = strlen(iov[1].iov_base) + 1;
|
|
|
|
iov[2].iov_base = "fspath";
|
2002-10-23 14:37:43 +00:00
|
|
|
iov[2].iov_len = strlen(iov[2].iov_base) + 1;
|
2002-10-21 21:41:19 +00:00
|
|
|
iov[3].iov_base = "/mnt/dev";
|
2002-10-23 14:37:43 +00:00
|
|
|
iov[3].iov_len = strlen(iov[3].iov_base) + 1;
|
2002-10-22 15:07:17 +00:00
|
|
|
i = nmount(iov, 4, 0);
|
2001-12-02 04:47:46 +00:00
|
|
|
|
2002-10-22 15:07:17 +00:00
|
|
|
if (i) {
|
|
|
|
dialog_clear_norefresh();
|
|
|
|
msgConfirm("Unable to mount DEVFS (error %d)", errno);
|
2001-12-02 04:47:46 +00:00
|
|
|
return DITEM_FAILURE | DITEM_RESTORE;
|
|
|
|
}
|
|
|
|
}
|
1995-05-22 14:10:25 +00:00
|
|
|
}
|
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) {
|
|
|
|
if (c1->type == freebsd) {
|
|
|
|
for (c2 = c1->part; c2; c2 = c2->next) {
|
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 */
|
|
|
|
if (c2 == rootdev)
|
1995-05-16 11:37:27 +00:00
|
|
|
continue;
|
|
|
|
|
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
|
|
|
sprintf(dname, "%s/dev/%s",
|
|
|
|
RunningAsInit ? "/mnt" : "", c2->name);
|
|
|
|
|
|
|
|
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,
|
|
|
|
"fsck_ffs -y %s/dev/%s", RunningAsInit ?
|
|
|
|
"/mnt" : "", c2->name);
|
|
|
|
#if 0
|
2001-03-10 19:51:04 +00:00
|
|
|
if (tmp->soft)
|
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,
|
|
|
|
"tunefs -n enable %s/dev/%s", RunningAsInit ?
|
|
|
|
"/mnt" : "", c2->name);
|
|
|
|
#endif
|
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;
|
|
|
|
|
1995-12-07 10:34:59 +00:00
|
|
|
if (c2 == swapdev)
|
|
|
|
continue;
|
1997-01-15 07:06:39 +00:00
|
|
|
sprintf(fname, "%s/dev/%s", RunningAsInit ? "/mnt" : "", 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
|
|
|
|
1997-01-15 07:06:39 +00:00
|
|
|
sprintf(name, "%s/%s", RunningAsInit ? "/mnt" : "", ((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) {
|
2002-11-18 08:37:46 +00:00
|
|
|
char bootdir[FILENAME_MAX];
|
2002-11-14 01:46:20 +00:00
|
|
|
PartInfo *pi = (PartInfo *)c1->private_data;
|
2002-11-30 19:54:19 +00:00
|
|
|
char *p;
|
2002-11-14 01:46:20 +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
|
|
|
sprintf(dname, "%s/dev/%s", RunningAsInit ? "/mnt" : "",
|
|
|
|
c1->name);
|
|
|
|
|
|
|
|
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
|
|
|
|
2002-12-02 20:15:16 +00:00
|
|
|
command_func_add(pi->mountpoint, Mount_msdosfs, c1->name);
|
2002-11-18 08:37:46 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Create a directory boot on the EFI filesystem and create a
|
|
|
|
* link boot on the root filesystem pointing to the one on the
|
|
|
|
* EFI filesystem. That way, we install the loader, kernel
|
|
|
|
* and modules on the EFI filesystem.
|
|
|
|
*/
|
|
|
|
sprintf(bootdir, "%s", RunningAsInit ? "/mnt" : "");
|
|
|
|
sprintf(efi_bootdir, "%s/%s", bootdir, pi->mountpoint);
|
|
|
|
strcat(bootdir, "/boot");
|
|
|
|
strcat(efi_bootdir, "/boot");
|
2002-12-02 20:15:16 +00:00
|
|
|
command_func_add(pi->mountpoint, Mkdir_command, efi_bootdir);
|
|
|
|
|
2002-11-30 19:54:19 +00:00
|
|
|
/* Make a relative link. */
|
|
|
|
p = &efi_bootdir[(RunningAsInit) ? 4 : 0];
|
|
|
|
while (*p == '/')
|
|
|
|
p++;
|
|
|
|
symlink(p, bootdir);
|
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
|
|
|
char *cp;
|
|
|
|
|
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);
|
|
|
|
variable_set2(VAR_CPIO_VERBOSITY, "high", 0);
|
|
|
|
variable_set2(VAR_TAPE_BLOCKSIZE, DEFAULT_TAPE_BLOCKSIZE, 0);
|
|
|
|
variable_set2(VAR_INSTALL_ROOT, "/", 0);
|
|
|
|
variable_set2(VAR_INSTALL_CFG, "install.cfg", 0);
|
2003-08-20 06:24:12 +00:00
|
|
|
variable_set2(VAR_SKIP_PCCARD, "NO", 0);
|
1996-07-09 14:28:22 +00:00
|
|
|
cp = getenv("EDITOR");
|
|
|
|
if (!cp)
|
|
|
|
cp = "/usr/bin/ee";
|
1999-02-05 22:15:52 +00:00
|
|
|
variable_set2(VAR_EDITOR, cp, 0);
|
|
|
|
variable_set2(VAR_FTP_USER, "ftp", 0);
|
2001-03-23 07:53:45 +00:00
|
|
|
variable_set2(VAR_BROWSER_PACKAGE, "links", 0);
|
|
|
|
variable_set2(VAR_BROWSER_BINARY, "/usr/local/bin/links", 0);
|
1999-02-05 22:15:52 +00:00
|
|
|
variable_set2(VAR_FTP_STATE, "passive", 0);
|
1999-09-02 00:51:16 +00:00
|
|
|
variable_set2(VAR_NFS_SECURE, "NO", -1);
|
2000-10-30 23:46:12 +00:00
|
|
|
if (OnVTY)
|
|
|
|
variable_set2(VAR_FIXIT_TTY, "standard", 0);
|
|
|
|
else
|
|
|
|
variable_set2(VAR_FIXIT_TTY, "serial", 0);
|
2002-04-01 21:35:24 +00:00
|
|
|
variable_set2(VAR_PKG_TMPDIR, "/var/tmp", 0);
|
1999-02-05 22:15:52 +00:00
|
|
|
variable_set2(VAR_MEDIA_TIMEOUT, itoa(MEDIA_TIMEOUT), 0);
|
1995-12-07 10:34:59 +00:00
|
|
|
if (getpid() != 1)
|
1999-02-05 22:15:52 +00:00
|
|
|
variable_set2(SYSTEM_STATE, "update", 0);
|
1995-12-07 10:34:59 +00:00
|
|
|
else
|
1999-02-05 22:15:52 +00:00
|
|
|
variable_set2(SYSTEM_STATE, "init", 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)
|
|
|
|
{
|
1999-02-05 22:15:52 +00:00
|
|
|
configEnvironmentRC_conf();
|
1997-02-15 15:24:14 +00:00
|
|
|
if (file_readable("/etc/resolv.conf"))
|
|
|
|
configEnvironmentResolv("/etc/resolv.conf");
|
|
|
|
}
|
|
|
|
|
1995-05-19 15:56:02 +00:00
|
|
|
/* Copy the boot floppy contents into /stand */
|
1995-12-07 10:34:59 +00:00
|
|
|
Boolean
|
|
|
|
copySelf(void)
|
1995-05-19 15:56:02 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
1997-09-03 11:19:56 +00:00
|
|
|
if (file_readable("/boot.help"))
|
|
|
|
vsystem("cp /boot.help /mnt");
|
1995-05-23 02:41:18 +00:00
|
|
|
msgWeHaveOutput("Copying the boot floppy to /stand on root filesystem");
|
1996-04-28 01:07:27 +00:00
|
|
|
i = vsystem("find -x /stand | cpio %s -pdum /mnt", cpioVerbosity());
|
1995-06-11 19:33:05 +00:00
|
|
|
if (i) {
|
1995-05-19 15:56:02 +00:00
|
|
|
msgConfirm("Copy returned error status of %d!", i);
|
1995-06-11 19:33:05 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
1995-05-28 23:12:09 +00:00
|
|
|
|
|
|
|
/* Copy the /etc files into their rightful place */
|
1996-04-28 01:07:27 +00:00
|
|
|
if (vsystem("cd /mnt/stand; find etc | cpio %s -pdum /mnt", cpioVerbosity())) {
|
1995-06-11 19:33:05 +00:00
|
|
|
msgConfirm("Couldn't copy up the /etc files!");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
1995-05-19 15:56:02 +00:00
|
|
|
}
|
|
|
|
|
1995-12-07 10:34:59 +00:00
|
|
|
static void
|
|
|
|
create_termcap(void)
|
|
|
|
{
|
|
|
|
FILE *fp;
|
|
|
|
|
|
|
|
const char *caps[] = {
|
|
|
|
termcap_vt100, termcap_cons25, termcap_cons25_m, termcap_cons25r,
|
2000-07-21 20:45:56 +00:00
|
|
|
termcap_cons25r_m, termcap_cons25l1, termcap_cons25l1_m,
|
|
|
|
termcap_xterm, NULL,
|
1995-12-07 10:34:59 +00:00
|
|
|
};
|
|
|
|
const char **cp;
|
|
|
|
|
|
|
|
if (!file_readable(TERMCAP_FILE)) {
|
1996-07-08 08:54:36 +00:00
|
|
|
Mkdir("/usr/share/misc");
|
1995-12-07 10:34:59 +00:00
|
|
|
fp = fopen(TERMCAP_FILE, "w");
|
|
|
|
if (!fp) {
|
|
|
|
msgConfirm("Unable to initialize termcap file. Some screen-oriented\nutilities may not work.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
cp = caps;
|
|
|
|
while (*cp)
|
|
|
|
fprintf(fp, "%s\n", *(cp++));
|
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
}
|