summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1997-01-24 19:24:51 +0000
committerjkh <jkh@FreeBSD.org>1997-01-24 19:24:51 +0000
commitea4f82e353a9946587bb951abdf055807de19e85 (patch)
treedd1c8a0c2facff37bca8e7cce5cbf8da441b17ba
parent04cbebd0add1fa8f9192b002813594194b3b35e8 (diff)
downloadFreeBSD-src-ea4f82e353a9946587bb951abdf055807de19e85.zip
FreeBSD-src-ea4f82e353a9946587bb951abdf055807de19e85.tar.gz
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).
-rw-r--r--release/sysinstall/cdrom.c4
-rw-r--r--release/sysinstall/dist.c59
-rw-r--r--release/sysinstall/floppy.c4
-rw-r--r--release/sysinstall/globals.c2
-rw-r--r--release/sysinstall/install.c72
-rw-r--r--release/sysinstall/media.c52
-rw-r--r--release/sysinstall/menus.c8
-rw-r--r--release/sysinstall/nfs.c6
-rw-r--r--release/sysinstall/options.c2
-rw-r--r--release/sysinstall/package.c1
-rw-r--r--release/sysinstall/sysinstall.h3
-rw-r--r--release/sysinstall/system.c26
-rw-r--r--release/sysinstall/user.c4
-rw-r--r--usr.sbin/sade/globals.c2
-rw-r--r--usr.sbin/sade/install.c72
-rw-r--r--usr.sbin/sade/menus.c8
-rw-r--r--usr.sbin/sade/sade.h3
-rw-r--r--usr.sbin/sade/system.c26
-rw-r--r--usr.sbin/sysinstall/cdrom.c4
-rw-r--r--usr.sbin/sysinstall/dist.c59
-rw-r--r--usr.sbin/sysinstall/floppy.c4
-rw-r--r--usr.sbin/sysinstall/globals.c2
-rw-r--r--usr.sbin/sysinstall/install.c72
-rw-r--r--usr.sbin/sysinstall/media.c52
-rw-r--r--usr.sbin/sysinstall/menus.c8
-rw-r--r--usr.sbin/sysinstall/nfs.c6
-rw-r--r--usr.sbin/sysinstall/options.c2
-rw-r--r--usr.sbin/sysinstall/package.c1
-rw-r--r--usr.sbin/sysinstall/sysinstall.h3
-rw-r--r--usr.sbin/sysinstall/system.c26
-rw-r--r--usr.sbin/sysinstall/user.c4
31 files changed, 196 insertions, 401 deletions
diff --git a/release/sysinstall/cdrom.c b/release/sysinstall/cdrom.c
index 5c8c285..6918ae2 100644
--- a/release/sysinstall/cdrom.c
+++ b/release/sysinstall/cdrom.c
@@ -60,7 +60,7 @@ mediaInitCDROM(Device *dev)
Attribs *cd_attr;
char *cp;
Boolean readInfo = TRUE;
- char *mountpoint = (!Chrooted && RunningAsInit) ? "/mnt/dist" : "/dist";
+ char *mountpoint = "/dist";
if (cdromMounted)
return TRUE;
@@ -148,7 +148,7 @@ mediaGetCDROM(Device *dev, char *file, Boolean probe)
void
mediaShutdownCDROM(Device *dev)
{
- char *mountpoint = (!Chrooted && RunningAsInit) ? "/mnt/dist" : "/dist";
+ char *mountpoint = "/dist";
if (!cdromMounted)
return;
diff --git a/release/sysinstall/dist.c b/release/sysinstall/dist.c
index cded28c..f1c56b6 100644
--- a/release/sysinstall/dist.c
+++ b/release/sysinstall/dist.c
@@ -340,20 +340,30 @@ distSetXF86(dialogMenuItem *self)
return i | DITEM_RECREATE;
}
+static Boolean got_intr = FALSE;
+
/* timeout handler */
static void
-media_timeout(int sig)
+handle_intr(int sig)
{
- if (sig != SIGINT)
- msgDebug("A media timeout occurred.\n");
- else
- msgDebug("User generated interrupt.\n");
+ msgDebug("User generated interrupt.\n");
+ got_intr = TRUE;
+}
+
+static int
+check_for_interrupt(void)
+{
+ if (got_intr) {
+ got_intr = FALSE;
+ return TRUE;
+ }
+ return FALSE;
}
static Boolean
distExtract(char *parent, Distribution *me)
{
- int i, status, total, resid;
+ int i, status, total, intr;
int cpid, zpid, fd2, chunk, numchunks;
char *path, *dist, buf[BUFSIZ];
const char *tmp;
@@ -369,7 +379,7 @@ distExtract(char *parent, Distribution *me)
msgDebug("distExtract: parent: %s, me: %s\n", parent ? parent : "(none)", me->my_name);
/* Make ^C fake a sudden timeout */
- new.sa_handler = media_timeout;
+ new.sa_handler = handle_intr;
new.sa_flags = 0;
new.sa_mask = 0;
sigaction(SIGINT, &new, &old);
@@ -405,9 +415,8 @@ distExtract(char *parent, Distribution *me)
snprintf(buf, sizeof buf, "%s/%s.inf", path, dist);
getinfo:
- alarm_set(mediaTimeout(), media_timeout);
fp = mediaDevice->get(mediaDevice, buf, TRUE);
- resid = alarm_clear();
+ intr = check_for_interrupt();
if (fp > 0) {
int status;
@@ -415,13 +424,12 @@ distExtract(char *parent, Distribution *me)
msgDebug("Parsing attributes file for distribution %s\n", dist);
dist_attr = alloca(sizeof(Attribs) * MAX_ATTRIBS);
- alarm_set(mediaTimeout(), media_timeout);
status = attr_parse(dist_attr, fp);
- resid = alarm_clear();
- if (!resid || DITEM_STATUS(status) == DITEM_FAILURE)
+ intr = check_for_interrupt();
+ if (intr || DITEM_STATUS(status) == DITEM_FAILURE)
msgConfirm("Cannot parse information file for the %s distribution: %s\n"
"Please verify that your media is valid and try again.",
- dist, resid ? "I/O error" : "Timeout or user interrupt");
+ dist, !intr ? "I/O error" : "User interrupt");
else {
tmp = attr_match(dist_attr, "pieces");
if (tmp)
@@ -431,9 +439,9 @@ distExtract(char *parent, Distribution *me)
if (!numchunks)
continue;
}
- else if (fp == (FILE *)IO_ERROR || !resid) { /* Hard error, can't continue */
+ else if (fp == (FILE *)IO_ERROR || intr) { /* Hard error, can't continue */
msgConfirm("Unable to open %s: %s.\nReinitializing media.",
- buf, resid ? "I/O error." : "Timeout or user interrupt.");
+ buf, !intr ? "I/O error." : "User interrupt.");
mediaDevice->shutdown(mediaDevice);
if (!mediaDevice->init(mediaDevice)) {
status = FALSE;
@@ -450,9 +458,8 @@ distExtract(char *parent, Distribution *me)
* are not considered too significant.
*/
getsingle:
- alarm_set(mediaTimeout(), media_timeout);
fp = mediaDevice->get(mediaDevice, buf, TRUE);
- resid = alarm_clear();
+ intr = check_for_interrupt();
if (fp > 0) {
char *dir = root_bias(me[i].my_dir);
@@ -461,9 +468,9 @@ distExtract(char *parent, Distribution *me)
fclose(fp);
goto done;
}
- else if (fp == (FILE *)IO_ERROR || !resid) { /* Hard error, can't continue */
- if (!resid) /* result of a timeout */
- msgConfirm("Unable to open %s: Timeout or user interrupt", buf);
+ else if (fp == (FILE *)IO_ERROR || intr) { /* Hard error, can't continue */
+ if (intr) /* result of an interrupt */
+ msgConfirm("Unable to open %s: User interrupt", buf);
else
msgConfirm("Unable to open %s: I/O error", buf);
mediaDevice->shutdown(mediaDevice);
@@ -502,15 +509,14 @@ distExtract(char *parent, Distribution *me)
snprintf(buf, sizeof buf, "%s/%s.%c%c", path, dist, (chunk / 26) + 'a', (chunk % 26) + 'a');
if (isDebug())
msgDebug("trying for piece %d of %d: %s\n", chunk + 1, numchunks, buf);
- alarm_set(mediaTimeout(), media_timeout);
fp = mediaDevice->get(mediaDevice, buf, FALSE);
- resid = alarm_clear();
- if (fp <= (FILE *)0 || !resid) {
+ intr = check_for_interrupt();
+ if (fp <= (FILE *)0 || intr) {
if (fp == (FILE *)0)
msgConfirm("Failed to find %s on this media. Reinitializing media.", buf);
else
msgConfirm("failed to retreive piece file %s.\n"
- "%s: Reinitializing media.", buf, resid ? "I/O error" : "Timeout or user interrupt");
+ "%s: Reinitializing media.", buf, !intr ? "I/O error" : "User interrupt");
mediaDevice->shutdown(mediaDevice);
if (!mediaDevice->init(mediaDevice))
goto punt;
@@ -524,10 +530,9 @@ distExtract(char *parent, Distribution *me)
while (1) {
int seconds;
- alarm_set(mediaTimeout(), media_timeout);
n = fread(buf, 1, BUFSIZ, fp);
- if (!alarm_clear()) {
- msgConfirm("Media read error: Timeout or user abort.");
+ if (check_for_interrupt()) {
+ msgConfirm("Media read error: User interrupt.");
fclose(fp);
goto punt;
}
diff --git a/release/sysinstall/floppy.c b/release/sysinstall/floppy.c
index e29d376..9e77cf6 100644
--- a/release/sysinstall/floppy.c
+++ b/release/sysinstall/floppy.c
@@ -117,7 +117,7 @@ mediaInitFloppy(Device *dev)
{
struct msdosfs_args dosargs;
struct ufs_args u_args;
- char *mountpoint = (!Chrooted && RunningAsInit) ? "/mnt/dist" : "/dist";
+ char *mountpoint = "/dist";
if (floppyMounted)
return TRUE;
@@ -188,7 +188,7 @@ mediaGetFloppy(Device *dev, char *file, Boolean probe)
void
mediaShutdownFloppy(Device *dev)
{
- char *mountpoint = (!Chrooted && RunningAsInit) ? "/mnt/dist" : "/dist";
+ char *mountpoint = "/dist";
if (floppyMounted) {
if (unmount(mountpoint, MNT_FORCE) != 0)
diff --git a/release/sysinstall/globals.c b/release/sysinstall/globals.c
index afe55b3..5b4010d 100644
--- a/release/sysinstall/globals.c
+++ b/release/sysinstall/globals.c
@@ -44,7 +44,6 @@
int DebugFD; /* Where diagnostic output goes */
Boolean Fake; /* Only pretend to be useful */
Boolean RunningAsInit; /* Are we running as init? */
-Boolean Chrooted; /* Yow, have we chrooted yet? */
Boolean DialogActive; /* Is libdialog initialized? */
Boolean ColorDisplay; /* Are we on a color display? */
Boolean OnVTY; /* Are we on a VTY? */
@@ -68,5 +67,4 @@ globalsInit(void)
VarHead = NULL;
mediaDevice = NULL;
RunningAsInit = FALSE;
- Chrooted = FALSE;
}
diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c
index c42b084..a567f8b 100644
--- a/release/sysinstall/install.c
+++ b/release/sysinstall/install.c
@@ -227,7 +227,7 @@ installInitial(void)
}
if (chroot("/mnt") == -1) {
- msgConfirm("Unable to chroot to /mnt - this is bad!");
+ msgConfirm("Unable to chroot to %s - this is bad!", "/mnt");
return DITEM_FAILURE;
}
@@ -441,21 +441,6 @@ installExpress(dialogMenuItem *self)
if (DITEM_STATUS((i = diskLabelEditor(self))) == DITEM_FAILURE)
return i;
- if (!Dists) {
- dialog_clear_norefresh();
- if (!dmenuOpenSimple(&MenuDistributions, FALSE) || !Dists)
- return DITEM_FAILURE | DITEM_RESTORE;
- }
-
- if (!mediaDevice) {
- dialog_clear_norefresh();
- if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice)
- return DITEM_FAILURE | DITEM_RESTORE;
- }
-
- if (!mediaDevice->init(mediaDevice))
- return DITEM_FAILURE | DITEM_REDRAW;
-
if (DITEM_STATUS((i = installCommit(self))) == DITEM_SUCCESS) {
i |= DITEM_LEAVE_MENU;
/* Give user the option of one last configuration spree */
@@ -495,24 +480,6 @@ installNovice(dialogMenuItem *self)
if (DITEM_STATUS(diskLabelEditor(self)) == DITEM_FAILURE)
return DITEM_FAILURE;
- while (1) {
- dialog_clear_norefresh();
- if (!dmenuOpenSimple(&MenuDistributions, FALSE))
- return DITEM_FAILURE | DITEM_RESTORE;
-
- if (Dists)
- break;
-
- if (msgYesNo("No distributions selected. Revisit the distributions menu?"))
- return DITEM_FAILURE | DITEM_RESTORE;
- }
-
- if (!mediaDevice && (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice))
- return DITEM_FAILURE | DITEM_RESTORE;
-
- if (!mediaDevice->init(mediaDevice))
- return DITEM_FAILURE | DITEM_RESTORE;
-
if (DITEM_STATUS((i = installCommit(self))) == DITEM_FAILURE) {
dialog_clear_norefresh();
msgConfirm("Installation completed with some errors. You may wish to\n"
@@ -673,32 +640,12 @@ installCommit(dialogMenuItem *self)
Boolean need_bin;
if (!Dists) {
- if (!msgYesNo("No distributions are selected for installation! Do you\n"
- "want to do this now?")) {
- if (!dmenuOpenSimple(&MenuDistributions, FALSE) && !Dists)
- return DITEM_FAILURE | DITEM_RESTORE;
- }
- else
+ if (!dmenuOpenSimple(&MenuDistributions, FALSE) && !Dists)
return DITEM_FAILURE | DITEM_RESTORE;
}
if (!mediaDevice) {
- if (!msgYesNo("You need to select a media type first. Do you want\n"
- "to do this now?")) {
- if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice)
- return DITEM_FAILURE | DITEM_RESTORE;
- }
- else
- return DITEM_FAILURE | DITEM_RESTORE;
- }
-
- if (!mediaDevice->init(mediaDevice)) {
- if (!msgYesNo("Unable to initialize selected media. Would you like to\n"
- "adjust your media configuration?")) {
- if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice)
- return DITEM_FAILURE | DITEM_RESTORE;
- }
- else
+ if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice)
return DITEM_FAILURE | DITEM_RESTORE;
}
@@ -714,6 +661,19 @@ installCommit(dialogMenuItem *self)
return i;
}
+try_media:
+ if (!mediaDevice->init(mediaDevice)) {
+ if (!msgYesNo("Unable to initialize selected media. Would you like to\n"
+ "adjust your media configuration and try again?")) {
+ if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice)
+ return DITEM_FAILURE | DITEM_RESTORE;
+ else
+ goto try_media;
+ }
+ else
+ return DITEM_FAILURE | DITEM_RESTORE;
+ }
+
need_bin = Dists & DIST_BIN;
i = distExtractAll(self);
if (DITEM_STATUS(i) == DITEM_SUCCESS) {
diff --git a/release/sysinstall/media.c b/release/sysinstall/media.c
index 64a0d48..af7ab98 100644
--- a/release/sysinstall/media.c
+++ b/release/sysinstall/media.c
@@ -47,6 +47,26 @@
#include <netinet/in.h>
#include <arpa/inet.h>
+static Boolean got_intr = FALSE;
+
+/* timeout handler */
+static void
+handle_intr(int sig)
+{
+ msgDebug("User generated interrupt.\n");
+ got_intr = TRUE;
+}
+
+static int
+check_for_interrupt(void)
+{
+ if (got_intr) {
+ got_intr = FALSE;
+ return TRUE;
+ }
+ return FALSE;
+}
+
static int
genericHook(dialogMenuItem *self, DeviceType type)
{
@@ -518,25 +538,6 @@ mediaExtractDistEnd(int zpid, int cpid)
return TRUE;
}
-static void
-media_timeout(int sig)
-{
- alarm(0);
-}
-
-/* Return the timeout interval */
-int
-mediaTimeout(void)
-{
- char *cp;
- int t;
-
- cp = getenv(VAR_MEDIA_TIMEOUT);
- if (!cp || !(t = atoi(cp)))
- t = MEDIA_TIMEOUT;
- return t;
-}
-
Boolean
mediaExtractDist(char *dir, char *dist, FILE *fp)
{
@@ -604,20 +605,19 @@ mediaExtractDist(char *dir, char *dist, FILE *fp)
total = 0;
(void)gettimeofday(&start, (struct timezone *)0);
- /* Make ^C fake a sudden timeout */
- new.sa_handler = media_timeout;
+ /* Make ^C abort the current transfer rather than the whole show */
+ new.sa_handler = handle_intr;
new.sa_flags = 0;
new.sa_mask = 0;
sigaction(SIGINT, &new, &old);
- alarm_set(mediaTimeout(), media_timeout);
while ((i = fread(buf, 1, BUFSIZ, fp)) > 0) {
- if (!alarm_clear()) {
- msgConfirm("Failure to read from media - timeout or user abort.\n");
+ if (check_for_interrupt()) {
+ msgConfirm("Failure to read from media: User interrupt.");
break;
}
if (write(qfd[1], buf, i) != i) {
- msgConfirm("Write error on transfer to cpio process, try of %d bytes\n", i);
+ msgConfirm("Write error on transfer to cpio process, try of %d bytes.", i);
break;
}
else {
@@ -633,9 +633,7 @@ mediaExtractDist(char *dir, char *dist, FILE *fp)
msgInfo("%10d bytes read from %s dist @ %.1f KB/sec.",
total, dist, (total / seconds) / 1024.0);
}
- alarm_set(mediaTimeout(), media_timeout);
}
- alarm_clear();
sigaction(SIGINT, &old, NULL); /* restore sigint */
close(qfd[1]);
diff --git a/release/sysinstall/menus.c b/release/sysinstall/menus.c
index 64938ba..4d85fae 100644
--- a/release/sysinstall/menus.c
+++ b/release/sysinstall/menus.c
@@ -330,10 +330,14 @@ whichMouse(dialogMenuItem *self)
{
char buf[BUFSIZ];
- if (!file_readable("/dev/mouse"))
+ if (!file_readable("/dev/mouse")) {
+ msgDebug("No /dev/mouse device!\n");
return FALSE;
- if (readlink("/dev/mouse", buf, sizeof buf) == -1)
+ }
+ if (readlink("/dev/mouse", buf, sizeof buf) == -1) {
+ msgDebug("Can't read /dev/mouse symlink!\n");
return FALSE;
+ }
if (isDebug)
msgDebug("The evil link value is `%s'\n", buf);
if (!strcmp(self->prompt, "COM1"))
diff --git a/release/sysinstall/nfs.c b/release/sysinstall/nfs.c
index 38b2e05..4e4be22 100644
--- a/release/sysinstall/nfs.c
+++ b/release/sysinstall/nfs.c
@@ -46,7 +46,7 @@ Boolean NFSMounted;
Boolean
mediaInitNFS(Device *dev)
{
- char *mountpoint = (!Chrooted && RunningAsInit) ? "/mnt/dist" : "/dist";
+ char *mountpoint = "/dist";
Device *netDevice = (Device *)dev->private;
if (NFSMounted)
@@ -58,7 +58,7 @@ mediaInitNFS(Device *dev)
if (Mkdir(mountpoint))
return FALSE;
- msgNotify("Mounting %s over NFS.", dev->name);
+ msgNotify("Mounting %s over NFS on %s", dev->name, mountpoint);
if (vsystem("mount_nfs %s %s %s %s",
variable_get(VAR_SLOW_ETHER) ? "-r 1024 -w 1024" : "",
variable_get(VAR_NFS_SECURE) ? "-P" : "", dev->name, mountpoint)) {
@@ -96,7 +96,7 @@ void
mediaShutdownNFS(Device *dev)
{
/* Device *netdev = (Device *)dev->private; */
- char *mountpoint = (!Chrooted && RunningAsInit) ? "/mnt/dist" : "/dist";
+ char *mountpoint = "/dist";
if (!NFSMounted)
return;
diff --git a/release/sysinstall/options.c b/release/sysinstall/options.c
index 284bc0e..fb05a5f 100644
--- a/release/sysinstall/options.c
+++ b/release/sysinstall/options.c
@@ -127,7 +127,7 @@ static Option Options[] = {
OPT_IS_VAR, RELNAME_PROMPT, VAR_RELNAME, varCheck },
{ "Install Root", "Which directory to unpack distributions or packages relative to",
OPT_IS_VAR, INSTROOT_PROMPT, VAR_INSTALL_ROOT, varCheck },
-{ "Browser Pkg", "This is the browser package that will be used for viewing HTML docs",
+{ "Browser package", "This is the browser package that will be used for viewing HTML docs",
OPT_IS_VAR, BPKG_PROMPT, VAR_BROWSER_PACKAGE, varCheck },
{ "Browser Exec", "This is the path to the main binary of the browser package",
OPT_IS_VAR, BBIN_PROMPT, VAR_BROWSER_BINARY, varCheck },
diff --git a/release/sysinstall/package.c b/release/sysinstall/package.c
index 1ab16f2..0ae2d50 100644
--- a/release/sysinstall/package.c
+++ b/release/sysinstall/package.c
@@ -125,7 +125,6 @@ package_extract(Device *dev, char *name, Boolean depended)
dup2(DebugFD, 1);
close(2);
close(pfd[1]);
- chroot(variable_get(VAR_INSTALL_ROOT));
i = execl("/usr/sbin/pkg_add", "/usr/sbin/pkg_add", "-", 0);
if (isDebug())
msgDebug("pkg_add returns %d status\n", i);
diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h
index 59a81a8..60bd8bd 100644
--- a/release/sysinstall/sysinstall.h
+++ b/release/sysinstall/sysinstall.h
@@ -313,7 +313,6 @@ extern int DebugFD; /* Where diagnostic output goes */
extern Boolean Fake; /* Don't actually modify anything - testing */
extern Boolean SystemWasInstalled; /* Did we install it? */
extern Boolean RunningAsInit; /* Are we running stand-alone? */
-extern Boolean Chrooted; /* Are we chroot()ed? */
extern Boolean DialogActive; /* Is the dialog() stuff up? */
extern Boolean ColorDisplay; /* Are we on a color display? */
extern Boolean OnVTY; /* On a syscons VTY? */
@@ -637,8 +636,6 @@ extern int package_extract(Device *dev, char *name, Boolean depended);
extern Boolean package_exists(char *name);
/* system.c */
-extern int alarm_clear(void);
-extern void alarm_set(int delay, void (*handler)(int sig));
extern void systemInitialize(int argc, char **argv);
extern void systemShutdown(int status);
extern int execExecute(char *cmd, char *name);
diff --git a/release/sysinstall/system.c b/release/sysinstall/system.c
index 0854cca..354f805 100644
--- a/release/sysinstall/system.c
+++ b/release/sysinstall/system.c
@@ -47,32 +47,6 @@ handle_intr(int sig)
restorescr(save);
}
-/* Simple alarm interface */
-void
-alarm_set(int delay, void (*handler)(int sig))
-{
- struct sigaction act;
-
- act.sa_handler = handler;
- act.sa_flags = 0;
- act.sa_mask = 0;
- sigaction(SIGALRM, &act, NULL);
- alarm(delay);
-}
-
-int
-alarm_clear(void)
-{
- struct sigaction act;
- int i = alarm(0);
-
- act.sa_handler = SIG_DFL;
- act.sa_flags = 0;
- act.sa_mask = 0;
- sigaction(SIGALRM, &act, NULL);
- return i;
-}
-
/* Expand a file into a convenient location, nuking it each time */
static char *
expand(char *fname)
diff --git a/release/sysinstall/user.c b/release/sysinstall/user.c
index 1c17750..6c42ecc 100644
--- a/release/sysinstall/user.c
+++ b/release/sysinstall/user.c
@@ -225,7 +225,6 @@ completeGroup(void)
for (i = getdtablesize(); i > 2; i--)
close(i);
- chroot(variable_get(VAR_INSTALL_ROOT));
execv("/usr/sbin/pw", vec);
msgDebug("Cannot execv() /usr/sbin/pw.\n");
_exit(99);
@@ -291,7 +290,6 @@ addGroup(WINDOW *ds_win)
else
vec[VEC_GID - 1] = 0;
- chroot(variable_get(VAR_INSTALL_ROOT));
execv("/usr/sbin/pw", vec);
msgDebug("Cannot execv() /usr/sbin/pw.\n");
_exit(99);
@@ -482,7 +480,6 @@ completeUser(void)
vec[VEC_UNAME] = uname;
- chroot(variable_get(VAR_INSTALL_ROOT));
execv("/usr/sbin/pw", vec);
msgDebug("Cannot execv() /usr/sbin/pw.\n");
_exit(99);
@@ -589,7 +586,6 @@ addUser(WINDOW *ds_win)
}
vec[i] = 0;
- chroot(variable_get(VAR_INSTALL_ROOT));
execv("/usr/sbin/pw", vec);
msgDebug("Cannot execv() /usr/sbin/pw.\n");
_exit(99);
diff --git a/usr.sbin/sade/globals.c b/usr.sbin/sade/globals.c
index afe55b3..5b4010d 100644
--- a/usr.sbin/sade/globals.c
+++ b/usr.sbin/sade/globals.c
@@ -44,7 +44,6 @@
int DebugFD; /* Where diagnostic output goes */
Boolean Fake; /* Only pretend to be useful */
Boolean RunningAsInit; /* Are we running as init? */
-Boolean Chrooted; /* Yow, have we chrooted yet? */
Boolean DialogActive; /* Is libdialog initialized? */
Boolean ColorDisplay; /* Are we on a color display? */
Boolean OnVTY; /* Are we on a VTY? */
@@ -68,5 +67,4 @@ globalsInit(void)
VarHead = NULL;
mediaDevice = NULL;
RunningAsInit = FALSE;
- Chrooted = FALSE;
}
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
index c42b084..a567f8b 100644
--- a/usr.sbin/sade/install.c
+++ b/usr.sbin/sade/install.c
@@ -227,7 +227,7 @@ installInitial(void)
}
if (chroot("/mnt") == -1) {
- msgConfirm("Unable to chroot to /mnt - this is bad!");
+ msgConfirm("Unable to chroot to %s - this is bad!", "/mnt");
return DITEM_FAILURE;
}
@@ -441,21 +441,6 @@ installExpress(dialogMenuItem *self)
if (DITEM_STATUS((i = diskLabelEditor(self))) == DITEM_FAILURE)
return i;
- if (!Dists) {
- dialog_clear_norefresh();
- if (!dmenuOpenSimple(&MenuDistributions, FALSE) || !Dists)
- return DITEM_FAILURE | DITEM_RESTORE;
- }
-
- if (!mediaDevice) {
- dialog_clear_norefresh();
- if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice)
- return DITEM_FAILURE | DITEM_RESTORE;
- }
-
- if (!mediaDevice->init(mediaDevice))
- return DITEM_FAILURE | DITEM_REDRAW;
-
if (DITEM_STATUS((i = installCommit(self))) == DITEM_SUCCESS) {
i |= DITEM_LEAVE_MENU;
/* Give user the option of one last configuration spree */
@@ -495,24 +480,6 @@ installNovice(dialogMenuItem *self)
if (DITEM_STATUS(diskLabelEditor(self)) == DITEM_FAILURE)
return DITEM_FAILURE;
- while (1) {
- dialog_clear_norefresh();
- if (!dmenuOpenSimple(&MenuDistributions, FALSE))
- return DITEM_FAILURE | DITEM_RESTORE;
-
- if (Dists)
- break;
-
- if (msgYesNo("No distributions selected. Revisit the distributions menu?"))
- return DITEM_FAILURE | DITEM_RESTORE;
- }
-
- if (!mediaDevice && (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice))
- return DITEM_FAILURE | DITEM_RESTORE;
-
- if (!mediaDevice->init(mediaDevice))
- return DITEM_FAILURE | DITEM_RESTORE;
-
if (DITEM_STATUS((i = installCommit(self))) == DITEM_FAILURE) {
dialog_clear_norefresh();
msgConfirm("Installation completed with some errors. You may wish to\n"
@@ -673,32 +640,12 @@ installCommit(dialogMenuItem *self)
Boolean need_bin;
if (!Dists) {
- if (!msgYesNo("No distributions are selected for installation! Do you\n"
- "want to do this now?")) {
- if (!dmenuOpenSimple(&MenuDistributions, FALSE) && !Dists)
- return DITEM_FAILURE | DITEM_RESTORE;
- }
- else
+ if (!dmenuOpenSimple(&MenuDistributions, FALSE) && !Dists)
return DITEM_FAILURE | DITEM_RESTORE;
}
if (!mediaDevice) {
- if (!msgYesNo("You need to select a media type first. Do you want\n"
- "to do this now?")) {
- if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice)
- return DITEM_FAILURE | DITEM_RESTORE;
- }
- else
- return DITEM_FAILURE | DITEM_RESTORE;
- }
-
- if (!mediaDevice->init(mediaDevice)) {
- if (!msgYesNo("Unable to initialize selected media. Would you like to\n"
- "adjust your media configuration?")) {
- if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice)
- return DITEM_FAILURE | DITEM_RESTORE;
- }
- else
+ if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice)
return DITEM_FAILURE | DITEM_RESTORE;
}
@@ -714,6 +661,19 @@ installCommit(dialogMenuItem *self)
return i;
}
+try_media:
+ if (!mediaDevice->init(mediaDevice)) {
+ if (!msgYesNo("Unable to initialize selected media. Would you like to\n"
+ "adjust your media configuration and try again?")) {
+ if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice)
+ return DITEM_FAILURE | DITEM_RESTORE;
+ else
+ goto try_media;
+ }
+ else
+ return DITEM_FAILURE | DITEM_RESTORE;
+ }
+
need_bin = Dists & DIST_BIN;
i = distExtractAll(self);
if (DITEM_STATUS(i) == DITEM_SUCCESS) {
diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c
index 64938ba..4d85fae 100644
--- a/usr.sbin/sade/menus.c
+++ b/usr.sbin/sade/menus.c
@@ -330,10 +330,14 @@ whichMouse(dialogMenuItem *self)
{
char buf[BUFSIZ];
- if (!file_readable("/dev/mouse"))
+ if (!file_readable("/dev/mouse")) {
+ msgDebug("No /dev/mouse device!\n");
return FALSE;
- if (readlink("/dev/mouse", buf, sizeof buf) == -1)
+ }
+ if (readlink("/dev/mouse", buf, sizeof buf) == -1) {
+ msgDebug("Can't read /dev/mouse symlink!\n");
return FALSE;
+ }
if (isDebug)
msgDebug("The evil link value is `%s'\n", buf);
if (!strcmp(self->prompt, "COM1"))
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index 59a81a8..60bd8bd 100644
--- a/usr.sbin/sade/sade.h
+++ b/usr.sbin/sade/sade.h
@@ -313,7 +313,6 @@ extern int DebugFD; /* Where diagnostic output goes */
extern Boolean Fake; /* Don't actually modify anything - testing */
extern Boolean SystemWasInstalled; /* Did we install it? */
extern Boolean RunningAsInit; /* Are we running stand-alone? */
-extern Boolean Chrooted; /* Are we chroot()ed? */
extern Boolean DialogActive; /* Is the dialog() stuff up? */
extern Boolean ColorDisplay; /* Are we on a color display? */
extern Boolean OnVTY; /* On a syscons VTY? */
@@ -637,8 +636,6 @@ extern int package_extract(Device *dev, char *name, Boolean depended);
extern Boolean package_exists(char *name);
/* system.c */
-extern int alarm_clear(void);
-extern void alarm_set(int delay, void (*handler)(int sig));
extern void systemInitialize(int argc, char **argv);
extern void systemShutdown(int status);
extern int execExecute(char *cmd, char *name);
diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c
index 0854cca..354f805 100644
--- a/usr.sbin/sade/system.c
+++ b/usr.sbin/sade/system.c
@@ -47,32 +47,6 @@ handle_intr(int sig)
restorescr(save);
}
-/* Simple alarm interface */
-void
-alarm_set(int delay, void (*handler)(int sig))
-{
- struct sigaction act;
-
- act.sa_handler = handler;
- act.sa_flags = 0;
- act.sa_mask = 0;
- sigaction(SIGALRM, &act, NULL);
- alarm(delay);
-}
-
-int
-alarm_clear(void)
-{
- struct sigaction act;
- int i = alarm(0);
-
- act.sa_handler = SIG_DFL;
- act.sa_flags = 0;
- act.sa_mask = 0;
- sigaction(SIGALRM, &act, NULL);
- return i;
-}
-
/* Expand a file into a convenient location, nuking it each time */
static char *
expand(char *fname)
diff --git a/usr.sbin/sysinstall/cdrom.c b/usr.sbin/sysinstall/cdrom.c
index 5c8c285..6918ae2 100644
--- a/usr.sbin/sysinstall/cdrom.c
+++ b/usr.sbin/sysinstall/cdrom.c
@@ -60,7 +60,7 @@ mediaInitCDROM(Device *dev)
Attribs *cd_attr;
char *cp;
Boolean readInfo = TRUE;
- char *mountpoint = (!Chrooted && RunningAsInit) ? "/mnt/dist" : "/dist";
+ char *mountpoint = "/dist";
if (cdromMounted)
return TRUE;
@@ -148,7 +148,7 @@ mediaGetCDROM(Device *dev, char *file, Boolean probe)
void
mediaShutdownCDROM(Device *dev)
{
- char *mountpoint = (!Chrooted && RunningAsInit) ? "/mnt/dist" : "/dist";
+ char *mountpoint = "/dist";
if (!cdromMounted)
return;
diff --git a/usr.sbin/sysinstall/dist.c b/usr.sbin/sysinstall/dist.c
index cded28c..f1c56b6 100644
--- a/usr.sbin/sysinstall/dist.c
+++ b/usr.sbin/sysinstall/dist.c
@@ -340,20 +340,30 @@ distSetXF86(dialogMenuItem *self)
return i | DITEM_RECREATE;
}
+static Boolean got_intr = FALSE;
+
/* timeout handler */
static void
-media_timeout(int sig)
+handle_intr(int sig)
{
- if (sig != SIGINT)
- msgDebug("A media timeout occurred.\n");
- else
- msgDebug("User generated interrupt.\n");
+ msgDebug("User generated interrupt.\n");
+ got_intr = TRUE;
+}
+
+static int
+check_for_interrupt(void)
+{
+ if (got_intr) {
+ got_intr = FALSE;
+ return TRUE;
+ }
+ return FALSE;
}
static Boolean
distExtract(char *parent, Distribution *me)
{
- int i, status, total, resid;
+ int i, status, total, intr;
int cpid, zpid, fd2, chunk, numchunks;
char *path, *dist, buf[BUFSIZ];
const char *tmp;
@@ -369,7 +379,7 @@ distExtract(char *parent, Distribution *me)
msgDebug("distExtract: parent: %s, me: %s\n", parent ? parent : "(none)", me->my_name);
/* Make ^C fake a sudden timeout */
- new.sa_handler = media_timeout;
+ new.sa_handler = handle_intr;
new.sa_flags = 0;
new.sa_mask = 0;
sigaction(SIGINT, &new, &old);
@@ -405,9 +415,8 @@ distExtract(char *parent, Distribution *me)
snprintf(buf, sizeof buf, "%s/%s.inf", path, dist);
getinfo:
- alarm_set(mediaTimeout(), media_timeout);
fp = mediaDevice->get(mediaDevice, buf, TRUE);
- resid = alarm_clear();
+ intr = check_for_interrupt();
if (fp > 0) {
int status;
@@ -415,13 +424,12 @@ distExtract(char *parent, Distribution *me)
msgDebug("Parsing attributes file for distribution %s\n", dist);
dist_attr = alloca(sizeof(Attribs) * MAX_ATTRIBS);
- alarm_set(mediaTimeout(), media_timeout);
status = attr_parse(dist_attr, fp);
- resid = alarm_clear();
- if (!resid || DITEM_STATUS(status) == DITEM_FAILURE)
+ intr = check_for_interrupt();
+ if (intr || DITEM_STATUS(status) == DITEM_FAILURE)
msgConfirm("Cannot parse information file for the %s distribution: %s\n"
"Please verify that your media is valid and try again.",
- dist, resid ? "I/O error" : "Timeout or user interrupt");
+ dist, !intr ? "I/O error" : "User interrupt");
else {
tmp = attr_match(dist_attr, "pieces");
if (tmp)
@@ -431,9 +439,9 @@ distExtract(char *parent, Distribution *me)
if (!numchunks)
continue;
}
- else if (fp == (FILE *)IO_ERROR || !resid) { /* Hard error, can't continue */
+ else if (fp == (FILE *)IO_ERROR || intr) { /* Hard error, can't continue */
msgConfirm("Unable to open %s: %s.\nReinitializing media.",
- buf, resid ? "I/O error." : "Timeout or user interrupt.");
+ buf, !intr ? "I/O error." : "User interrupt.");
mediaDevice->shutdown(mediaDevice);
if (!mediaDevice->init(mediaDevice)) {
status = FALSE;
@@ -450,9 +458,8 @@ distExtract(char *parent, Distribution *me)
* are not considered too significant.
*/
getsingle:
- alarm_set(mediaTimeout(), media_timeout);
fp = mediaDevice->get(mediaDevice, buf, TRUE);
- resid = alarm_clear();
+ intr = check_for_interrupt();
if (fp > 0) {
char *dir = root_bias(me[i].my_dir);
@@ -461,9 +468,9 @@ distExtract(char *parent, Distribution *me)
fclose(fp);
goto done;
}
- else if (fp == (FILE *)IO_ERROR || !resid) { /* Hard error, can't continue */
- if (!resid) /* result of a timeout */
- msgConfirm("Unable to open %s: Timeout or user interrupt", buf);
+ else if (fp == (FILE *)IO_ERROR || intr) { /* Hard error, can't continue */
+ if (intr) /* result of an interrupt */
+ msgConfirm("Unable to open %s: User interrupt", buf);
else
msgConfirm("Unable to open %s: I/O error", buf);
mediaDevice->shutdown(mediaDevice);
@@ -502,15 +509,14 @@ distExtract(char *parent, Distribution *me)
snprintf(buf, sizeof buf, "%s/%s.%c%c", path, dist, (chunk / 26) + 'a', (chunk % 26) + 'a');
if (isDebug())
msgDebug("trying for piece %d of %d: %s\n", chunk + 1, numchunks, buf);
- alarm_set(mediaTimeout(), media_timeout);
fp = mediaDevice->get(mediaDevice, buf, FALSE);
- resid = alarm_clear();
- if (fp <= (FILE *)0 || !resid) {
+ intr = check_for_interrupt();
+ if (fp <= (FILE *)0 || intr) {
if (fp == (FILE *)0)
msgConfirm("Failed to find %s on this media. Reinitializing media.", buf);
else
msgConfirm("failed to retreive piece file %s.\n"
- "%s: Reinitializing media.", buf, resid ? "I/O error" : "Timeout or user interrupt");
+ "%s: Reinitializing media.", buf, !intr ? "I/O error" : "User interrupt");
mediaDevice->shutdown(mediaDevice);
if (!mediaDevice->init(mediaDevice))
goto punt;
@@ -524,10 +530,9 @@ distExtract(char *parent, Distribution *me)
while (1) {
int seconds;
- alarm_set(mediaTimeout(), media_timeout);
n = fread(buf, 1, BUFSIZ, fp);
- if (!alarm_clear()) {
- msgConfirm("Media read error: Timeout or user abort.");
+ if (check_for_interrupt()) {
+ msgConfirm("Media read error: User interrupt.");
fclose(fp);
goto punt;
}
diff --git a/usr.sbin/sysinstall/floppy.c b/usr.sbin/sysinstall/floppy.c
index e29d376..9e77cf6 100644
--- a/usr.sbin/sysinstall/floppy.c
+++ b/usr.sbin/sysinstall/floppy.c
@@ -117,7 +117,7 @@ mediaInitFloppy(Device *dev)
{
struct msdosfs_args dosargs;
struct ufs_args u_args;
- char *mountpoint = (!Chrooted && RunningAsInit) ? "/mnt/dist" : "/dist";
+ char *mountpoint = "/dist";
if (floppyMounted)
return TRUE;
@@ -188,7 +188,7 @@ mediaGetFloppy(Device *dev, char *file, Boolean probe)
void
mediaShutdownFloppy(Device *dev)
{
- char *mountpoint = (!Chrooted && RunningAsInit) ? "/mnt/dist" : "/dist";
+ char *mountpoint = "/dist";
if (floppyMounted) {
if (unmount(mountpoint, MNT_FORCE) != 0)
diff --git a/usr.sbin/sysinstall/globals.c b/usr.sbin/sysinstall/globals.c
index afe55b3..5b4010d 100644
--- a/usr.sbin/sysinstall/globals.c
+++ b/usr.sbin/sysinstall/globals.c
@@ -44,7 +44,6 @@
int DebugFD; /* Where diagnostic output goes */
Boolean Fake; /* Only pretend to be useful */
Boolean RunningAsInit; /* Are we running as init? */
-Boolean Chrooted; /* Yow, have we chrooted yet? */
Boolean DialogActive; /* Is libdialog initialized? */
Boolean ColorDisplay; /* Are we on a color display? */
Boolean OnVTY; /* Are we on a VTY? */
@@ -68,5 +67,4 @@ globalsInit(void)
VarHead = NULL;
mediaDevice = NULL;
RunningAsInit = FALSE;
- Chrooted = FALSE;
}
diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c
index c42b084..a567f8b 100644
--- a/usr.sbin/sysinstall/install.c
+++ b/usr.sbin/sysinstall/install.c
@@ -227,7 +227,7 @@ installInitial(void)
}
if (chroot("/mnt") == -1) {
- msgConfirm("Unable to chroot to /mnt - this is bad!");
+ msgConfirm("Unable to chroot to %s - this is bad!", "/mnt");
return DITEM_FAILURE;
}
@@ -441,21 +441,6 @@ installExpress(dialogMenuItem *self)
if (DITEM_STATUS((i = diskLabelEditor(self))) == DITEM_FAILURE)
return i;
- if (!Dists) {
- dialog_clear_norefresh();
- if (!dmenuOpenSimple(&MenuDistributions, FALSE) || !Dists)
- return DITEM_FAILURE | DITEM_RESTORE;
- }
-
- if (!mediaDevice) {
- dialog_clear_norefresh();
- if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice)
- return DITEM_FAILURE | DITEM_RESTORE;
- }
-
- if (!mediaDevice->init(mediaDevice))
- return DITEM_FAILURE | DITEM_REDRAW;
-
if (DITEM_STATUS((i = installCommit(self))) == DITEM_SUCCESS) {
i |= DITEM_LEAVE_MENU;
/* Give user the option of one last configuration spree */
@@ -495,24 +480,6 @@ installNovice(dialogMenuItem *self)
if (DITEM_STATUS(diskLabelEditor(self)) == DITEM_FAILURE)
return DITEM_FAILURE;
- while (1) {
- dialog_clear_norefresh();
- if (!dmenuOpenSimple(&MenuDistributions, FALSE))
- return DITEM_FAILURE | DITEM_RESTORE;
-
- if (Dists)
- break;
-
- if (msgYesNo("No distributions selected. Revisit the distributions menu?"))
- return DITEM_FAILURE | DITEM_RESTORE;
- }
-
- if (!mediaDevice && (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice))
- return DITEM_FAILURE | DITEM_RESTORE;
-
- if (!mediaDevice->init(mediaDevice))
- return DITEM_FAILURE | DITEM_RESTORE;
-
if (DITEM_STATUS((i = installCommit(self))) == DITEM_FAILURE) {
dialog_clear_norefresh();
msgConfirm("Installation completed with some errors. You may wish to\n"
@@ -673,32 +640,12 @@ installCommit(dialogMenuItem *self)
Boolean need_bin;
if (!Dists) {
- if (!msgYesNo("No distributions are selected for installation! Do you\n"
- "want to do this now?")) {
- if (!dmenuOpenSimple(&MenuDistributions, FALSE) && !Dists)
- return DITEM_FAILURE | DITEM_RESTORE;
- }
- else
+ if (!dmenuOpenSimple(&MenuDistributions, FALSE) && !Dists)
return DITEM_FAILURE | DITEM_RESTORE;
}
if (!mediaDevice) {
- if (!msgYesNo("You need to select a media type first. Do you want\n"
- "to do this now?")) {
- if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice)
- return DITEM_FAILURE | DITEM_RESTORE;
- }
- else
- return DITEM_FAILURE | DITEM_RESTORE;
- }
-
- if (!mediaDevice->init(mediaDevice)) {
- if (!msgYesNo("Unable to initialize selected media. Would you like to\n"
- "adjust your media configuration?")) {
- if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice)
- return DITEM_FAILURE | DITEM_RESTORE;
- }
- else
+ if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice)
return DITEM_FAILURE | DITEM_RESTORE;
}
@@ -714,6 +661,19 @@ installCommit(dialogMenuItem *self)
return i;
}
+try_media:
+ if (!mediaDevice->init(mediaDevice)) {
+ if (!msgYesNo("Unable to initialize selected media. Would you like to\n"
+ "adjust your media configuration and try again?")) {
+ if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice)
+ return DITEM_FAILURE | DITEM_RESTORE;
+ else
+ goto try_media;
+ }
+ else
+ return DITEM_FAILURE | DITEM_RESTORE;
+ }
+
need_bin = Dists & DIST_BIN;
i = distExtractAll(self);
if (DITEM_STATUS(i) == DITEM_SUCCESS) {
diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c
index 64a0d48..af7ab98 100644
--- a/usr.sbin/sysinstall/media.c
+++ b/usr.sbin/sysinstall/media.c
@@ -47,6 +47,26 @@
#include <netinet/in.h>
#include <arpa/inet.h>
+static Boolean got_intr = FALSE;
+
+/* timeout handler */
+static void
+handle_intr(int sig)
+{
+ msgDebug("User generated interrupt.\n");
+ got_intr = TRUE;
+}
+
+static int
+check_for_interrupt(void)
+{
+ if (got_intr) {
+ got_intr = FALSE;
+ return TRUE;
+ }
+ return FALSE;
+}
+
static int
genericHook(dialogMenuItem *self, DeviceType type)
{
@@ -518,25 +538,6 @@ mediaExtractDistEnd(int zpid, int cpid)
return TRUE;
}
-static void
-media_timeout(int sig)
-{
- alarm(0);
-}
-
-/* Return the timeout interval */
-int
-mediaTimeout(void)
-{
- char *cp;
- int t;
-
- cp = getenv(VAR_MEDIA_TIMEOUT);
- if (!cp || !(t = atoi(cp)))
- t = MEDIA_TIMEOUT;
- return t;
-}
-
Boolean
mediaExtractDist(char *dir, char *dist, FILE *fp)
{
@@ -604,20 +605,19 @@ mediaExtractDist(char *dir, char *dist, FILE *fp)
total = 0;
(void)gettimeofday(&start, (struct timezone *)0);
- /* Make ^C fake a sudden timeout */
- new.sa_handler = media_timeout;
+ /* Make ^C abort the current transfer rather than the whole show */
+ new.sa_handler = handle_intr;
new.sa_flags = 0;
new.sa_mask = 0;
sigaction(SIGINT, &new, &old);
- alarm_set(mediaTimeout(), media_timeout);
while ((i = fread(buf, 1, BUFSIZ, fp)) > 0) {
- if (!alarm_clear()) {
- msgConfirm("Failure to read from media - timeout or user abort.\n");
+ if (check_for_interrupt()) {
+ msgConfirm("Failure to read from media: User interrupt.");
break;
}
if (write(qfd[1], buf, i) != i) {
- msgConfirm("Write error on transfer to cpio process, try of %d bytes\n", i);
+ msgConfirm("Write error on transfer to cpio process, try of %d bytes.", i);
break;
}
else {
@@ -633,9 +633,7 @@ mediaExtractDist(char *dir, char *dist, FILE *fp)
msgInfo("%10d bytes read from %s dist @ %.1f KB/sec.",
total, dist, (total / seconds) / 1024.0);
}
- alarm_set(mediaTimeout(), media_timeout);
}
- alarm_clear();
sigaction(SIGINT, &old, NULL); /* restore sigint */
close(qfd[1]);
diff --git a/usr.sbin/sysinstall/menus.c b/usr.sbin/sysinstall/menus.c
index 64938ba..4d85fae 100644
--- a/usr.sbin/sysinstall/menus.c
+++ b/usr.sbin/sysinstall/menus.c
@@ -330,10 +330,14 @@ whichMouse(dialogMenuItem *self)
{
char buf[BUFSIZ];
- if (!file_readable("/dev/mouse"))
+ if (!file_readable("/dev/mouse")) {
+ msgDebug("No /dev/mouse device!\n");
return FALSE;
- if (readlink("/dev/mouse", buf, sizeof buf) == -1)
+ }
+ if (readlink("/dev/mouse", buf, sizeof buf) == -1) {
+ msgDebug("Can't read /dev/mouse symlink!\n");
return FALSE;
+ }
if (isDebug)
msgDebug("The evil link value is `%s'\n", buf);
if (!strcmp(self->prompt, "COM1"))
diff --git a/usr.sbin/sysinstall/nfs.c b/usr.sbin/sysinstall/nfs.c
index 38b2e05..4e4be22 100644
--- a/usr.sbin/sysinstall/nfs.c
+++ b/usr.sbin/sysinstall/nfs.c
@@ -46,7 +46,7 @@ Boolean NFSMounted;
Boolean
mediaInitNFS(Device *dev)
{
- char *mountpoint = (!Chrooted && RunningAsInit) ? "/mnt/dist" : "/dist";
+ char *mountpoint = "/dist";
Device *netDevice = (Device *)dev->private;
if (NFSMounted)
@@ -58,7 +58,7 @@ mediaInitNFS(Device *dev)
if (Mkdir(mountpoint))
return FALSE;
- msgNotify("Mounting %s over NFS.", dev->name);
+ msgNotify("Mounting %s over NFS on %s", dev->name, mountpoint);
if (vsystem("mount_nfs %s %s %s %s",
variable_get(VAR_SLOW_ETHER) ? "-r 1024 -w 1024" : "",
variable_get(VAR_NFS_SECURE) ? "-P" : "", dev->name, mountpoint)) {
@@ -96,7 +96,7 @@ void
mediaShutdownNFS(Device *dev)
{
/* Device *netdev = (Device *)dev->private; */
- char *mountpoint = (!Chrooted && RunningAsInit) ? "/mnt/dist" : "/dist";
+ char *mountpoint = "/dist";
if (!NFSMounted)
return;
diff --git a/usr.sbin/sysinstall/options.c b/usr.sbin/sysinstall/options.c
index 284bc0e..fb05a5f 100644
--- a/usr.sbin/sysinstall/options.c
+++ b/usr.sbin/sysinstall/options.c
@@ -127,7 +127,7 @@ static Option Options[] = {
OPT_IS_VAR, RELNAME_PROMPT, VAR_RELNAME, varCheck },
{ "Install Root", "Which directory to unpack distributions or packages relative to",
OPT_IS_VAR, INSTROOT_PROMPT, VAR_INSTALL_ROOT, varCheck },
-{ "Browser Pkg", "This is the browser package that will be used for viewing HTML docs",
+{ "Browser package", "This is the browser package that will be used for viewing HTML docs",
OPT_IS_VAR, BPKG_PROMPT, VAR_BROWSER_PACKAGE, varCheck },
{ "Browser Exec", "This is the path to the main binary of the browser package",
OPT_IS_VAR, BBIN_PROMPT, VAR_BROWSER_BINARY, varCheck },
diff --git a/usr.sbin/sysinstall/package.c b/usr.sbin/sysinstall/package.c
index 1ab16f2..0ae2d50 100644
--- a/usr.sbin/sysinstall/package.c
+++ b/usr.sbin/sysinstall/package.c
@@ -125,7 +125,6 @@ package_extract(Device *dev, char *name, Boolean depended)
dup2(DebugFD, 1);
close(2);
close(pfd[1]);
- chroot(variable_get(VAR_INSTALL_ROOT));
i = execl("/usr/sbin/pkg_add", "/usr/sbin/pkg_add", "-", 0);
if (isDebug())
msgDebug("pkg_add returns %d status\n", i);
diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h
index 59a81a8..60bd8bd 100644
--- a/usr.sbin/sysinstall/sysinstall.h
+++ b/usr.sbin/sysinstall/sysinstall.h
@@ -313,7 +313,6 @@ extern int DebugFD; /* Where diagnostic output goes */
extern Boolean Fake; /* Don't actually modify anything - testing */
extern Boolean SystemWasInstalled; /* Did we install it? */
extern Boolean RunningAsInit; /* Are we running stand-alone? */
-extern Boolean Chrooted; /* Are we chroot()ed? */
extern Boolean DialogActive; /* Is the dialog() stuff up? */
extern Boolean ColorDisplay; /* Are we on a color display? */
extern Boolean OnVTY; /* On a syscons VTY? */
@@ -637,8 +636,6 @@ extern int package_extract(Device *dev, char *name, Boolean depended);
extern Boolean package_exists(char *name);
/* system.c */
-extern int alarm_clear(void);
-extern void alarm_set(int delay, void (*handler)(int sig));
extern void systemInitialize(int argc, char **argv);
extern void systemShutdown(int status);
extern int execExecute(char *cmd, char *name);
diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c
index 0854cca..354f805 100644
--- a/usr.sbin/sysinstall/system.c
+++ b/usr.sbin/sysinstall/system.c
@@ -47,32 +47,6 @@ handle_intr(int sig)
restorescr(save);
}
-/* Simple alarm interface */
-void
-alarm_set(int delay, void (*handler)(int sig))
-{
- struct sigaction act;
-
- act.sa_handler = handler;
- act.sa_flags = 0;
- act.sa_mask = 0;
- sigaction(SIGALRM, &act, NULL);
- alarm(delay);
-}
-
-int
-alarm_clear(void)
-{
- struct sigaction act;
- int i = alarm(0);
-
- act.sa_handler = SIG_DFL;
- act.sa_flags = 0;
- act.sa_mask = 0;
- sigaction(SIGALRM, &act, NULL);
- return i;
-}
-
/* Expand a file into a convenient location, nuking it each time */
static char *
expand(char *fname)
diff --git a/usr.sbin/sysinstall/user.c b/usr.sbin/sysinstall/user.c
index 1c17750..6c42ecc 100644
--- a/usr.sbin/sysinstall/user.c
+++ b/usr.sbin/sysinstall/user.c
@@ -225,7 +225,6 @@ completeGroup(void)
for (i = getdtablesize(); i > 2; i--)
close(i);
- chroot(variable_get(VAR_INSTALL_ROOT));
execv("/usr/sbin/pw", vec);
msgDebug("Cannot execv() /usr/sbin/pw.\n");
_exit(99);
@@ -291,7 +290,6 @@ addGroup(WINDOW *ds_win)
else
vec[VEC_GID - 1] = 0;
- chroot(variable_get(VAR_INSTALL_ROOT));
execv("/usr/sbin/pw", vec);
msgDebug("Cannot execv() /usr/sbin/pw.\n");
_exit(99);
@@ -482,7 +480,6 @@ completeUser(void)
vec[VEC_UNAME] = uname;
- chroot(variable_get(VAR_INSTALL_ROOT));
execv("/usr/sbin/pw", vec);
msgDebug("Cannot execv() /usr/sbin/pw.\n");
_exit(99);
@@ -589,7 +586,6 @@ addUser(WINDOW *ds_win)
}
vec[i] = 0;
- chroot(variable_get(VAR_INSTALL_ROOT));
execv("/usr/sbin/pw", vec);
msgDebug("Cannot execv() /usr/sbin/pw.\n");
_exit(99);
OpenPOWER on IntegriCloud