From 27a550e5edc0d1dc3784e035e183f085b399ab48 Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Fri, 12 Oct 2001 07:36:34 +0000 Subject: [PATCH] DTRT in the restart case --- usr.sbin/sade/globals.c | 2 ++ usr.sbin/sade/install.c | 2 +- usr.sbin/sade/main.c | 4 +++- usr.sbin/sade/sade.h | 1 + usr.sbin/sade/system.c | 2 +- usr.sbin/sysinstall/globals.c | 2 ++ usr.sbin/sysinstall/install.c | 2 +- usr.sbin/sysinstall/main.c | 4 +++- usr.sbin/sysinstall/sysinstall.h | 1 + usr.sbin/sysinstall/system.c | 2 +- 10 files changed, 16 insertions(+), 6 deletions(-) diff --git a/usr.sbin/sade/globals.c b/usr.sbin/sade/globals.c index b12dbd89c9b7..4323bd0e130b 100644 --- a/usr.sbin/sade/globals.c +++ b/usr.sbin/sade/globals.c @@ -47,6 +47,7 @@ Boolean RunningAsInit; /* Are we running as init? */ Boolean DialogActive; /* Is libdialog initialized? */ Boolean ColorDisplay; /* Are we on a color display? */ Boolean OnVTY; /* Are we on a VTY? */ +Boolean Restarting; /* Are we restarting sysinstall? */ Variable *VarHead; /* The head of the variable chain */ Device *mediaDevice; /* Where we're installing from */ int BootMgr; /* Which boot manager we're using */ @@ -63,6 +64,7 @@ globalsInit(void) DebugFD = -1; ColorDisplay = FALSE; Fake = FALSE; + Restarting = FALSE; OnVTY = FALSE; DialogActive = FALSE; VarHead = NULL; diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c index 4f4c2237e1ca..208f4ef488f1 100644 --- a/usr.sbin/sade/install.c +++ b/usr.sbin/sade/install.c @@ -225,7 +225,7 @@ installInitial(void) return DITEM_FAILURE; } - if (chroot("/mnt") == -1) { + if (!Restarting && chroot("/mnt") == -1) { msgConfirm("installInitial: Unable to chroot to %s - this is bad!", "/mnt"); return DITEM_FAILURE; diff --git a/usr.sbin/sade/main.c b/usr.sbin/sade/main.c index a5620298206b..db56dc0c56d7 100644 --- a/usr.sbin/sade/main.c +++ b/usr.sbin/sade/main.c @@ -91,6 +91,8 @@ main(int argc, char **argv) Fake = TRUE; msgConfirm("I'll be just faking it from here on out, OK?"); } + if (argc > 1 && !strcmp(argv[1], "-restart")) + Restarting = TRUE; /* Try to preserve our scroll-back buffer */ if (OnVTY) { @@ -129,7 +131,7 @@ main(int argc, char **argv) if (!strstr(argv[0], "sysinstall")) start_arg = 0; - else if (Fake) + else if (Fake || Restarting) start_arg = 2; else start_arg = 1; diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index fb764b84ab6e..f143b38b779e 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -346,6 +346,7 @@ typedef struct _devPriv { extern jmp_buf BailOut; /* Used to get the heck out */ extern int DebugFD; /* Where diagnostic output goes */ extern Boolean Fake; /* Don't actually modify anything - testing */ +extern Boolean Restarting; /* Are we restarting sysinstall? */ extern Boolean SystemWasInstalled; /* Did we install it? */ extern Boolean RunningAsInit; /* Are we running stand-alone? */ extern Boolean DialogActive; /* Is the dialog() stuff up? */ diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c index deb9e9f90812..7cbb12fe0425 100644 --- a/usr.sbin/sade/system.c +++ b/usr.sbin/sade/system.c @@ -63,7 +63,7 @@ intr_restart(dialogMenuItem *self) fdmax = getdtablesize(); for (fd = 3; fd < fdmax; fd++) close(fd); - ret = execl(StartName, StartName, (char *)NULL); + ret = execl(StartName, StartName, "-restart", (char *)NULL); msgDebug("execl failed (%s)\n", strerror(errno)); /* NOTREACHED */ return -1; diff --git a/usr.sbin/sysinstall/globals.c b/usr.sbin/sysinstall/globals.c index b12dbd89c9b7..4323bd0e130b 100644 --- a/usr.sbin/sysinstall/globals.c +++ b/usr.sbin/sysinstall/globals.c @@ -47,6 +47,7 @@ Boolean RunningAsInit; /* Are we running as init? */ Boolean DialogActive; /* Is libdialog initialized? */ Boolean ColorDisplay; /* Are we on a color display? */ Boolean OnVTY; /* Are we on a VTY? */ +Boolean Restarting; /* Are we restarting sysinstall? */ Variable *VarHead; /* The head of the variable chain */ Device *mediaDevice; /* Where we're installing from */ int BootMgr; /* Which boot manager we're using */ @@ -63,6 +64,7 @@ globalsInit(void) DebugFD = -1; ColorDisplay = FALSE; Fake = FALSE; + Restarting = FALSE; OnVTY = FALSE; DialogActive = FALSE; VarHead = NULL; diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c index 4f4c2237e1ca..208f4ef488f1 100644 --- a/usr.sbin/sysinstall/install.c +++ b/usr.sbin/sysinstall/install.c @@ -225,7 +225,7 @@ installInitial(void) return DITEM_FAILURE; } - if (chroot("/mnt") == -1) { + if (!Restarting && chroot("/mnt") == -1) { msgConfirm("installInitial: Unable to chroot to %s - this is bad!", "/mnt"); return DITEM_FAILURE; diff --git a/usr.sbin/sysinstall/main.c b/usr.sbin/sysinstall/main.c index a5620298206b..db56dc0c56d7 100644 --- a/usr.sbin/sysinstall/main.c +++ b/usr.sbin/sysinstall/main.c @@ -91,6 +91,8 @@ main(int argc, char **argv) Fake = TRUE; msgConfirm("I'll be just faking it from here on out, OK?"); } + if (argc > 1 && !strcmp(argv[1], "-restart")) + Restarting = TRUE; /* Try to preserve our scroll-back buffer */ if (OnVTY) { @@ -129,7 +131,7 @@ main(int argc, char **argv) if (!strstr(argv[0], "sysinstall")) start_arg = 0; - else if (Fake) + else if (Fake || Restarting) start_arg = 2; else start_arg = 1; diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index fb764b84ab6e..f143b38b779e 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -346,6 +346,7 @@ typedef struct _devPriv { extern jmp_buf BailOut; /* Used to get the heck out */ extern int DebugFD; /* Where diagnostic output goes */ extern Boolean Fake; /* Don't actually modify anything - testing */ +extern Boolean Restarting; /* Are we restarting sysinstall? */ extern Boolean SystemWasInstalled; /* Did we install it? */ extern Boolean RunningAsInit; /* Are we running stand-alone? */ extern Boolean DialogActive; /* Is the dialog() stuff up? */ diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c index deb9e9f90812..7cbb12fe0425 100644 --- a/usr.sbin/sysinstall/system.c +++ b/usr.sbin/sysinstall/system.c @@ -63,7 +63,7 @@ intr_restart(dialogMenuItem *self) fdmax = getdtablesize(); for (fd = 3; fd < fdmax; fd++) close(fd); - ret = execl(StartName, StartName, (char *)NULL); + ret = execl(StartName, StartName, "-restart", (char *)NULL); msgDebug("execl failed (%s)\n", strerror(errno)); /* NOTREACHED */ return -1;