diff options
Diffstat (limited to 'usr.sbin/sysinstall/dos.c')
-rw-r--r-- | usr.sbin/sysinstall/dos.c | 44 |
1 files changed, 13 insertions, 31 deletions
diff --git a/usr.sbin/sysinstall/dos.c b/usr.sbin/sysinstall/dos.c index 3b66bcf..a11122a 100644 --- a/usr.sbin/sysinstall/dos.c +++ b/usr.sbin/sysinstall/dos.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: dos.c,v 1.20 1998/10/05 03:32:03 jkh Exp $ + * $Id: dos.c,v 1.21 1998/10/28 02:18:08 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -50,29 +50,26 @@ #undef MSDOSFS static Boolean DOSMounted; +static char mountpoint[] = "/dist"; Boolean mediaInitDOS(Device *dev) { struct msdosfs_args args; - if (!RunningAsInit || DOSMounted) + if (DOSMounted) return TRUE; - if (DITEM_STATUS(Mkdir("/dist")) != DITEM_SUCCESS) - return FALSE; - + Mkdir(mountpoint); memset(&args, 0, sizeof(args)); args.fspec = dev->devname; args.uid = args.gid = 0; args.mask = 0777; - if (mount("msdos", "/dist", MNT_RDONLY, (caddr_t)&args) == -1) { - msgConfirm("Error mounting %s on /dist: %s (%u)", args.fspec, strerror(errno), errno); + if (mount("msdos", mountpoint, MNT_RDONLY, (caddr_t)&args) == -1) { + msgConfirm("Error mounting %s on %s: %s (%u)", args.fspec, mountpoint, strerror(errno), errno); return FALSE; } - else - msgDebug("Mounted DOS device (%s) on /dist.\n", args.fspec); DOSMounted = TRUE; return TRUE; } @@ -80,33 +77,18 @@ mediaInitDOS(Device *dev) FILE * mediaGetDOS(Device *dev, char *file, Boolean probe) { - char buf[PATH_MAX]; - - if (isDebug()) - msgDebug("Request for %s from DOS\n", file); - snprintf(buf, PATH_MAX, "/dist/%s", file); - if (file_readable(buf)) - return fopen(buf, "r"); - snprintf(buf, PATH_MAX, "/dist/FREEBSD/%s", file); - if (file_readable(buf)) - return fopen(buf, "r"); - snprintf(buf, PATH_MAX, "/dist/%s/%s", variable_get(VAR_RELNAME), file); - if (file_readable(buf)) - return fopen(buf, "r"); - snprintf(buf, PATH_MAX, "/dist/%s/dists/%s", variable_get(VAR_RELNAME), file); - return fopen(buf, "r"); + return mediaGenericGet(mountpoint, file); } void mediaShutdownDOS(Device *dev) { - if (!RunningAsInit || !DOSMounted) + if (!DOSMounted) return; - msgDebug("Unmounting %s from /dist\n", dev->name); - if (unmount("/dist", MNT_FORCE) != 0) - msgConfirm("Could not unmount the DOS partition: %s", strerror(errno)); - if (isDebug()) - msgDebug("Unmount successful\n"); - DOSMounted = FALSE; + if (unmount(mountpoint, MNT_FORCE) != 0) + msgConfirm("Could not unmount the DOS partition from %s: %s", + mountpoint, strerror(errno)); + else + DOSMounted = FALSE; return; } |