summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sade
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2005-03-02 22:27:22 +0000
committerjhb <jhb@FreeBSD.org>2005-03-02 22:27:22 +0000
commit7040795aae9c5258b260b965c317a27b9143d19c (patch)
treee76586e83edb9857cabc783ac35c68475e3f7332 /usr.sbin/sade
parent37bd88d90f45d05afb9db766aefd525f77add2fe (diff)
downloadFreeBSD-src-7040795aae9c5258b260b965c317a27b9143d19c.zip
FreeBSD-src-7040795aae9c5258b260b965c317a27b9143d19c.tar.gz
- Fix a bug in sysinstall related to mounting CD-ROMs. If mount(2) fails
with EBUSY and a cdrom is not mounted at /cdrom, sysinstall fails to treat it as an error and thinks that the disk mounted ok. However, it doesn't find a cdrom.inf file so it complains. Later when it tries to unmount the disk due to a mediaClose() umount(2) returns an error, and it never clears its internal mounted flag. The fix here is to properly handle EBUSY as an error if there isn't a CD already mounted at /cdrom. - Add a new CDROMInitQuiet variable that can be used to shut up the dialog box about the mount(2) system call failing when trying to mount a CD-ROM. This is used by the feature described below. - When using a fixit CD, first try to see if we can mount the disc in the drive now and use it as a fixit CD. If not, then prompt the user to insert the disc and try again. If we do succeed on the first "silent" probe then we don't ask the user to eject the disk after leaving fixit mode. - Add a simple file existence test to make sure that the disc that we mount really is a livefs disc. - Explicitly switch back to ttyv0 when using the standard console after the fixit shell dies. Previously this behavior worked accidentally because all the fixit modes popped up a dialog box which contained a hidden switch to ttyv0. MFC after: 1 day
Diffstat (limited to 'usr.sbin/sade')
-rw-r--r--usr.sbin/sade/install.c28
-rw-r--r--usr.sbin/sade/sade.h1
2 files changed, 24 insertions, 5 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? */
OpenPOWER on IntegriCloud