summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--release/sysinstall/config.c55
-rw-r--r--release/sysinstall/dispatch.c5
-rw-r--r--release/sysinstall/dist.c17
-rw-r--r--release/sysinstall/install.c114
-rw-r--r--release/sysinstall/installUpgrade.c24
-rw-r--r--release/sysinstall/network.c14
-rw-r--r--release/sysinstall/sysinstall.h9
-rw-r--r--release/sysinstall/tcpip.c4
-rw-r--r--usr.sbin/sade/config.c55
-rw-r--r--usr.sbin/sade/dispatch.c5
-rw-r--r--usr.sbin/sade/install.c114
-rw-r--r--usr.sbin/sade/sade.h9
-rw-r--r--usr.sbin/sysinstall/config.c55
-rw-r--r--usr.sbin/sysinstall/dispatch.c5
-rw-r--r--usr.sbin/sysinstall/dist.c17
-rw-r--r--usr.sbin/sysinstall/install.c114
-rw-r--r--usr.sbin/sysinstall/installUpgrade.c24
-rw-r--r--usr.sbin/sysinstall/network.c14
-rw-r--r--usr.sbin/sysinstall/sysinstall.h9
-rw-r--r--usr.sbin/sysinstall/tcpip.c4
20 files changed, 340 insertions, 327 deletions
diff --git a/release/sysinstall/config.c b/release/sysinstall/config.c
index 9c9ca8c..878a232 100644
--- a/release/sysinstall/config.c
+++ b/release/sysinstall/config.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: config.c,v 1.113 1998/09/30 12:33:28 jkh Exp $
+ * $Id: config.c,v 1.114 1998/10/14 01:04:44 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -168,7 +168,7 @@ seq_num(Chunk *c1)
}
int
-configFstab(void)
+configFstab(dialogMenuItem *self)
{
Device **devs;
Disk *disk;
@@ -213,49 +213,42 @@ configFstab(void)
}
chunk_list[nchunks] = 0;
chunk_sort();
-
+
fstab = fopen("/etc/fstab", "w");
if (!fstab) {
msgConfirm("Unable to create a new /etc/fstab file! Manual intervention\n"
"will be required.");
return DITEM_FAILURE;
}
-
+
check_rootdev(chunk_list, nchunks);
-
+
/* Go for the burn */
msgDebug("Generating /etc/fstab file\n");
fprintf(fstab, "# Device\t\tMountpoint\tFStype\tOptions\t\tDump\tPass#\n");
for (i = 0; i < nchunks; i++)
fprintf(fstab, "/dev/%s\t\t%s\t\t%s\t%s\t\t%d\t%d\n", name_of(chunk_list[i]), mount_point(chunk_list[i]),
fstype(chunk_list[i]), fstype_short(chunk_list[i]), seq_num(chunk_list[i]), seq_num(chunk_list[i]));
- Mkdir("/proc");
- fprintf(fstab, "proc\t\t\t/proc\t\tprocfs\trw\t\t0\t0\n");
-
+
/* Now look for the CDROMs */
devs = deviceFind(NULL, DEVICE_TYPE_CDROM);
cnt = deviceCount(devs);
-
- /* Write the first one out as /cdrom */
- if (cnt) {
- if (Mkdir("/cdrom")) {
- msgConfirm("Unable to make mount point for: /cdrom");
- }
- else
- fprintf(fstab, "/dev/%s\t\t/cdrom\t\tcd9660\tro,noauto\t0\t0\n", devs[0]->name);
- }
-
- /* Write the others out as /cdrom<n> */
- for (i = 1; i < cnt; i++) {
+
+ /* Write out the CDROM entries */
+ for (i = 0; i < cnt; i++) {
char cdname[10];
-
- sprintf(cdname, "/cdrom%d", i);
- if (Mkdir(cdname)) {
+
+ sprintf(cdname, "/cdrom%s", i ? itoa(i) : "");
+ if (Mkdir(cdname))
msgConfirm("Unable to make mount point for: %s", cdname);
- }
else
fprintf(fstab, "/dev/%s\t\t%s\tcd9660\tro,noauto\t0\t0\n", devs[i]->name, cdname);
}
+
+ /* And finally, a /proc. */
+ fprintf(fstab, "proc\t\t\t/proc\t\tprocfs\trw\t\t0\t0\n");
+ Mkdir("/proc");
+
fclose(fstab);
if (isDebug())
msgDebug("Wrote out /etc/fstab file\n");
@@ -264,7 +257,7 @@ configFstab(void)
/* Do the work of sucking in a config file.
* config is the filename to read in.
- * lines is a fixed (max) sized array of char *.
+ * lines is a fixed (max) sized array of char*
* returns number of lines read. line contents
* are malloc'd and must be freed by the caller.
*/
@@ -506,6 +499,7 @@ configXEnvironment(dialogMenuItem *self)
char *config, *execfile;
char *moused;
+tryagain:
dialog_clear_norefresh();
if (!dmenuOpenSimple(&MenuXF86Config, FALSE))
return DITEM_FAILURE | DITEM_RESTORE;
@@ -538,6 +532,8 @@ configXEnvironment(dialogMenuItem *self)
"utility.");
dialog_clear();
systemExecute(execfile);
+ if (!file_readable("/etc/XF86Config") && !msgYesNo("The XFree86 configuration process seems to have\nfailed. Would you like to try again?"))
+ goto tryagain;
return DITEM_SUCCESS | DITEM_RESTORE;
}
else {
@@ -548,8 +544,8 @@ configXEnvironment(dialogMenuItem *self)
}
}
-void
-configResolv(void)
+int
+configResolv(dialogMenuItem *ditem)
{
FILE *fp;
char *cp, *dp, *hp;
@@ -560,7 +556,7 @@ configResolv(void)
Mkdir("/etc");
fp = fopen("/etc/resolv.conf", "w");
if (!fp)
- return;
+ return DITEM_FAILURE;
if (variable_get(VAR_DOMAINNAME))
fprintf(fp, "domain\t%s\n", variable_get(VAR_DOMAINNAME));
fprintf(fp, "nameserver\t%s\n", cp);
@@ -575,7 +571,7 @@ skip:
/* Tack ourselves into /etc/hosts */
fp = fopen("/etc/hosts", "w");
if (!fp)
- return;
+ return DITEM_FAILURE;
/* Add an entry for localhost */
if (dp)
fprintf(fp, "127.0.0.1\t\tlocalhost.%s localhost\n", dp);
@@ -597,6 +593,7 @@ skip:
fclose(fp);
if (isDebug())
msgDebug("Wrote out /etc/hosts\n");
+ return DITEM_SUCCESS;
}
int
diff --git a/release/sysinstall/dispatch.c b/release/sysinstall/dispatch.c
index 9bac849..5e1668a 100644
--- a/release/sysinstall/dispatch.c
+++ b/release/sysinstall/dispatch.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: dispatch.c,v 1.24 1997/09/17 16:18:13 pst Exp $
+ * $Id: dispatch.c,v 1.25 1998/07/18 09:41:58 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -82,7 +82,8 @@ static struct _word {
{ "installExpress", installExpress },
{ "installNovice", installNovice },
{ "installUpgrade", installUpgrade },
- { "installFixup", installFixup },
+ { "installFixupBin", installFixupBin },
+ { "installFixupXFree", installFixupXFree },
{ "installFixitHoloShell", installFixitHoloShell },
{ "installFixitCDROM", installFixitCDROM },
{ "installFixitFloppy", installFixitFloppy },
diff --git a/release/sysinstall/dist.c b/release/sysinstall/dist.c
index 5c1ead2..1a9a0ce 100644
--- a/release/sysinstall/dist.c
+++ b/release/sysinstall/dist.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: dist.c,v 1.128 1998/10/14 11:23:48 jkh Exp $
+ * $Id: dist.c,v 1.129 1998/10/15 10:03:48 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -764,7 +764,7 @@ printSelected(char *buf, int selected, Distribution *me, int *col)
int
distExtractAll(dialogMenuItem *self)
{
- int retries = 0;
+ int old_dists, retries = 0, status = DITEM_SUCCESS;
char buf[512];
/* paranoia */
@@ -776,13 +776,22 @@ distExtractAll(dialogMenuItem *self)
if (!mediaVerify() || !mediaDevice->init(mediaDevice))
return DITEM_FAILURE;
+ old_dists = Dists;
distVerifyFlags();
+
dialog_clear_norefresh();
msgNotify("Attempting to install all selected distributions..");
+
/* Try for 3 times around the loop, then give up. */
while (Dists && ++retries < 3)
distExtract(NULL, DistTable);
+ /* Only do bin fixup if bin dist was successfully extracted */
+ if ((old_dists & DIST_BIN) && !(Dists & DIST_BIN))
+ status |= installFixupBin(self);
+ if (old_dists & DIST_XF86)
+ status |= installFixupXFree(self);
+
if (Dists) {
int col = 0;
@@ -792,7 +801,7 @@ distExtractAll(dialogMenuItem *self)
msgConfirm("Couldn't extract the following distributions. This may\n"
"be because they were not available on the installation\n"
"media you've chosen:\n\n\t%s", buf);
- return DITEM_SUCCESS | DITEM_RESTORE;
+ status |= DITEM_RESTORE;
}
- return DITEM_SUCCESS;
+ return status;
}
diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c
index 856b8bc..a9f1f62 100644
--- a/release/sysinstall/install.c
+++ b/release/sysinstall/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.216 1998/10/13 10:07:43 jkh Exp $
+ * $Id: install.c,v 1.217 1998/10/23 10:27:50 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -197,6 +197,7 @@ static int
installInitial(void)
{
static Boolean alreadyDone = FALSE;
+ int status = DITEM_SUCCESS;
if (alreadyDone)
return DITEM_SUCCESS;
@@ -240,13 +241,18 @@ installInitial(void)
chdir("/");
variable_set2(RUNNING_ON_ROOT, "yes");
- configResolv();
+
+ /* 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;
/* stick a helpful shell over on the 4th VTY */
systemCreateHoloshell();
alreadyDone = TRUE;
- return DITEM_SUCCESS;
+ return status;
}
int
@@ -665,7 +671,6 @@ installCommit(dialogMenuItem *self)
{
int i;
char *str;
- Boolean need_bin;
if (!Dists)
distConfig(NULL);
@@ -681,13 +686,9 @@ installCommit(dialogMenuItem *self)
if (isDebug())
msgDebug("installCommit: System state is `%s'\n", str);
- if (RunningAsInit) {
- /* Do things we wouldn't do to a multi-user system */
- if (DITEM_STATUS((i = installInitial())) == DITEM_FAILURE)
- return i;
- if (DITEM_STATUS((i = configFstab())) == DITEM_FAILURE)
- return i;
- }
+ /* Installation stuff we wouldn't do to a running system */
+ if (RunningAsInit && DITEM_STATUS((i = installInitial())) == DITEM_FAILURE)
+ return i;
try_media:
if (!mediaDevice->init(mediaDevice)) {
@@ -703,11 +704,9 @@ try_media:
return DITEM_FAILURE | DITEM_RESTORE;
}
- need_bin = Dists & DIST_BIN;
+ /* Now go get it all */
i = distExtractAll(self);
- /* Only do fixup if bin dist was successfully extracted */
- if (need_bin && !(Dists & DIST_BIN))
- i |= installFixup(self);
+
/* When running as init, *now* it's safe to grab the rc.foo vars */
installEnvironment();
@@ -733,33 +732,35 @@ installConfigure(void)
}
int
-installFixup(dialogMenuItem *self)
+installFixupBin(dialogMenuItem *self)
{
Device **devs;
int i;
- if (!file_readable("/kernel")) {
- if (file_readable("/kernel.GENERIC")) {
- if (vsystem("cp -p /kernel.GENERIC /kernel")) {
- msgConfirm("Unable to link /kernel into place!");
- return DITEM_FAILURE;
- }
+ /* All of this is done only as init, just to be safe */
+ if (RunningAsInit) {
+ /* Fix up kernel first */
+ if (!file_readable("/kernel")) {
+ if (file_readable("/kernel.GENERIC")) {
+ if (vsystem("cp -p /kernel.GENERIC /kernel")) {
+ msgConfirm("Unable to copy /kernel into place!");
+ return DITEM_FAILURE;
+ }
#ifdef SAVE_USERCONFIG
- /* Snapshot any boot -c changes back to the new kernel */
- if (!variable_cmp(VAR_RELNAME, RELEASE_NAME))
- save_userconfig_to_kernel("/kernel");
+ /* Snapshot any boot -c changes back to the new kernel */
+ if (!variable_cmp(VAR_RELNAME, RELEASE_NAME))
+ save_userconfig_to_kernel("/kernel");
#endif
+ }
+ else {
+ msgConfirm("Can't find a kernel image to link to on the root file system!\n"
+ "You're going to have a hard time getting this system to\n"
+ "boot from the hard disk, I'm afraid!");
+ return DITEM_FAILURE;
+ }
}
- else {
- msgConfirm("Can't find a kernel image to link to on the root file system!\n"
- "You're going to have a hard time getting this system to\n"
- "boot from the hard disk, I'm afraid!");
- return DITEM_FAILURE;
- }
- }
-
- /* Resurrect /dev after bin distribution screws it up */
- if (RunningAsInit) {
+
+ /* BOGON #1: Resurrect /dev after bin distribution screws it up */
msgNotify("Remaking all devices.. Please wait!");
if (vsystem("cd /dev; sh MAKEDEV all")) {
msgConfirm("MAKEDEV returned non-zero status");
@@ -775,7 +776,7 @@ installFixup(dialogMenuItem *self)
for (i = 0; devs[i]; i++) {
Disk *disk = (Disk *)devs[i]->private;
Chunk *c1;
-
+
if (!devs[i]->enabled)
continue;
if (!disk->chunks)
@@ -790,30 +791,18 @@ installFixup(dialogMenuItem *self)
}
}
}
-
- /* Do all the last ugly work-arounds here */
- msgNotify("Fixing permissions..");
- /* BOGON #1: XFree86 requires various specialized fixups */
- if (directory_exists("/usr/X11R6")) {
- vsystem("chmod -R a+r /usr/X11R6");
- vsystem("find /usr/X11R6 -type d | xargs chmod a+x");
-
- /* Also do bogus minimal package registration so ports don't whine */
- if (file_readable("/usr/X11R6/lib/X11/pkgreg.tar.gz"))
- vsystem("tar xpzf /usr/X11R6/lib/X11/pkgreg.tar.gz -C / && rm /usr/X11R6/lib/X11/pkgreg.tar.gz");
- }
-
+
/* BOGON #2: We leave /etc in a bad state */
chmod("/etc", 0755);
-
+
/* BOGON #3: No /var/db/mountdtab complains */
Mkdir("/var/db");
creat("/var/db/mountdtab", 0644);
-
+
/* BOGON #4: /compat created by default in root fs */
Mkdir("/usr/compat");
vsystem("ln -s /usr/compat /compat");
-
+
/* BOGON #5: aliases database not build for bin */
vsystem("newaliases");
@@ -827,6 +816,27 @@ installFixup(dialogMenuItem *self)
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");
+
+ /* Do all the last ugly work-arounds here */
+ }
+ return DITEM_SUCCESS;
+}
+
+/* Fix side-effects from the the XFree86 installation */
+int
+installFixupXFree(dialogMenuItem *self)
+{
+ /* BOGON #1: XFree86 requires various specialized fixups */
+ if (directory_exists("/usr/X11R6")) {
+ msgNotify("Fixing permissions in XFree86 tree..");
+ vsystem("chmod -R a+r /usr/X11R6");
+ vsystem("find /usr/X11R6 -type d | xargs chmod a+x");
+
+ /* Also do bogus minimal package registration so ports don't whine */
+ if (file_readable("/usr/X11R6/lib/X11/pkgreg.tar.gz")) {
+ msgNotify("Installing package metainfo..");
+ vsystem("tar xpzf /usr/X11R6/lib/X11/pkgreg.tar.gz -C / && rm /usr/X11R6/lib/X11/pkgreg.tar.gz");
+ }
}
return DITEM_SUCCESS;
}
diff --git a/release/sysinstall/installUpgrade.c b/release/sysinstall/installUpgrade.c
index 099d3f3..3cc4c27 100644
--- a/release/sysinstall/installUpgrade.c
+++ b/release/sysinstall/installUpgrade.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: installUpgrade.c,v 1.59 1998/08/28 01:03:41 jkh Exp $
+ * $Id: installUpgrade.c,v 1.60 1998/11/03 03:38:55 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -331,18 +331,6 @@ media:
}
}
- if (extractingBin) {
- msgNotify("OK, now it's time to go pound on your root a little bit to create all the\n"
- "/dev entries and such that a new system expects to see. I'll also perform a\n"
- "few \"fixup\" operations to repair the effects of splatting a bin distribution\n"
- "on top of an existing system..");
- if (DITEM_STATUS(installFixup(self)) == DITEM_FAILURE) {
- msgConfirm("Hmmmmm. The fixups don't seem to have been very happy.\n"
- "You may wish to examine the system a little more closely when\n"
- "it comes time to merge your /etc customizations back.");
- }
- }
-
msgNotify("First stage of upgrade completed successfully!\n\n"
"Next comes stage 2, where we attempt to resurrect your /etc\n"
"directory!");
@@ -484,16 +472,6 @@ installUpgradeNonInteractive(dialogMenuItem *self)
}
}
- msgNotify("OK, now it's time to go pound on your root a little bit to create all the\n"
- "/dev entries and such that a new system expects to see. I'll also perform a\n"
- "few \"fixup\" operations to repair the effects of splatting a bin distribution\n"
- "on top of an existing system..");
- if (DITEM_STATUS(installFixup(self)) == DITEM_FAILURE) {
- msgNotify("Hmmmmm. The fixups don't seem to have been very happy.\n"
- "You may wish to examine the system a little more closely when\n"
- "it comes time to merge your /etc customizations back.");
- }
-
msgNotify("First stage of upgrade completed successfully.");
if (vsystem("tar -cpBf - -C %s . | tar --unlink -xpBf - -C /etc", saved_etc)) {
msgNotify("Unable to resurrect your old /etc!");
diff --git a/release/sysinstall/network.c b/release/sysinstall/network.c
index 7dde08d..a20e561 100644
--- a/release/sysinstall/network.c
+++ b/release/sysinstall/network.c
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
- * $Id: network.c,v 1.31 1998/07/12 17:11:53 brian Exp $
+ * $Id: network.c,v 1.32 1998/10/01 19:26:02 msmith Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -58,9 +58,15 @@ mediaInitNetwork(Device *dev)
if (!RunningAsInit || networkInitialized)
return TRUE;
- msgDebug("Init routine called for network device %s.\n", dev->name);
- if (!file_readable("/etc/resolv.conf"))
- configResolv();
+ if (isDebug())
+ msgDebug("Init routine called for network device %s.\n", dev->name);
+
+ if (!file_readable("/etc/resolv.conf")) {
+ if (DITEM_STATUS(configResolv(NULL)) == DITEM_FAILURE) {
+ msgConfirm("Can't seem to write out /etc/resolv.conf. Net cannot be used.");
+ return FALSE;
+ }
+ }
/* Old PPP process lying around? */
if (pppPID) {
diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h
index c74c423..0024b73 100644
--- a/release/sysinstall/sysinstall.h
+++ b/release/sysinstall/sysinstall.h
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
- * $Id: sysinstall.h,v 1.148 1998/09/30 11:49:37 jkh Exp $
+ * $Id: sysinstall.h,v 1.149 1998/10/14 11:23:48 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -407,13 +407,13 @@ extern void command_shell_add(char *key, char *fmt, ...);
extern void command_func_add(char *key, commandFunc func, void *data);
/* config.c */
-extern int configFstab(void);
extern void configEnvironmentRC_conf(char *config);
extern void configEnvironmentResolv(char *config);
extern void configRC_conf(char *config);
+extern int configFstab(dialogMenuItem *self);
extern int configRC(dialogMenuItem *self);
extern int configRegister(dialogMenuItem *self);
-extern void configResolv(void);
+extern int configResolv(dialogMenuItem *self);
extern int configPackages(dialogMenuItem *self);
extern int configSaver(dialogMenuItem *self);
extern int configSaverTimeout(dialogMenuItem *self);
@@ -537,7 +537,8 @@ extern int installNovice(dialogMenuItem *self);
extern int installFixitHoloShell(dialogMenuItem *self);
extern int installFixitCDROM(dialogMenuItem *self);
extern int installFixitFloppy(dialogMenuItem *self);
-extern int installFixup(dialogMenuItem *self);
+extern int installFixupBin(dialogMenuItem *self);
+extern int installFixupXFree(dialogMenuItem *self);
extern int installUpgrade(dialogMenuItem *self);
extern int installFilesystems(dialogMenuItem *self);
extern int installVarDefaults(dialogMenuItem *self);
diff --git a/release/sysinstall/tcpip.c b/release/sysinstall/tcpip.c
index 5a862f2..7ef6358 100644
--- a/release/sysinstall/tcpip.c
+++ b/release/sysinstall/tcpip.c
@@ -1,5 +1,5 @@
/*
- * $Id: tcpip.c,v 1.72 1997/09/17 16:18:22 pst Exp $
+ * $Id: tcpip.c,v 1.73 1998/08/31 09:02:03 jkh Exp $
*
* Copyright (c) 1995
* Gary J Palmer. All rights reserved.
@@ -311,7 +311,7 @@ netconfig:
}
if (ipaddr[0])
variable_set2(VAR_IPADDR, ipaddr);
- configResolv(); /* XXX this will do it on the MFS copy XXX */
+ configResolv(NULL); /* XXX this will do it on the MFS copy XXX */
ret = DITEM_SUCCESS;
}
else
diff --git a/usr.sbin/sade/config.c b/usr.sbin/sade/config.c
index 9c9ca8c..878a232 100644
--- a/usr.sbin/sade/config.c
+++ b/usr.sbin/sade/config.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: config.c,v 1.113 1998/09/30 12:33:28 jkh Exp $
+ * $Id: config.c,v 1.114 1998/10/14 01:04:44 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -168,7 +168,7 @@ seq_num(Chunk *c1)
}
int
-configFstab(void)
+configFstab(dialogMenuItem *self)
{
Device **devs;
Disk *disk;
@@ -213,49 +213,42 @@ configFstab(void)
}
chunk_list[nchunks] = 0;
chunk_sort();
-
+
fstab = fopen("/etc/fstab", "w");
if (!fstab) {
msgConfirm("Unable to create a new /etc/fstab file! Manual intervention\n"
"will be required.");
return DITEM_FAILURE;
}
-
+
check_rootdev(chunk_list, nchunks);
-
+
/* Go for the burn */
msgDebug("Generating /etc/fstab file\n");
fprintf(fstab, "# Device\t\tMountpoint\tFStype\tOptions\t\tDump\tPass#\n");
for (i = 0; i < nchunks; i++)
fprintf(fstab, "/dev/%s\t\t%s\t\t%s\t%s\t\t%d\t%d\n", name_of(chunk_list[i]), mount_point(chunk_list[i]),
fstype(chunk_list[i]), fstype_short(chunk_list[i]), seq_num(chunk_list[i]), seq_num(chunk_list[i]));
- Mkdir("/proc");
- fprintf(fstab, "proc\t\t\t/proc\t\tprocfs\trw\t\t0\t0\n");
-
+
/* Now look for the CDROMs */
devs = deviceFind(NULL, DEVICE_TYPE_CDROM);
cnt = deviceCount(devs);
-
- /* Write the first one out as /cdrom */
- if (cnt) {
- if (Mkdir("/cdrom")) {
- msgConfirm("Unable to make mount point for: /cdrom");
- }
- else
- fprintf(fstab, "/dev/%s\t\t/cdrom\t\tcd9660\tro,noauto\t0\t0\n", devs[0]->name);
- }
-
- /* Write the others out as /cdrom<n> */
- for (i = 1; i < cnt; i++) {
+
+ /* Write out the CDROM entries */
+ for (i = 0; i < cnt; i++) {
char cdname[10];
-
- sprintf(cdname, "/cdrom%d", i);
- if (Mkdir(cdname)) {
+
+ sprintf(cdname, "/cdrom%s", i ? itoa(i) : "");
+ if (Mkdir(cdname))
msgConfirm("Unable to make mount point for: %s", cdname);
- }
else
fprintf(fstab, "/dev/%s\t\t%s\tcd9660\tro,noauto\t0\t0\n", devs[i]->name, cdname);
}
+
+ /* And finally, a /proc. */
+ fprintf(fstab, "proc\t\t\t/proc\t\tprocfs\trw\t\t0\t0\n");
+ Mkdir("/proc");
+
fclose(fstab);
if (isDebug())
msgDebug("Wrote out /etc/fstab file\n");
@@ -264,7 +257,7 @@ configFstab(void)
/* Do the work of sucking in a config file.
* config is the filename to read in.
- * lines is a fixed (max) sized array of char *.
+ * lines is a fixed (max) sized array of char*
* returns number of lines read. line contents
* are malloc'd and must be freed by the caller.
*/
@@ -506,6 +499,7 @@ configXEnvironment(dialogMenuItem *self)
char *config, *execfile;
char *moused;
+tryagain:
dialog_clear_norefresh();
if (!dmenuOpenSimple(&MenuXF86Config, FALSE))
return DITEM_FAILURE | DITEM_RESTORE;
@@ -538,6 +532,8 @@ configXEnvironment(dialogMenuItem *self)
"utility.");
dialog_clear();
systemExecute(execfile);
+ if (!file_readable("/etc/XF86Config") && !msgYesNo("The XFree86 configuration process seems to have\nfailed. Would you like to try again?"))
+ goto tryagain;
return DITEM_SUCCESS | DITEM_RESTORE;
}
else {
@@ -548,8 +544,8 @@ configXEnvironment(dialogMenuItem *self)
}
}
-void
-configResolv(void)
+int
+configResolv(dialogMenuItem *ditem)
{
FILE *fp;
char *cp, *dp, *hp;
@@ -560,7 +556,7 @@ configResolv(void)
Mkdir("/etc");
fp = fopen("/etc/resolv.conf", "w");
if (!fp)
- return;
+ return DITEM_FAILURE;
if (variable_get(VAR_DOMAINNAME))
fprintf(fp, "domain\t%s\n", variable_get(VAR_DOMAINNAME));
fprintf(fp, "nameserver\t%s\n", cp);
@@ -575,7 +571,7 @@ skip:
/* Tack ourselves into /etc/hosts */
fp = fopen("/etc/hosts", "w");
if (!fp)
- return;
+ return DITEM_FAILURE;
/* Add an entry for localhost */
if (dp)
fprintf(fp, "127.0.0.1\t\tlocalhost.%s localhost\n", dp);
@@ -597,6 +593,7 @@ skip:
fclose(fp);
if (isDebug())
msgDebug("Wrote out /etc/hosts\n");
+ return DITEM_SUCCESS;
}
int
diff --git a/usr.sbin/sade/dispatch.c b/usr.sbin/sade/dispatch.c
index 9bac849..5e1668a 100644
--- a/usr.sbin/sade/dispatch.c
+++ b/usr.sbin/sade/dispatch.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: dispatch.c,v 1.24 1997/09/17 16:18:13 pst Exp $
+ * $Id: dispatch.c,v 1.25 1998/07/18 09:41:58 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -82,7 +82,8 @@ static struct _word {
{ "installExpress", installExpress },
{ "installNovice", installNovice },
{ "installUpgrade", installUpgrade },
- { "installFixup", installFixup },
+ { "installFixupBin", installFixupBin },
+ { "installFixupXFree", installFixupXFree },
{ "installFixitHoloShell", installFixitHoloShell },
{ "installFixitCDROM", installFixitCDROM },
{ "installFixitFloppy", installFixitFloppy },
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
index 856b8bc..a9f1f62 100644
--- a/usr.sbin/sade/install.c
+++ b/usr.sbin/sade/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.216 1998/10/13 10:07:43 jkh Exp $
+ * $Id: install.c,v 1.217 1998/10/23 10:27:50 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -197,6 +197,7 @@ static int
installInitial(void)
{
static Boolean alreadyDone = FALSE;
+ int status = DITEM_SUCCESS;
if (alreadyDone)
return DITEM_SUCCESS;
@@ -240,13 +241,18 @@ installInitial(void)
chdir("/");
variable_set2(RUNNING_ON_ROOT, "yes");
- configResolv();
+
+ /* 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;
/* stick a helpful shell over on the 4th VTY */
systemCreateHoloshell();
alreadyDone = TRUE;
- return DITEM_SUCCESS;
+ return status;
}
int
@@ -665,7 +671,6 @@ installCommit(dialogMenuItem *self)
{
int i;
char *str;
- Boolean need_bin;
if (!Dists)
distConfig(NULL);
@@ -681,13 +686,9 @@ installCommit(dialogMenuItem *self)
if (isDebug())
msgDebug("installCommit: System state is `%s'\n", str);
- if (RunningAsInit) {
- /* Do things we wouldn't do to a multi-user system */
- if (DITEM_STATUS((i = installInitial())) == DITEM_FAILURE)
- return i;
- if (DITEM_STATUS((i = configFstab())) == DITEM_FAILURE)
- return i;
- }
+ /* Installation stuff we wouldn't do to a running system */
+ if (RunningAsInit && DITEM_STATUS((i = installInitial())) == DITEM_FAILURE)
+ return i;
try_media:
if (!mediaDevice->init(mediaDevice)) {
@@ -703,11 +704,9 @@ try_media:
return DITEM_FAILURE | DITEM_RESTORE;
}
- need_bin = Dists & DIST_BIN;
+ /* Now go get it all */
i = distExtractAll(self);
- /* Only do fixup if bin dist was successfully extracted */
- if (need_bin && !(Dists & DIST_BIN))
- i |= installFixup(self);
+
/* When running as init, *now* it's safe to grab the rc.foo vars */
installEnvironment();
@@ -733,33 +732,35 @@ installConfigure(void)
}
int
-installFixup(dialogMenuItem *self)
+installFixupBin(dialogMenuItem *self)
{
Device **devs;
int i;
- if (!file_readable("/kernel")) {
- if (file_readable("/kernel.GENERIC")) {
- if (vsystem("cp -p /kernel.GENERIC /kernel")) {
- msgConfirm("Unable to link /kernel into place!");
- return DITEM_FAILURE;
- }
+ /* All of this is done only as init, just to be safe */
+ if (RunningAsInit) {
+ /* Fix up kernel first */
+ if (!file_readable("/kernel")) {
+ if (file_readable("/kernel.GENERIC")) {
+ if (vsystem("cp -p /kernel.GENERIC /kernel")) {
+ msgConfirm("Unable to copy /kernel into place!");
+ return DITEM_FAILURE;
+ }
#ifdef SAVE_USERCONFIG
- /* Snapshot any boot -c changes back to the new kernel */
- if (!variable_cmp(VAR_RELNAME, RELEASE_NAME))
- save_userconfig_to_kernel("/kernel");
+ /* Snapshot any boot -c changes back to the new kernel */
+ if (!variable_cmp(VAR_RELNAME, RELEASE_NAME))
+ save_userconfig_to_kernel("/kernel");
#endif
+ }
+ else {
+ msgConfirm("Can't find a kernel image to link to on the root file system!\n"
+ "You're going to have a hard time getting this system to\n"
+ "boot from the hard disk, I'm afraid!");
+ return DITEM_FAILURE;
+ }
}
- else {
- msgConfirm("Can't find a kernel image to link to on the root file system!\n"
- "You're going to have a hard time getting this system to\n"
- "boot from the hard disk, I'm afraid!");
- return DITEM_FAILURE;
- }
- }
-
- /* Resurrect /dev after bin distribution screws it up */
- if (RunningAsInit) {
+
+ /* BOGON #1: Resurrect /dev after bin distribution screws it up */
msgNotify("Remaking all devices.. Please wait!");
if (vsystem("cd /dev; sh MAKEDEV all")) {
msgConfirm("MAKEDEV returned non-zero status");
@@ -775,7 +776,7 @@ installFixup(dialogMenuItem *self)
for (i = 0; devs[i]; i++) {
Disk *disk = (Disk *)devs[i]->private;
Chunk *c1;
-
+
if (!devs[i]->enabled)
continue;
if (!disk->chunks)
@@ -790,30 +791,18 @@ installFixup(dialogMenuItem *self)
}
}
}
-
- /* Do all the last ugly work-arounds here */
- msgNotify("Fixing permissions..");
- /* BOGON #1: XFree86 requires various specialized fixups */
- if (directory_exists("/usr/X11R6")) {
- vsystem("chmod -R a+r /usr/X11R6");
- vsystem("find /usr/X11R6 -type d | xargs chmod a+x");
-
- /* Also do bogus minimal package registration so ports don't whine */
- if (file_readable("/usr/X11R6/lib/X11/pkgreg.tar.gz"))
- vsystem("tar xpzf /usr/X11R6/lib/X11/pkgreg.tar.gz -C / && rm /usr/X11R6/lib/X11/pkgreg.tar.gz");
- }
-
+
/* BOGON #2: We leave /etc in a bad state */
chmod("/etc", 0755);
-
+
/* BOGON #3: No /var/db/mountdtab complains */
Mkdir("/var/db");
creat("/var/db/mountdtab", 0644);
-
+
/* BOGON #4: /compat created by default in root fs */
Mkdir("/usr/compat");
vsystem("ln -s /usr/compat /compat");
-
+
/* BOGON #5: aliases database not build for bin */
vsystem("newaliases");
@@ -827,6 +816,27 @@ installFixup(dialogMenuItem *self)
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");
+
+ /* Do all the last ugly work-arounds here */
+ }
+ return DITEM_SUCCESS;
+}
+
+/* Fix side-effects from the the XFree86 installation */
+int
+installFixupXFree(dialogMenuItem *self)
+{
+ /* BOGON #1: XFree86 requires various specialized fixups */
+ if (directory_exists("/usr/X11R6")) {
+ msgNotify("Fixing permissions in XFree86 tree..");
+ vsystem("chmod -R a+r /usr/X11R6");
+ vsystem("find /usr/X11R6 -type d | xargs chmod a+x");
+
+ /* Also do bogus minimal package registration so ports don't whine */
+ if (file_readable("/usr/X11R6/lib/X11/pkgreg.tar.gz")) {
+ msgNotify("Installing package metainfo..");
+ vsystem("tar xpzf /usr/X11R6/lib/X11/pkgreg.tar.gz -C / && rm /usr/X11R6/lib/X11/pkgreg.tar.gz");
+ }
}
return DITEM_SUCCESS;
}
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index c74c423..0024b73 100644
--- a/usr.sbin/sade/sade.h
+++ b/usr.sbin/sade/sade.h
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
- * $Id: sysinstall.h,v 1.148 1998/09/30 11:49:37 jkh Exp $
+ * $Id: sysinstall.h,v 1.149 1998/10/14 11:23:48 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -407,13 +407,13 @@ extern void command_shell_add(char *key, char *fmt, ...);
extern void command_func_add(char *key, commandFunc func, void *data);
/* config.c */
-extern int configFstab(void);
extern void configEnvironmentRC_conf(char *config);
extern void configEnvironmentResolv(char *config);
extern void configRC_conf(char *config);
+extern int configFstab(dialogMenuItem *self);
extern int configRC(dialogMenuItem *self);
extern int configRegister(dialogMenuItem *self);
-extern void configResolv(void);
+extern int configResolv(dialogMenuItem *self);
extern int configPackages(dialogMenuItem *self);
extern int configSaver(dialogMenuItem *self);
extern int configSaverTimeout(dialogMenuItem *self);
@@ -537,7 +537,8 @@ extern int installNovice(dialogMenuItem *self);
extern int installFixitHoloShell(dialogMenuItem *self);
extern int installFixitCDROM(dialogMenuItem *self);
extern int installFixitFloppy(dialogMenuItem *self);
-extern int installFixup(dialogMenuItem *self);
+extern int installFixupBin(dialogMenuItem *self);
+extern int installFixupXFree(dialogMenuItem *self);
extern int installUpgrade(dialogMenuItem *self);
extern int installFilesystems(dialogMenuItem *self);
extern int installVarDefaults(dialogMenuItem *self);
diff --git a/usr.sbin/sysinstall/config.c b/usr.sbin/sysinstall/config.c
index 9c9ca8c..878a232 100644
--- a/usr.sbin/sysinstall/config.c
+++ b/usr.sbin/sysinstall/config.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: config.c,v 1.113 1998/09/30 12:33:28 jkh Exp $
+ * $Id: config.c,v 1.114 1998/10/14 01:04:44 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -168,7 +168,7 @@ seq_num(Chunk *c1)
}
int
-configFstab(void)
+configFstab(dialogMenuItem *self)
{
Device **devs;
Disk *disk;
@@ -213,49 +213,42 @@ configFstab(void)
}
chunk_list[nchunks] = 0;
chunk_sort();
-
+
fstab = fopen("/etc/fstab", "w");
if (!fstab) {
msgConfirm("Unable to create a new /etc/fstab file! Manual intervention\n"
"will be required.");
return DITEM_FAILURE;
}
-
+
check_rootdev(chunk_list, nchunks);
-
+
/* Go for the burn */
msgDebug("Generating /etc/fstab file\n");
fprintf(fstab, "# Device\t\tMountpoint\tFStype\tOptions\t\tDump\tPass#\n");
for (i = 0; i < nchunks; i++)
fprintf(fstab, "/dev/%s\t\t%s\t\t%s\t%s\t\t%d\t%d\n", name_of(chunk_list[i]), mount_point(chunk_list[i]),
fstype(chunk_list[i]), fstype_short(chunk_list[i]), seq_num(chunk_list[i]), seq_num(chunk_list[i]));
- Mkdir("/proc");
- fprintf(fstab, "proc\t\t\t/proc\t\tprocfs\trw\t\t0\t0\n");
-
+
/* Now look for the CDROMs */
devs = deviceFind(NULL, DEVICE_TYPE_CDROM);
cnt = deviceCount(devs);
-
- /* Write the first one out as /cdrom */
- if (cnt) {
- if (Mkdir("/cdrom")) {
- msgConfirm("Unable to make mount point for: /cdrom");
- }
- else
- fprintf(fstab, "/dev/%s\t\t/cdrom\t\tcd9660\tro,noauto\t0\t0\n", devs[0]->name);
- }
-
- /* Write the others out as /cdrom<n> */
- for (i = 1; i < cnt; i++) {
+
+ /* Write out the CDROM entries */
+ for (i = 0; i < cnt; i++) {
char cdname[10];
-
- sprintf(cdname, "/cdrom%d", i);
- if (Mkdir(cdname)) {
+
+ sprintf(cdname, "/cdrom%s", i ? itoa(i) : "");
+ if (Mkdir(cdname))
msgConfirm("Unable to make mount point for: %s", cdname);
- }
else
fprintf(fstab, "/dev/%s\t\t%s\tcd9660\tro,noauto\t0\t0\n", devs[i]->name, cdname);
}
+
+ /* And finally, a /proc. */
+ fprintf(fstab, "proc\t\t\t/proc\t\tprocfs\trw\t\t0\t0\n");
+ Mkdir("/proc");
+
fclose(fstab);
if (isDebug())
msgDebug("Wrote out /etc/fstab file\n");
@@ -264,7 +257,7 @@ configFstab(void)
/* Do the work of sucking in a config file.
* config is the filename to read in.
- * lines is a fixed (max) sized array of char *.
+ * lines is a fixed (max) sized array of char*
* returns number of lines read. line contents
* are malloc'd and must be freed by the caller.
*/
@@ -506,6 +499,7 @@ configXEnvironment(dialogMenuItem *self)
char *config, *execfile;
char *moused;
+tryagain:
dialog_clear_norefresh();
if (!dmenuOpenSimple(&MenuXF86Config, FALSE))
return DITEM_FAILURE | DITEM_RESTORE;
@@ -538,6 +532,8 @@ configXEnvironment(dialogMenuItem *self)
"utility.");
dialog_clear();
systemExecute(execfile);
+ if (!file_readable("/etc/XF86Config") && !msgYesNo("The XFree86 configuration process seems to have\nfailed. Would you like to try again?"))
+ goto tryagain;
return DITEM_SUCCESS | DITEM_RESTORE;
}
else {
@@ -548,8 +544,8 @@ configXEnvironment(dialogMenuItem *self)
}
}
-void
-configResolv(void)
+int
+configResolv(dialogMenuItem *ditem)
{
FILE *fp;
char *cp, *dp, *hp;
@@ -560,7 +556,7 @@ configResolv(void)
Mkdir("/etc");
fp = fopen("/etc/resolv.conf", "w");
if (!fp)
- return;
+ return DITEM_FAILURE;
if (variable_get(VAR_DOMAINNAME))
fprintf(fp, "domain\t%s\n", variable_get(VAR_DOMAINNAME));
fprintf(fp, "nameserver\t%s\n", cp);
@@ -575,7 +571,7 @@ skip:
/* Tack ourselves into /etc/hosts */
fp = fopen("/etc/hosts", "w");
if (!fp)
- return;
+ return DITEM_FAILURE;
/* Add an entry for localhost */
if (dp)
fprintf(fp, "127.0.0.1\t\tlocalhost.%s localhost\n", dp);
@@ -597,6 +593,7 @@ skip:
fclose(fp);
if (isDebug())
msgDebug("Wrote out /etc/hosts\n");
+ return DITEM_SUCCESS;
}
int
diff --git a/usr.sbin/sysinstall/dispatch.c b/usr.sbin/sysinstall/dispatch.c
index 9bac849..5e1668a 100644
--- a/usr.sbin/sysinstall/dispatch.c
+++ b/usr.sbin/sysinstall/dispatch.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: dispatch.c,v 1.24 1997/09/17 16:18:13 pst Exp $
+ * $Id: dispatch.c,v 1.25 1998/07/18 09:41:58 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -82,7 +82,8 @@ static struct _word {
{ "installExpress", installExpress },
{ "installNovice", installNovice },
{ "installUpgrade", installUpgrade },
- { "installFixup", installFixup },
+ { "installFixupBin", installFixupBin },
+ { "installFixupXFree", installFixupXFree },
{ "installFixitHoloShell", installFixitHoloShell },
{ "installFixitCDROM", installFixitCDROM },
{ "installFixitFloppy", installFixitFloppy },
diff --git a/usr.sbin/sysinstall/dist.c b/usr.sbin/sysinstall/dist.c
index 5c1ead2..1a9a0ce 100644
--- a/usr.sbin/sysinstall/dist.c
+++ b/usr.sbin/sysinstall/dist.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: dist.c,v 1.128 1998/10/14 11:23:48 jkh Exp $
+ * $Id: dist.c,v 1.129 1998/10/15 10:03:48 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -764,7 +764,7 @@ printSelected(char *buf, int selected, Distribution *me, int *col)
int
distExtractAll(dialogMenuItem *self)
{
- int retries = 0;
+ int old_dists, retries = 0, status = DITEM_SUCCESS;
char buf[512];
/* paranoia */
@@ -776,13 +776,22 @@ distExtractAll(dialogMenuItem *self)
if (!mediaVerify() || !mediaDevice->init(mediaDevice))
return DITEM_FAILURE;
+ old_dists = Dists;
distVerifyFlags();
+
dialog_clear_norefresh();
msgNotify("Attempting to install all selected distributions..");
+
/* Try for 3 times around the loop, then give up. */
while (Dists && ++retries < 3)
distExtract(NULL, DistTable);
+ /* Only do bin fixup if bin dist was successfully extracted */
+ if ((old_dists & DIST_BIN) && !(Dists & DIST_BIN))
+ status |= installFixupBin(self);
+ if (old_dists & DIST_XF86)
+ status |= installFixupXFree(self);
+
if (Dists) {
int col = 0;
@@ -792,7 +801,7 @@ distExtractAll(dialogMenuItem *self)
msgConfirm("Couldn't extract the following distributions. This may\n"
"be because they were not available on the installation\n"
"media you've chosen:\n\n\t%s", buf);
- return DITEM_SUCCESS | DITEM_RESTORE;
+ status |= DITEM_RESTORE;
}
- return DITEM_SUCCESS;
+ return status;
}
diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c
index 856b8bc..a9f1f62 100644
--- a/usr.sbin/sysinstall/install.c
+++ b/usr.sbin/sysinstall/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.216 1998/10/13 10:07:43 jkh Exp $
+ * $Id: install.c,v 1.217 1998/10/23 10:27:50 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -197,6 +197,7 @@ static int
installInitial(void)
{
static Boolean alreadyDone = FALSE;
+ int status = DITEM_SUCCESS;
if (alreadyDone)
return DITEM_SUCCESS;
@@ -240,13 +241,18 @@ installInitial(void)
chdir("/");
variable_set2(RUNNING_ON_ROOT, "yes");
- configResolv();
+
+ /* 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;
/* stick a helpful shell over on the 4th VTY */
systemCreateHoloshell();
alreadyDone = TRUE;
- return DITEM_SUCCESS;
+ return status;
}
int
@@ -665,7 +671,6 @@ installCommit(dialogMenuItem *self)
{
int i;
char *str;
- Boolean need_bin;
if (!Dists)
distConfig(NULL);
@@ -681,13 +686,9 @@ installCommit(dialogMenuItem *self)
if (isDebug())
msgDebug("installCommit: System state is `%s'\n", str);
- if (RunningAsInit) {
- /* Do things we wouldn't do to a multi-user system */
- if (DITEM_STATUS((i = installInitial())) == DITEM_FAILURE)
- return i;
- if (DITEM_STATUS((i = configFstab())) == DITEM_FAILURE)
- return i;
- }
+ /* Installation stuff we wouldn't do to a running system */
+ if (RunningAsInit && DITEM_STATUS((i = installInitial())) == DITEM_FAILURE)
+ return i;
try_media:
if (!mediaDevice->init(mediaDevice)) {
@@ -703,11 +704,9 @@ try_media:
return DITEM_FAILURE | DITEM_RESTORE;
}
- need_bin = Dists & DIST_BIN;
+ /* Now go get it all */
i = distExtractAll(self);
- /* Only do fixup if bin dist was successfully extracted */
- if (need_bin && !(Dists & DIST_BIN))
- i |= installFixup(self);
+
/* When running as init, *now* it's safe to grab the rc.foo vars */
installEnvironment();
@@ -733,33 +732,35 @@ installConfigure(void)
}
int
-installFixup(dialogMenuItem *self)
+installFixupBin(dialogMenuItem *self)
{
Device **devs;
int i;
- if (!file_readable("/kernel")) {
- if (file_readable("/kernel.GENERIC")) {
- if (vsystem("cp -p /kernel.GENERIC /kernel")) {
- msgConfirm("Unable to link /kernel into place!");
- return DITEM_FAILURE;
- }
+ /* All of this is done only as init, just to be safe */
+ if (RunningAsInit) {
+ /* Fix up kernel first */
+ if (!file_readable("/kernel")) {
+ if (file_readable("/kernel.GENERIC")) {
+ if (vsystem("cp -p /kernel.GENERIC /kernel")) {
+ msgConfirm("Unable to copy /kernel into place!");
+ return DITEM_FAILURE;
+ }
#ifdef SAVE_USERCONFIG
- /* Snapshot any boot -c changes back to the new kernel */
- if (!variable_cmp(VAR_RELNAME, RELEASE_NAME))
- save_userconfig_to_kernel("/kernel");
+ /* Snapshot any boot -c changes back to the new kernel */
+ if (!variable_cmp(VAR_RELNAME, RELEASE_NAME))
+ save_userconfig_to_kernel("/kernel");
#endif
+ }
+ else {
+ msgConfirm("Can't find a kernel image to link to on the root file system!\n"
+ "You're going to have a hard time getting this system to\n"
+ "boot from the hard disk, I'm afraid!");
+ return DITEM_FAILURE;
+ }
}
- else {
- msgConfirm("Can't find a kernel image to link to on the root file system!\n"
- "You're going to have a hard time getting this system to\n"
- "boot from the hard disk, I'm afraid!");
- return DITEM_FAILURE;
- }
- }
-
- /* Resurrect /dev after bin distribution screws it up */
- if (RunningAsInit) {
+
+ /* BOGON #1: Resurrect /dev after bin distribution screws it up */
msgNotify("Remaking all devices.. Please wait!");
if (vsystem("cd /dev; sh MAKEDEV all")) {
msgConfirm("MAKEDEV returned non-zero status");
@@ -775,7 +776,7 @@ installFixup(dialogMenuItem *self)
for (i = 0; devs[i]; i++) {
Disk *disk = (Disk *)devs[i]->private;
Chunk *c1;
-
+
if (!devs[i]->enabled)
continue;
if (!disk->chunks)
@@ -790,30 +791,18 @@ installFixup(dialogMenuItem *self)
}
}
}
-
- /* Do all the last ugly work-arounds here */
- msgNotify("Fixing permissions..");
- /* BOGON #1: XFree86 requires various specialized fixups */
- if (directory_exists("/usr/X11R6")) {
- vsystem("chmod -R a+r /usr/X11R6");
- vsystem("find /usr/X11R6 -type d | xargs chmod a+x");
-
- /* Also do bogus minimal package registration so ports don't whine */
- if (file_readable("/usr/X11R6/lib/X11/pkgreg.tar.gz"))
- vsystem("tar xpzf /usr/X11R6/lib/X11/pkgreg.tar.gz -C / && rm /usr/X11R6/lib/X11/pkgreg.tar.gz");
- }
-
+
/* BOGON #2: We leave /etc in a bad state */
chmod("/etc", 0755);
-
+
/* BOGON #3: No /var/db/mountdtab complains */
Mkdir("/var/db");
creat("/var/db/mountdtab", 0644);
-
+
/* BOGON #4: /compat created by default in root fs */
Mkdir("/usr/compat");
vsystem("ln -s /usr/compat /compat");
-
+
/* BOGON #5: aliases database not build for bin */
vsystem("newaliases");
@@ -827,6 +816,27 @@ installFixup(dialogMenuItem *self)
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");
+
+ /* Do all the last ugly work-arounds here */
+ }
+ return DITEM_SUCCESS;
+}
+
+/* Fix side-effects from the the XFree86 installation */
+int
+installFixupXFree(dialogMenuItem *self)
+{
+ /* BOGON #1: XFree86 requires various specialized fixups */
+ if (directory_exists("/usr/X11R6")) {
+ msgNotify("Fixing permissions in XFree86 tree..");
+ vsystem("chmod -R a+r /usr/X11R6");
+ vsystem("find /usr/X11R6 -type d | xargs chmod a+x");
+
+ /* Also do bogus minimal package registration so ports don't whine */
+ if (file_readable("/usr/X11R6/lib/X11/pkgreg.tar.gz")) {
+ msgNotify("Installing package metainfo..");
+ vsystem("tar xpzf /usr/X11R6/lib/X11/pkgreg.tar.gz -C / && rm /usr/X11R6/lib/X11/pkgreg.tar.gz");
+ }
}
return DITEM_SUCCESS;
}
diff --git a/usr.sbin/sysinstall/installUpgrade.c b/usr.sbin/sysinstall/installUpgrade.c
index 099d3f3..3cc4c27 100644
--- a/usr.sbin/sysinstall/installUpgrade.c
+++ b/usr.sbin/sysinstall/installUpgrade.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: installUpgrade.c,v 1.59 1998/08/28 01:03:41 jkh Exp $
+ * $Id: installUpgrade.c,v 1.60 1998/11/03 03:38:55 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -331,18 +331,6 @@ media:
}
}
- if (extractingBin) {
- msgNotify("OK, now it's time to go pound on your root a little bit to create all the\n"
- "/dev entries and such that a new system expects to see. I'll also perform a\n"
- "few \"fixup\" operations to repair the effects of splatting a bin distribution\n"
- "on top of an existing system..");
- if (DITEM_STATUS(installFixup(self)) == DITEM_FAILURE) {
- msgConfirm("Hmmmmm. The fixups don't seem to have been very happy.\n"
- "You may wish to examine the system a little more closely when\n"
- "it comes time to merge your /etc customizations back.");
- }
- }
-
msgNotify("First stage of upgrade completed successfully!\n\n"
"Next comes stage 2, where we attempt to resurrect your /etc\n"
"directory!");
@@ -484,16 +472,6 @@ installUpgradeNonInteractive(dialogMenuItem *self)
}
}
- msgNotify("OK, now it's time to go pound on your root a little bit to create all the\n"
- "/dev entries and such that a new system expects to see. I'll also perform a\n"
- "few \"fixup\" operations to repair the effects of splatting a bin distribution\n"
- "on top of an existing system..");
- if (DITEM_STATUS(installFixup(self)) == DITEM_FAILURE) {
- msgNotify("Hmmmmm. The fixups don't seem to have been very happy.\n"
- "You may wish to examine the system a little more closely when\n"
- "it comes time to merge your /etc customizations back.");
- }
-
msgNotify("First stage of upgrade completed successfully.");
if (vsystem("tar -cpBf - -C %s . | tar --unlink -xpBf - -C /etc", saved_etc)) {
msgNotify("Unable to resurrect your old /etc!");
diff --git a/usr.sbin/sysinstall/network.c b/usr.sbin/sysinstall/network.c
index 7dde08d..a20e561 100644
--- a/usr.sbin/sysinstall/network.c
+++ b/usr.sbin/sysinstall/network.c
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
- * $Id: network.c,v 1.31 1998/07/12 17:11:53 brian Exp $
+ * $Id: network.c,v 1.32 1998/10/01 19:26:02 msmith Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -58,9 +58,15 @@ mediaInitNetwork(Device *dev)
if (!RunningAsInit || networkInitialized)
return TRUE;
- msgDebug("Init routine called for network device %s.\n", dev->name);
- if (!file_readable("/etc/resolv.conf"))
- configResolv();
+ if (isDebug())
+ msgDebug("Init routine called for network device %s.\n", dev->name);
+
+ if (!file_readable("/etc/resolv.conf")) {
+ if (DITEM_STATUS(configResolv(NULL)) == DITEM_FAILURE) {
+ msgConfirm("Can't seem to write out /etc/resolv.conf. Net cannot be used.");
+ return FALSE;
+ }
+ }
/* Old PPP process lying around? */
if (pppPID) {
diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h
index c74c423..0024b73 100644
--- a/usr.sbin/sysinstall/sysinstall.h
+++ b/usr.sbin/sysinstall/sysinstall.h
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
- * $Id: sysinstall.h,v 1.148 1998/09/30 11:49:37 jkh Exp $
+ * $Id: sysinstall.h,v 1.149 1998/10/14 11:23:48 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -407,13 +407,13 @@ extern void command_shell_add(char *key, char *fmt, ...);
extern void command_func_add(char *key, commandFunc func, void *data);
/* config.c */
-extern int configFstab(void);
extern void configEnvironmentRC_conf(char *config);
extern void configEnvironmentResolv(char *config);
extern void configRC_conf(char *config);
+extern int configFstab(dialogMenuItem *self);
extern int configRC(dialogMenuItem *self);
extern int configRegister(dialogMenuItem *self);
-extern void configResolv(void);
+extern int configResolv(dialogMenuItem *self);
extern int configPackages(dialogMenuItem *self);
extern int configSaver(dialogMenuItem *self);
extern int configSaverTimeout(dialogMenuItem *self);
@@ -537,7 +537,8 @@ extern int installNovice(dialogMenuItem *self);
extern int installFixitHoloShell(dialogMenuItem *self);
extern int installFixitCDROM(dialogMenuItem *self);
extern int installFixitFloppy(dialogMenuItem *self);
-extern int installFixup(dialogMenuItem *self);
+extern int installFixupBin(dialogMenuItem *self);
+extern int installFixupXFree(dialogMenuItem *self);
extern int installUpgrade(dialogMenuItem *self);
extern int installFilesystems(dialogMenuItem *self);
extern int installVarDefaults(dialogMenuItem *self);
diff --git a/usr.sbin/sysinstall/tcpip.c b/usr.sbin/sysinstall/tcpip.c
index 5a862f2..7ef6358 100644
--- a/usr.sbin/sysinstall/tcpip.c
+++ b/usr.sbin/sysinstall/tcpip.c
@@ -1,5 +1,5 @@
/*
- * $Id: tcpip.c,v 1.72 1997/09/17 16:18:22 pst Exp $
+ * $Id: tcpip.c,v 1.73 1998/08/31 09:02:03 jkh Exp $
*
* Copyright (c) 1995
* Gary J Palmer. All rights reserved.
@@ -311,7 +311,7 @@ netconfig:
}
if (ipaddr[0])
variable_set2(VAR_IPADDR, ipaddr);
- configResolv(); /* XXX this will do it on the MFS copy XXX */
+ configResolv(NULL); /* XXX this will do it on the MFS copy XXX */
ret = DITEM_SUCCESS;
}
else
OpenPOWER on IntegriCloud