summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1999-02-15 00:49:33 +0000
committerjkh <jkh@FreeBSD.org>1999-02-15 00:49:33 +0000
commit6f4aa554d0cbd0b9df16c4e1523fb957b26cd401 (patch)
tree2012f63a47953fbde3a3f7f1efb0e1a84da36843 /usr.sbin
parente504062bce0ba314c8fa2b49f6bd5387dbabed60 (diff)
downloadFreeBSD-src-6f4aa554d0cbd0b9df16c4e1523fb957b26cd401.zip
FreeBSD-src-6f4aa554d0cbd0b9df16c4e1523fb957b26cd401.tar.gz
Unbreak the fixit floppy.
Clean up some of the media handling to use common routines.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/sade/install.c31
-rw-r--r--usr.sbin/sade/system.c6
-rw-r--r--usr.sbin/sysinstall/floppy.c25
-rw-r--r--usr.sbin/sysinstall/install.c31
-rw-r--r--usr.sbin/sysinstall/media.c4
-rw-r--r--usr.sbin/sysinstall/system.c6
6 files changed, 50 insertions, 53 deletions
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
index 63edd5c..a01120c 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.227 1999/02/09 22:18:10 jkh Exp $
+ * $Id: install.c,v 1.228 1999/02/14 21:26:28 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -272,13 +272,10 @@ installFixitCDROM(dialogMenuItem *self)
(void)rmdir("/mnt2");
while (1) {
- msgConfirm("Please insert the second FreeBSD CDROM and press return");
+ msgConfirm("Please insert a FreeBSD live filesystem CDROM and press return");
if (DITEM_STATUS(mediaSetCDROM(NULL)) != DITEM_SUCCESS || !mediaDevice || !mediaDevice->init(mediaDevice)) {
/* If we can't initialize it, it's probably not a FreeBSD CDROM so punt on it */
- if (mediaDevice) {
- mediaDevice->shutdown(mediaDevice);
- mediaDevice = NULL;
- }
+ mediaClose();
if (msgYesNo("Unable to mount the CDROM - do you want to try again?") != 0)
return DITEM_FAILURE;
}
@@ -325,11 +322,9 @@ installFixitCDROM(dialogMenuItem *self)
"Dynamic executables from the CDROM likely won't work.");
}
}
-
fixit_common();
-
- mediaDevice->shutdown(mediaDevice);
- msgConfirm("Please remove the FreeBSD CDROM now.");
+ mediaClose();
+ msgConfirm("Please remove the FreeBSD fixit CDROM now.");
return DITEM_SUCCESS;
}
@@ -337,15 +332,13 @@ int
installFixitFloppy(dialogMenuItem *self)
{
struct ufs_args args;
+ extern char *distWanted;
if (!RunningAsInit)
return DITEM_SUCCESS;
- variable_set2(SYSTEM_STATE, "fixit", 0);
- Mkdir("/mnt2");
-
/* Try to open the floppy drive */
- if (DITEM_STATUS(mediaSetFloppy(NULL)) == DITEM_FAILURE) {
+ if (DITEM_STATUS(mediaSetFloppy(NULL)) == DITEM_FAILURE || !mediaDevice) {
msgConfirm("Unable to set media device to floppy.");
mediaClose();
return DITEM_FAILURE;
@@ -353,10 +346,13 @@ installFixitFloppy(dialogMenuItem *self)
memset(&args, 0, sizeof(args));
args.fspec = mediaDevice->devname;
+ mediaDevice->private = "/mnt2";
+ distWanted = NULL;
+ Mkdir("/mnt2");
+
+ variable_set2(SYSTEM_STATE, "fixit", 0);
while (1) {
- msgConfirm("Please insert a writable fixit floppy and press return");
- mediaDevice->private = "/mnt2";
if (!mediaDevice->init(mediaDevice)) {
if (msgYesNo("The attempt to mount the fixit floppy failed, bad floppy\n"
"or unclean filesystem. Do you want to try again?"))
@@ -368,8 +364,7 @@ installFixitFloppy(dialogMenuItem *self)
if (!directory_exists("/tmp"))
(void)symlink("/mnt2/tmp", "/tmp");
fixit_common();
- mediaDevice->shutdown(mediaDevice);
- mediaDevice = NULL;
+ mediaClose();
msgConfirm("Please remove the fixit floppy now.");
return DITEM_SUCCESS;
}
diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c
index ee0aba0..f916555 100644
--- a/usr.sbin/sade/system.c
+++ b/usr.sbin/sade/system.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: system.c,v 1.89 1999/02/09 22:18:10 jkh Exp $
+ * $Id: system.c,v 1.90 1999/02/14 21:26:29 jkh Exp $
*
* Jordan Hubbard
*
@@ -146,8 +146,8 @@ void
systemShutdown(int status)
{
/* If some media is open, close it down */
- if (status >=0 && mediaDevice)
- mediaDevice->shutdown(mediaDevice);
+ if (status >=0)
+ mediaClose();
/* write out any changes to rc.conf .. */
configRC_conf();
diff --git a/usr.sbin/sysinstall/floppy.c b/usr.sbin/sysinstall/floppy.c
index 6c1ab40..f3b210f 100644
--- a/usr.sbin/sysinstall/floppy.c
+++ b/usr.sbin/sysinstall/floppy.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: floppy.c,v 1.30 1998/10/12 23:45:06 jkh Exp $
+ * $Id: floppy.c,v 1.31 1998/12/22 12:31:24 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -63,12 +63,14 @@ mediaInitFloppy(Device *dev)
{
struct msdosfs_args dosargs;
struct ufs_args u_args;
+ char *mp;
if (floppyMounted)
return TRUE;
- if (Mkdir(mountpoint)) {
- msgConfirm("Unable to make %s directory mountpoint for %s!", mountpoint, dev->devname);
+ mp = dev->private ? (char *)dev->private : mountpoint;
+ if (Mkdir(mp)) {
+ msgConfirm("Unable to make %s directory mountpoint for %s!", mp, dev->devname);
return FALSE;
}
@@ -90,10 +92,10 @@ mediaInitFloppy(Device *dev)
memset(&u_args, 0, sizeof(u_args));
u_args.fspec = dev->devname;
- if (mount("msdos", mountpoint, MNT_RDONLY, (caddr_t)&dosargs) == -1) {
- if (mount("ufs", mountpoint, MNT_RDONLY, (caddr_t)&u_args) == -1) {
+ if (mount("msdos", mp, MNT_RDONLY, (caddr_t)&dosargs) == -1) {
+ if (mount("ufs", mp, MNT_RDONLY, (caddr_t)&u_args) == -1) {
msgConfirm("Error mounting floppy %s (%s) on %s : %s",
- dev->name, dev->devname, mountpoint, strerror(errno));
+ dev->name, dev->devname, mp, strerror(errno));
return FALSE;
}
}
@@ -105,7 +107,7 @@ mediaInitFloppy(Device *dev)
FILE *
mediaGetFloppy(Device *dev, char *file, Boolean probe)
{
- char buf[PATH_MAX];
+ char buf[PATH_MAX], *mp;
FILE *fp;
int nretries = 5;
@@ -114,7 +116,8 @@ mediaGetFloppy(Device *dev, char *file, Boolean probe)
* to speculatively open files on a floppy disk. Make user get it
* right or give up with floppies.
*/
- snprintf(buf, PATH_MAX, "%s/%s", mountpoint, file);
+ mp = dev->private ? (char *)dev->private : mountpoint;
+ snprintf(buf, PATH_MAX, "%s/%s", mp, file);
if (!file_readable(buf)) {
if (probe)
return NULL;
@@ -139,8 +142,10 @@ void
mediaShutdownFloppy(Device *dev)
{
if (floppyMounted) {
- if (unmount(mountpoint, MNT_FORCE) != 0)
- msgDebug("Umount of floppy on %s failed: %s (%d)\n", mountpoint, strerror(errno), errno);
+ char *mp = dev->private ? (char *)dev->private : mountpoint;
+
+ if (unmount(mp, MNT_FORCE) != 0)
+ msgDebug("Umount of floppy on %s failed: %s (%d)\n", mp, strerror(errno), errno);
else {
floppyMounted = FALSE;
if (!variable_get(VAR_NONINTERACTIVE))
diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c
index 63edd5c..a01120c 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.227 1999/02/09 22:18:10 jkh Exp $
+ * $Id: install.c,v 1.228 1999/02/14 21:26:28 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -272,13 +272,10 @@ installFixitCDROM(dialogMenuItem *self)
(void)rmdir("/mnt2");
while (1) {
- msgConfirm("Please insert the second FreeBSD CDROM and press return");
+ msgConfirm("Please insert a FreeBSD live filesystem CDROM and press return");
if (DITEM_STATUS(mediaSetCDROM(NULL)) != DITEM_SUCCESS || !mediaDevice || !mediaDevice->init(mediaDevice)) {
/* If we can't initialize it, it's probably not a FreeBSD CDROM so punt on it */
- if (mediaDevice) {
- mediaDevice->shutdown(mediaDevice);
- mediaDevice = NULL;
- }
+ mediaClose();
if (msgYesNo("Unable to mount the CDROM - do you want to try again?") != 0)
return DITEM_FAILURE;
}
@@ -325,11 +322,9 @@ installFixitCDROM(dialogMenuItem *self)
"Dynamic executables from the CDROM likely won't work.");
}
}
-
fixit_common();
-
- mediaDevice->shutdown(mediaDevice);
- msgConfirm("Please remove the FreeBSD CDROM now.");
+ mediaClose();
+ msgConfirm("Please remove the FreeBSD fixit CDROM now.");
return DITEM_SUCCESS;
}
@@ -337,15 +332,13 @@ int
installFixitFloppy(dialogMenuItem *self)
{
struct ufs_args args;
+ extern char *distWanted;
if (!RunningAsInit)
return DITEM_SUCCESS;
- variable_set2(SYSTEM_STATE, "fixit", 0);
- Mkdir("/mnt2");
-
/* Try to open the floppy drive */
- if (DITEM_STATUS(mediaSetFloppy(NULL)) == DITEM_FAILURE) {
+ if (DITEM_STATUS(mediaSetFloppy(NULL)) == DITEM_FAILURE || !mediaDevice) {
msgConfirm("Unable to set media device to floppy.");
mediaClose();
return DITEM_FAILURE;
@@ -353,10 +346,13 @@ installFixitFloppy(dialogMenuItem *self)
memset(&args, 0, sizeof(args));
args.fspec = mediaDevice->devname;
+ mediaDevice->private = "/mnt2";
+ distWanted = NULL;
+ Mkdir("/mnt2");
+
+ variable_set2(SYSTEM_STATE, "fixit", 0);
while (1) {
- msgConfirm("Please insert a writable fixit floppy and press return");
- mediaDevice->private = "/mnt2";
if (!mediaDevice->init(mediaDevice)) {
if (msgYesNo("The attempt to mount the fixit floppy failed, bad floppy\n"
"or unclean filesystem. Do you want to try again?"))
@@ -368,8 +364,7 @@ installFixitFloppy(dialogMenuItem *self)
if (!directory_exists("/tmp"))
(void)symlink("/mnt2/tmp", "/tmp");
fixit_common();
- mediaDevice->shutdown(mediaDevice);
- mediaDevice = NULL;
+ mediaClose();
msgConfirm("Please remove the fixit floppy now.");
return DITEM_SUCCESS;
}
diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c
index 61640e8..7384b41 100644
--- a/usr.sbin/sysinstall/media.c
+++ b/usr.sbin/sysinstall/media.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: media.c,v 1.94 1998/12/22 12:31:25 jkh Exp $
+ * $Id: media.c,v 1.95 1999/02/05 22:15:50 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -204,6 +204,8 @@ mediaSetFloppy(dialogMenuItem *self)
}
else
mediaDevice = devs[0];
+ if (mediaDevice)
+ mediaDevice->private = NULL;
return (mediaDevice ? DITEM_LEAVE_MENU : DITEM_FAILURE) | DITEM_RESTORE;
}
diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c
index ee0aba0..f916555 100644
--- a/usr.sbin/sysinstall/system.c
+++ b/usr.sbin/sysinstall/system.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: system.c,v 1.89 1999/02/09 22:18:10 jkh Exp $
+ * $Id: system.c,v 1.90 1999/02/14 21:26:29 jkh Exp $
*
* Jordan Hubbard
*
@@ -146,8 +146,8 @@ void
systemShutdown(int status)
{
/* If some media is open, close it down */
- if (status >=0 && mediaDevice)
- mediaDevice->shutdown(mediaDevice);
+ if (status >=0)
+ mediaClose();
/* write out any changes to rc.conf .. */
configRC_conf();
OpenPOWER on IntegriCloud