diff options
-rw-r--r-- | usr.sbin/sade/install.c | 28 | ||||
-rw-r--r-- | usr.sbin/sade/sade.h | 1 | ||||
-rw-r--r-- | usr.sbin/sysinstall/cdrom.c | 12 | ||||
-rw-r--r-- | usr.sbin/sysinstall/install.c | 28 | ||||
-rw-r--r-- | usr.sbin/sysinstall/sysinstall.h | 1 |
5 files changed, 57 insertions, 13 deletions
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c index 1120f55..d1bc571 100644 --- a/usr.sbin/sade/install.c +++ b/usr.sbin/sade/install.c @@ -36,6 +36,7 @@ #include "sysinstall.h" #include <ctype.h> +#include <sys/consio.h> #include <sys/disklabel.h> #include <sys/errno.h> #include <sys/ioctl.h> @@ -328,6 +329,7 @@ int installFixitCDROM(dialogMenuItem *self) { struct stat sb; + int need_eject; if (!RunningAsInit) return DITEM_SUCCESS; @@ -336,18 +338,29 @@ installFixitCDROM(dialogMenuItem *self) (void)unlink("/mnt2"); (void)rmdir("/mnt2"); + need_eject = 0; + CDROMInitQuiet = 1; while (1) { - msgConfirm("Please insert a FreeBSD live filesystem CD/DVD and press return"); + if (need_eject) + msgConfirm( + "Please insert a FreeBSD live filesystem CD/DVD and press return"); if (DITEM_STATUS(mediaSetCDROM(NULL)) != DITEM_SUCCESS || !DEVICE_INIT(mediaDevice)) { /* If we can't initialize it, it's probably not a FreeBSD CDROM so punt on it */ mediaClose(); - if (msgYesNo("Unable to mount the disc - do you want to try again?") != 0) + if (need_eject && msgYesNo("Unable to mount the disc. Do you want to try again?") != 0) return DITEM_FAILURE; - } - else + } else if (!file_readable("/dist/rescue/ldconfig")) { + mediaClose(); + if (need_eject && + msgYesNo("Unable to find a FreeBSD live filesystem. Do you want to try again?") != 0) + return DITEM_FAILURE; + } else break; + CDROMInitQuiet = 0; + need_eject = 1; } + CDROMInitQuiet = 0; /* Since the fixit code expects everything to be in /mnt2, and the CDROM mounting stuff /dist, do * a little kludge dance here.. @@ -397,7 +410,8 @@ installFixitCDROM(dialogMenuItem *self) symlink("/mnt2/usr/bin/vi", "/usr/bin/vi"); fixit_common(); mediaClose(); - msgConfirm("Please remove the FreeBSD fixit CDROM/DVD now."); + if (need_eject) + msgConfirm("Please remove the FreeBSD fixit CDROM/DVD now."); return DITEM_SUCCESS; } @@ -527,6 +541,10 @@ fixit_common(void) (void)waitpid(child, &waitstatus, 0); if (strcmp(variable_get(VAR_FIXIT_TTY), "serial") == 0) systemResumeDialog(); + else if (OnVTY) { + ioctl(0, VT_ACTIVATE, 0); + msgInfo(NULL); + } } dialog_clear(); } diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index 1ac14a6..657b35f 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -402,6 +402,7 @@ typedef struct _devPriv { /*** Externs ***/ extern jmp_buf BailOut; /* Used to get the heck out */ +extern int CDROMInitQuiet; /* Don't whine if mount(2) fails */ extern int DebugFD; /* Where diagnostic output goes */ extern Boolean Fake; /* Don't actually modify anything - testing */ extern Boolean Restarting; /* Are we restarting sysinstall? */ diff --git a/usr.sbin/sysinstall/cdrom.c b/usr.sbin/sysinstall/cdrom.c index b9658d0..75151f4 100644 --- a/usr.sbin/sysinstall/cdrom.c +++ b/usr.sbin/sysinstall/cdrom.c @@ -56,6 +56,7 @@ static Boolean cdromMounted; static Boolean previouslyMounted; /* Was the disc already mounted? */ static char mountpoint[MAXPATHLEN] = "/dist"; +int CDROMInitQuiet; static properties read_props(char *name) @@ -91,14 +92,19 @@ mediaInitCDROM(Device *dev) if (errno == EINVAL) { msgConfirm("The disc in your drive looks more like an Audio disc than a FreeBSD release."); return FALSE; - } else if (errno == EBUSY) { + } + if (errno == EBUSY) { /* Perhaps the CDROM drive is already mounted as /cdrom */ if (file_readable("/cdrom/cdrom.inf")) { previouslyMounted = TRUE; strlcpy(mountpoint, "/cdrom", 7); + errno = 0; } - } else { - msgConfirm("Error mounting %s on %s: %s (%u)", dev->devname, mountpoint, strerror(errno), errno); + } + if (errno) { + if (!CDROMInitQuiet) + msgConfirm("Error mounting %s on %s: %s (%u)", dev->devname, + mountpoint, strerror(errno), errno); return FALSE; } } diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c index 1120f55..d1bc571 100644 --- a/usr.sbin/sysinstall/install.c +++ b/usr.sbin/sysinstall/install.c @@ -36,6 +36,7 @@ #include "sysinstall.h" #include <ctype.h> +#include <sys/consio.h> #include <sys/disklabel.h> #include <sys/errno.h> #include <sys/ioctl.h> @@ -328,6 +329,7 @@ int installFixitCDROM(dialogMenuItem *self) { struct stat sb; + int need_eject; if (!RunningAsInit) return DITEM_SUCCESS; @@ -336,18 +338,29 @@ installFixitCDROM(dialogMenuItem *self) (void)unlink("/mnt2"); (void)rmdir("/mnt2"); + need_eject = 0; + CDROMInitQuiet = 1; while (1) { - msgConfirm("Please insert a FreeBSD live filesystem CD/DVD and press return"); + if (need_eject) + msgConfirm( + "Please insert a FreeBSD live filesystem CD/DVD and press return"); if (DITEM_STATUS(mediaSetCDROM(NULL)) != DITEM_SUCCESS || !DEVICE_INIT(mediaDevice)) { /* If we can't initialize it, it's probably not a FreeBSD CDROM so punt on it */ mediaClose(); - if (msgYesNo("Unable to mount the disc - do you want to try again?") != 0) + if (need_eject && msgYesNo("Unable to mount the disc. Do you want to try again?") != 0) return DITEM_FAILURE; - } - else + } else if (!file_readable("/dist/rescue/ldconfig")) { + mediaClose(); + if (need_eject && + msgYesNo("Unable to find a FreeBSD live filesystem. Do you want to try again?") != 0) + return DITEM_FAILURE; + } else break; + CDROMInitQuiet = 0; + need_eject = 1; } + CDROMInitQuiet = 0; /* Since the fixit code expects everything to be in /mnt2, and the CDROM mounting stuff /dist, do * a little kludge dance here.. @@ -397,7 +410,8 @@ installFixitCDROM(dialogMenuItem *self) symlink("/mnt2/usr/bin/vi", "/usr/bin/vi"); fixit_common(); mediaClose(); - msgConfirm("Please remove the FreeBSD fixit CDROM/DVD now."); + if (need_eject) + msgConfirm("Please remove the FreeBSD fixit CDROM/DVD now."); return DITEM_SUCCESS; } @@ -527,6 +541,10 @@ fixit_common(void) (void)waitpid(child, &waitstatus, 0); if (strcmp(variable_get(VAR_FIXIT_TTY), "serial") == 0) systemResumeDialog(); + else if (OnVTY) { + ioctl(0, VT_ACTIVATE, 0); + msgInfo(NULL); + } } dialog_clear(); } diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index 1ac14a6..657b35f 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -402,6 +402,7 @@ typedef struct _devPriv { /*** Externs ***/ extern jmp_buf BailOut; /* Used to get the heck out */ +extern int CDROMInitQuiet; /* Don't whine if mount(2) fails */ extern int DebugFD; /* Where diagnostic output goes */ extern Boolean Fake; /* Don't actually modify anything - testing */ extern Boolean Restarting; /* Are we restarting sysinstall? */ |