From e72da228343024d66a2d2be92429e6bfec4f6fa1 Mon Sep 17 00:00:00 2001 From: jkh Date: Tue, 22 Dec 1998 12:31:26 +0000 Subject: Collapse the "get" code substantially by combining common functions. Also make mountpoint for each media type easier to change. Also reshuffled some menus for easier usage. --- release/sysinstall/cdrom.c | 31 ++++++---------------------- release/sysinstall/dos.c | 44 ++++++++++++---------------------------- release/sysinstall/floppy.c | 26 ++++++++++-------------- release/sysinstall/ftp.c | 12 +++-------- release/sysinstall/index.c | 3 ++- release/sysinstall/media.c | 24 +++++++++++++++++++--- release/sysinstall/menus.c | 20 ++++++++---------- release/sysinstall/nfs.c | 29 ++++++-------------------- release/sysinstall/sysinstall.h | 3 ++- release/sysinstall/tape.c | 9 ++++---- release/sysinstall/ufs.c | 18 ++-------------- usr.sbin/sade/menus.c | 20 ++++++++---------- usr.sbin/sade/sade.h | 3 ++- usr.sbin/sysinstall/cdrom.c | 31 ++++++---------------------- usr.sbin/sysinstall/dos.c | 44 ++++++++++++---------------------------- usr.sbin/sysinstall/floppy.c | 26 ++++++++++-------------- usr.sbin/sysinstall/ftp.c | 12 +++-------- usr.sbin/sysinstall/index.c | 3 ++- usr.sbin/sysinstall/media.c | 24 +++++++++++++++++++--- usr.sbin/sysinstall/menus.c | 20 ++++++++---------- usr.sbin/sysinstall/nfs.c | 29 ++++++-------------------- usr.sbin/sysinstall/sysinstall.h | 3 ++- usr.sbin/sysinstall/tape.c | 9 ++++---- usr.sbin/sysinstall/ufs.c | 18 ++-------------- 24 files changed, 171 insertions(+), 290 deletions(-) diff --git a/release/sysinstall/cdrom.c b/release/sysinstall/cdrom.c index 1fd1380..f6fe16b 100644 --- a/release/sysinstall/cdrom.c +++ b/release/sysinstall/cdrom.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: cdrom.c,v 1.42 1998/08/27 00:50:14 jkh Exp $ + * $Id: cdrom.c,v 1.43 1998/10/14 11:23:48 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -54,6 +54,7 @@ #undef CD9660 static Boolean cdromMounted; +static char mountpoint[] = "/dist"; static properties read_props(char *name) @@ -74,7 +75,7 @@ mediaInitCDROM(Device *dev) { struct iso_args args; properties cd_attr = NULL; - char *cp = NULL, *mountpoint = "/dist"; + char *cp = NULL; Boolean readInfo = TRUE; static Boolean bogusCDOK = FALSE; @@ -82,7 +83,6 @@ mediaInitCDROM(Device *dev) return TRUE; Mkdir(mountpoint); - bzero(&args, sizeof(args)); args.fspec = dev->devname; args.flags = 0; @@ -143,7 +143,6 @@ mediaInitCDROM(Device *dev) bogusCDOK = TRUE; } } - msgDebug("Mounted FreeBSD CDROM from device %s\n", dev->devname); properties_free(cd_attr); return TRUE; } @@ -151,35 +150,17 @@ mediaInitCDROM(Device *dev) FILE * mediaGetCDROM(Device *dev, char *file, Boolean probe) { - char buf[PATH_MAX]; - - if (isDebug()) - msgDebug("Request for %s from CDROM\n", file); - snprintf(buf, PATH_MAX, "/dist/%s", file); - if (file_readable(buf)) - return fopen(buf, "r"); - snprintf(buf, PATH_MAX, "/dist/dists/%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 mediaShutdownCDROM(Device *dev) { - char *mountpoint = "/dist"; - if (!cdromMounted) return; - msgDebug("Unmounting %s from %s\n", dev->devname, mountpoint); + if (unmount(mountpoint, MNT_FORCE) != 0) msgConfirm("Could not unmount the CDROM from %s: %s", mountpoint, strerror(errno)); - else { - msgDebug("Unmount of CDROM successful\n"); + else cdromMounted = FALSE; - } } diff --git a/release/sysinstall/dos.c b/release/sysinstall/dos.c index 3b66bcf..a11122a 100644 --- a/release/sysinstall/dos.c +++ b/release/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; } diff --git a/release/sysinstall/floppy.c b/release/sysinstall/floppy.c index 87974dd..6c1ab40 100644 --- a/release/sysinstall/floppy.c +++ b/release/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.29 1998/07/18 09:42:00 jkh Exp $ + * $Id: floppy.c,v 1.30 1998/10/12 23:45:06 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -56,18 +56,17 @@ static Boolean floppyMounted; char *distWanted; +static char mountpoint[] = "/dist"; Boolean mediaInitFloppy(Device *dev) { struct msdosfs_args dosargs; struct ufs_args u_args; - char *mountpoint; if (floppyMounted) return TRUE; - mountpoint = (char *)dev->private; if (Mkdir(mountpoint)) { msgConfirm("Unable to make %s directory mountpoint for %s!", mountpoint, dev->devname); return FALSE; @@ -93,12 +92,11 @@ mediaInitFloppy(Device *dev) if (mount("msdos", mountpoint, MNT_RDONLY, (caddr_t)&dosargs) == -1) { if (mount("ufs", mountpoint, MNT_RDONLY, (caddr_t)&u_args) == -1) { - msgConfirm("Error mounting floppy %s (%s) on %s : %s", dev->name, dev->devname, mountpoint, - strerror(errno)); + msgConfirm("Error mounting floppy %s (%s) on %s : %s", + dev->name, dev->devname, mountpoint, strerror(errno)); return FALSE; } } - msgDebug("initFloppy: mounted floppy %s successfully on %s\n", dev->devname, mountpoint); floppyMounted = TRUE; distWanted = NULL; return TRUE; @@ -111,10 +109,12 @@ mediaGetFloppy(Device *dev, char *file, Boolean probe) FILE *fp; int nretries = 5; - snprintf(buf, PATH_MAX, "%s/%s", (char *)dev->private, file); - - if (isDebug()) - msgDebug("Request for %s from floppy on %s, probe is %d.\n", buf, (char *)dev->private, probe); + /* + * floppies don't use mediaGenericGet() because it's too expensive + * 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); if (!file_readable(buf)) { if (probe) return NULL; @@ -138,17 +138,13 @@ mediaGetFloppy(Device *dev, char *file, Boolean probe) void mediaShutdownFloppy(Device *dev) { - char *mountpoint = (char *)dev->private; - if (floppyMounted) { if (unmount(mountpoint, MNT_FORCE) != 0) msgDebug("Umount of floppy on %s failed: %s (%d)\n", mountpoint, strerror(errno), errno); else { floppyMounted = FALSE; - msgDebug("Floppy unmounted successfully.\n"); if (!variable_get(VAR_NONINTERACTIVE)) - msgConfirm("You may remove the floppy from %s", - dev->description); + msgConfirm("You may remove the floppy from %s", dev->description); } } } diff --git a/release/sysinstall/ftp.c b/release/sysinstall/ftp.c index f6d6bc7..4f1e542 100644 --- a/release/sysinstall/ftp.c +++ b/release/sysinstall/ftp.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: ftp.c,v 1.34 1997/10/03 14:00:09 jkh Exp $ + * $Id: ftp.c,v 1.35 1998/01/28 04:42:38 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -80,9 +80,6 @@ mediaInitFTP(Device *dev) if (ftpInitted) return TRUE; - if (isDebug()) - msgDebug("Init routine for FTP called.\n"); - if (OpenConn) { fclose(OpenConn); OpenConn = NULL; @@ -167,8 +164,6 @@ try: else goto punt; } - if (isDebug()) - msgDebug("mediaInitFTP was successful (logged in and chdir'd)\n"); ftpInitted = TRUE; return TRUE; @@ -221,7 +216,7 @@ mediaGetFTP(Device *dev, char *file, Boolean probe) /* Try some alternatives */ switch (nretries++) { case 1: - sprintf(buf, "dists/%s", file); + sprintf(buf, "releases/%s", file); try = buf; break; @@ -231,7 +226,7 @@ mediaGetFTP(Device *dev, char *file, Boolean probe) break; case 3: - sprintf(buf, "%s/dists/%s", variable_get(VAR_RELNAME), file); + sprintf(buf, "%s/releases/%s", variable_get(VAR_RELNAME), file); try = buf; break; @@ -250,7 +245,6 @@ mediaShutdownFTP(Device *dev) if (!ftpInitted) return; - msgDebug("FTP shutdown called. OpenConn = %x\n", OpenConn); if (OpenConn != NULL) { fclose(OpenConn); OpenConn = NULL; diff --git a/release/sysinstall/index.c b/release/sysinstall/index.c index bd6c97c..7dde147 100644 --- a/release/sysinstall/index.c +++ b/release/sysinstall/index.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: index.c,v 1.57 1998/10/15 06:50:43 jkh Exp $ + * $Id: index.c,v 1.58 1998/12/13 23:37:33 steve Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -82,6 +82,7 @@ static char *descrs[] = { "deskutils", "Various Desktop utilities.", "documentation", "Document preparation utilities.", "editors", "Common text editors.", + "elisp", "Things related to Emacs Lisp.", "emulation", "Utilities for emulating other OS types.", "emulators", "Utilities for emulating other OS types.", "games", "Various and sundry amusements.", diff --git a/release/sysinstall/media.c b/release/sysinstall/media.c index 05080d6..87f63f4 100644 --- a/release/sysinstall/media.c +++ b/release/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.92 1998/11/02 10:42:18 obrien Exp $ + * $Id: media.c,v 1.93 1998/12/02 03:27:37 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -204,8 +204,6 @@ mediaSetFloppy(dialogMenuItem *self) } else mediaDevice = devs[0]; - if (mediaDevice) - mediaDevice->private = "/dist"; return (mediaDevice ? DITEM_LEAVE_MENU : DITEM_FAILURE) | DITEM_RESTORE; } @@ -764,3 +762,23 @@ mediaSetCPIOVerbosity(dialogMenuItem *self) } return DITEM_SUCCESS; } + +/* A generic open which follows a well-known "path" of places to look */ +FILE * +mediaGenericGet(char *base, const char *file) +{ + char buf[PATH_MAX]; + + snprintf(buf, PATH_MAX, "%s/%s", base, file); + if (file_readable(buf)) + return fopen(buf, "r"); + snprintf(buf, PATH_MAX, "%s/releases/%s", base, file); + if (file_readable(buf)) + return fopen(buf, "r"); + snprintf(buf, PATH_MAX, "%s/%s/%s", base, variable_get(VAR_RELNAME), file); + if (file_readable(buf)) + return fopen(buf, "r"); + snprintf(buf, PATH_MAX, "%s/releases/%s/%s", base, variable_get(VAR_RELNAME), file); + return fopen(buf, "r"); +} + diff --git a/release/sysinstall/menus.c b/release/sysinstall/menus.c index 4a051fb..3335c97 100644 --- a/release/sysinstall/menus.c +++ b/release/sysinstall/menus.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: menus.c,v 1.175 1998/12/02 03:34:14 jkh Exp $ + * $Id: menus.c,v 1.176 1998/12/09 02:46:19 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -303,13 +303,13 @@ DMenu MenuInitial = { { "2 Doc", "Installation instructions, README, etc.", NULL, dmenuSubmenu, NULL, &MenuDocumentation }, { "3 Keymap", "Select keyboard type", NULL, dmenuSubmenu, NULL, &MenuSysconsKeymap }, { "4 Options", "View/Set various installation options", NULL, optionsEditor }, - { "5 Novice", "Begin a novice installation (for beginners)", NULL, installNovice }, - { "6 Express", "Begin a quick installation (for the impatient)", NULL, installExpress }, - { "7 Custom", "Begin a custom installation (for experts)", NULL, dmenuSubmenu, NULL, &MenuInstallCustom }, - { "8 Fixit", "Enter repair mode with CDROM/floppy or start shell", NULL, dmenuSubmenu, NULL, &MenuFixit }, - { "9 Upgrade", "Upgrade an existing system", NULL, installUpgrade }, - { "c Configure", "Do post-install configuration of FreeBSD", NULL, dmenuSubmenu, NULL, &MenuConfigure }, - { "l Load Config","Load default install configuration", NULL, dispatch_load_floppy }, + { "5 Configure", "Do post-install configuration of FreeBSD", NULL, dmenuSubmenu, NULL, &MenuConfigure }, + { "6 Novice", "Begin a novice installation (for beginners)", NULL, installNovice }, + { "7 Express", "Begin a quick installation (for the impatient)", NULL, installExpress }, + { "8 Custom", "Begin a custom installation (for experts)", NULL, dmenuSubmenu, NULL, &MenuInstallCustom }, + { "9 Fixit", "Enter repair mode with CDROM/floppy or start shell", NULL, dmenuSubmenu, NULL, &MenuFixit }, + { "U Upgrade", "Upgrade an existing system", NULL, installUpgrade }, + { "L Load Config","Load default install configuration", NULL, dispatch_load_floppy }, { "0 Index", "Glossary of functions", NULL, dmenuSubmenu, NULL, &MenuIndex }, { NULL } }, }; @@ -489,8 +489,6 @@ DMenu MenuMediaFTP = { VAR_FTP_PATH "=ftp://current.freebsd.org/pub/FreeBSD/" }, { "2.2 SNAP Server", "releng22.freebsd.org", NULL, dmenuSetVariable, NULL, VAR_FTP_PATH "=ftp://releng22.freebsd.org/pub/FreeBSD/" }, - { "2.1 SNAP Server", "releng210.freebsd.org", NULL, dmenuSetVariable, NULL, - VAR_FTP_PATH "=ftp://releng210.freebsd.org/pub/FreeBSD/" }, { "Argentina", "ftp.ar.freebsd.org", NULL, dmenuSetVariable, NULL, VAR_FTP_PATH "=ftp://ftp.ar.freebsd.org/pub/FreeBSD/" }, { "Australia", "ftp.au.freebsd.org", NULL, dmenuSetVariable, NULL, @@ -1214,7 +1212,7 @@ DMenu MenuNetworking = { { "Gateway", "This machine will route packets between interfaces", dmenuVarCheck, dmenuToggleVariable, NULL, "gateway_enable=YES" }, { "Ntpdate", "Select a clock-synchronization server", - dmenuVarCheck, dmenuSubmenu, NULL, &MenuNTP, '[', 'X', ']', "ntpdate_enable=YES" }, + dmenuVarCheck, dmenuSubmenu, NULL, &MenuNTP, '[', 'X', ']', (int)"ntpdate_enable=YES" }, { "router", "Select routing daemon (default: routed)", dmenuVarCheck, configRouter, NULL, "router" }, { "Rwhod", "This machine wants to run the rwho daemon", diff --git a/release/sysinstall/nfs.c b/release/sysinstall/nfs.c index 8ab7521..aeb1dc0 100644 --- a/release/sysinstall/nfs.c +++ b/release/sysinstall/nfs.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$ + * $Id: nfs.c,v 1.18 1997/02/22 14:12:14 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -42,11 +42,11 @@ #include Boolean NFSMounted; +static char mountpoint[] = "/dist"; Boolean mediaInitNFS(Device *dev) { - char *mountpoint = "/dist"; Device *netDevice = (Device *)dev->private; if (NFSMounted) @@ -68,43 +68,26 @@ mediaInitNFS(Device *dev) return FALSE; } NFSMounted = TRUE; - msgDebug("Mounted NFS device %s onto %s\n", dev->name, mountpoint); + if (isDebug()) + msgDebug("Mounted NFS device %s onto %s\n", dev->name, mountpoint); return TRUE; } FILE * mediaGetNFS(Device *dev, char *file, Boolean probe) { - char buf[PATH_MAX]; - - if (isDebug()) - msgDebug("Request for %s from NFS\n", file); - snprintf(buf, PATH_MAX, "/dist/%s", file); - if (file_readable(buf)) - return fopen(buf, "r"); - snprintf(buf, PATH_MAX, "/dist/dists/%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 mediaShutdownNFS(Device *dev) { - /* Device *netdev = (Device *)dev->private; */ - char *mountpoint = "/dist"; - if (!NFSMounted) return; + msgNotify("Unmounting NFS partition on %s", mountpoint); if (unmount(mountpoint, MNT_FORCE) != 0) msgConfirm("Could not unmount the NFS partition: %s", strerror(errno)); - msgDebug("Unmount of NFS partition successful\n"); - /* if (netdev) netdev->shutdown(netdev); */ NFSMounted = FALSE; return; } diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h index 80833d0..2b027b0 100644 --- a/release/sysinstall/sysinstall.h +++ b/release/sysinstall/sysinstall.h @@ -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: sysinstall.h,v 1.150 1998/11/15 09:06:20 jkh Exp $ + * $Id: sysinstall.h,v 1.151 1998/11/24 00:18:56 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -584,6 +584,7 @@ extern Boolean mediaExtractDist(char *dir, char *dist, FILE *fp); extern Boolean mediaExtractDistBegin(char *dir, int *fd, int *zpid, int *cpic); extern Boolean mediaExtractDistEnd(int zpid, int cpid); extern Boolean mediaVerify(void); +extern FILE *mediaGenericGet(char *base, const char *file); /* misc.c */ extern Boolean file_readable(char *fname); diff --git a/release/sysinstall/tape.c b/release/sysinstall/tape.c index df39892..995a0fe 100644 --- a/release/sysinstall/tape.c +++ b/release/sysinstall/tape.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$ + * $Id: tape.c,v 1.19 1997/02/22 14:12:21 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -98,7 +98,7 @@ mediaGetTape(Device *dev, char *file, Boolean probe) if (file_readable(buf)) fp = fopen(buf, "r"); else { - sprintf(buf, "%s/dists/%s", (char *)dev->private, file); + sprintf(buf, "%s/releases/%s", (char *)dev->private, file); fp = fopen(buf, "r"); } /* Nuke the files behind us to save space */ @@ -112,8 +112,9 @@ mediaShutdownTape(Device *dev) { if (!tapeInitted) return; - if (file_readable(dev->private)) { - msgNotify("Cleaning up results of tape extract in %s..", dev->private); + if (file_readable((char *)dev->private)) { + msgNotify("Cleaning up results of tape extract in %s..", + (char *)dev->private); (void)vsystem("rm -rf %s", (char *)dev->private); } tapeInitted = FALSE; diff --git a/release/sysinstall/ufs.c b/release/sysinstall/ufs.c index 8f61cbe..73c0667 100644 --- a/release/sysinstall/ufs.c +++ b/release/sysinstall/ufs.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: ufs.c,v 1.12 1997/02/22 14:12:35 peter Exp $ + * $Id: ufs.c,v 1.13 1998/09/14 19:14:11 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -45,19 +45,5 @@ FILE * mediaGetUFS(Device *dev, char *file, Boolean probe) { - char buf[PATH_MAX]; - - if (isDebug()) - msgDebug("Request for %s from UFS\n", file); - snprintf(buf, PATH_MAX, "%s/%s", (char *)dev->private, file); - if (file_readable(buf)) - return fopen(buf, "r"); - snprintf(buf, PATH_MAX, "%s/dists/%s", (char *)dev->private, file); - if (file_readable(buf)) - return fopen(buf, "r"); - snprintf(buf, PATH_MAX, "%s/%s/%s", (char *)dev->private, variable_get(VAR_RELNAME), file); - if (file_readable(buf)) - return fopen(buf, "r"); - snprintf(buf, PATH_MAX, "%s/%s/dists/%s", (char *)dev->private, variable_get(VAR_RELNAME), file); - return fopen(buf, "r"); + return mediaGenericGet((char *)dev->private, file); } diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c index 4a051fb..3335c97 100644 --- a/usr.sbin/sade/menus.c +++ b/usr.sbin/sade/menus.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: menus.c,v 1.175 1998/12/02 03:34:14 jkh Exp $ + * $Id: menus.c,v 1.176 1998/12/09 02:46:19 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -303,13 +303,13 @@ DMenu MenuInitial = { { "2 Doc", "Installation instructions, README, etc.", NULL, dmenuSubmenu, NULL, &MenuDocumentation }, { "3 Keymap", "Select keyboard type", NULL, dmenuSubmenu, NULL, &MenuSysconsKeymap }, { "4 Options", "View/Set various installation options", NULL, optionsEditor }, - { "5 Novice", "Begin a novice installation (for beginners)", NULL, installNovice }, - { "6 Express", "Begin a quick installation (for the impatient)", NULL, installExpress }, - { "7 Custom", "Begin a custom installation (for experts)", NULL, dmenuSubmenu, NULL, &MenuInstallCustom }, - { "8 Fixit", "Enter repair mode with CDROM/floppy or start shell", NULL, dmenuSubmenu, NULL, &MenuFixit }, - { "9 Upgrade", "Upgrade an existing system", NULL, installUpgrade }, - { "c Configure", "Do post-install configuration of FreeBSD", NULL, dmenuSubmenu, NULL, &MenuConfigure }, - { "l Load Config","Load default install configuration", NULL, dispatch_load_floppy }, + { "5 Configure", "Do post-install configuration of FreeBSD", NULL, dmenuSubmenu, NULL, &MenuConfigure }, + { "6 Novice", "Begin a novice installation (for beginners)", NULL, installNovice }, + { "7 Express", "Begin a quick installation (for the impatient)", NULL, installExpress }, + { "8 Custom", "Begin a custom installation (for experts)", NULL, dmenuSubmenu, NULL, &MenuInstallCustom }, + { "9 Fixit", "Enter repair mode with CDROM/floppy or start shell", NULL, dmenuSubmenu, NULL, &MenuFixit }, + { "U Upgrade", "Upgrade an existing system", NULL, installUpgrade }, + { "L Load Config","Load default install configuration", NULL, dispatch_load_floppy }, { "0 Index", "Glossary of functions", NULL, dmenuSubmenu, NULL, &MenuIndex }, { NULL } }, }; @@ -489,8 +489,6 @@ DMenu MenuMediaFTP = { VAR_FTP_PATH "=ftp://current.freebsd.org/pub/FreeBSD/" }, { "2.2 SNAP Server", "releng22.freebsd.org", NULL, dmenuSetVariable, NULL, VAR_FTP_PATH "=ftp://releng22.freebsd.org/pub/FreeBSD/" }, - { "2.1 SNAP Server", "releng210.freebsd.org", NULL, dmenuSetVariable, NULL, - VAR_FTP_PATH "=ftp://releng210.freebsd.org/pub/FreeBSD/" }, { "Argentina", "ftp.ar.freebsd.org", NULL, dmenuSetVariable, NULL, VAR_FTP_PATH "=ftp://ftp.ar.freebsd.org/pub/FreeBSD/" }, { "Australia", "ftp.au.freebsd.org", NULL, dmenuSetVariable, NULL, @@ -1214,7 +1212,7 @@ DMenu MenuNetworking = { { "Gateway", "This machine will route packets between interfaces", dmenuVarCheck, dmenuToggleVariable, NULL, "gateway_enable=YES" }, { "Ntpdate", "Select a clock-synchronization server", - dmenuVarCheck, dmenuSubmenu, NULL, &MenuNTP, '[', 'X', ']', "ntpdate_enable=YES" }, + dmenuVarCheck, dmenuSubmenu, NULL, &MenuNTP, '[', 'X', ']', (int)"ntpdate_enable=YES" }, { "router", "Select routing daemon (default: routed)", dmenuVarCheck, configRouter, NULL, "router" }, { "Rwhod", "This machine wants to run the rwho daemon", diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index 80833d0..2b027b0 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -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: sysinstall.h,v 1.150 1998/11/15 09:06:20 jkh Exp $ + * $Id: sysinstall.h,v 1.151 1998/11/24 00:18:56 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -584,6 +584,7 @@ extern Boolean mediaExtractDist(char *dir, char *dist, FILE *fp); extern Boolean mediaExtractDistBegin(char *dir, int *fd, int *zpid, int *cpic); extern Boolean mediaExtractDistEnd(int zpid, int cpid); extern Boolean mediaVerify(void); +extern FILE *mediaGenericGet(char *base, const char *file); /* misc.c */ extern Boolean file_readable(char *fname); diff --git a/usr.sbin/sysinstall/cdrom.c b/usr.sbin/sysinstall/cdrom.c index 1fd1380..f6fe16b 100644 --- a/usr.sbin/sysinstall/cdrom.c +++ b/usr.sbin/sysinstall/cdrom.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: cdrom.c,v 1.42 1998/08/27 00:50:14 jkh Exp $ + * $Id: cdrom.c,v 1.43 1998/10/14 11:23:48 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -54,6 +54,7 @@ #undef CD9660 static Boolean cdromMounted; +static char mountpoint[] = "/dist"; static properties read_props(char *name) @@ -74,7 +75,7 @@ mediaInitCDROM(Device *dev) { struct iso_args args; properties cd_attr = NULL; - char *cp = NULL, *mountpoint = "/dist"; + char *cp = NULL; Boolean readInfo = TRUE; static Boolean bogusCDOK = FALSE; @@ -82,7 +83,6 @@ mediaInitCDROM(Device *dev) return TRUE; Mkdir(mountpoint); - bzero(&args, sizeof(args)); args.fspec = dev->devname; args.flags = 0; @@ -143,7 +143,6 @@ mediaInitCDROM(Device *dev) bogusCDOK = TRUE; } } - msgDebug("Mounted FreeBSD CDROM from device %s\n", dev->devname); properties_free(cd_attr); return TRUE; } @@ -151,35 +150,17 @@ mediaInitCDROM(Device *dev) FILE * mediaGetCDROM(Device *dev, char *file, Boolean probe) { - char buf[PATH_MAX]; - - if (isDebug()) - msgDebug("Request for %s from CDROM\n", file); - snprintf(buf, PATH_MAX, "/dist/%s", file); - if (file_readable(buf)) - return fopen(buf, "r"); - snprintf(buf, PATH_MAX, "/dist/dists/%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 mediaShutdownCDROM(Device *dev) { - char *mountpoint = "/dist"; - if (!cdromMounted) return; - msgDebug("Unmounting %s from %s\n", dev->devname, mountpoint); + if (unmount(mountpoint, MNT_FORCE) != 0) msgConfirm("Could not unmount the CDROM from %s: %s", mountpoint, strerror(errno)); - else { - msgDebug("Unmount of CDROM successful\n"); + else cdromMounted = FALSE; - } } 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; } diff --git a/usr.sbin/sysinstall/floppy.c b/usr.sbin/sysinstall/floppy.c index 87974dd..6c1ab40 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.29 1998/07/18 09:42:00 jkh Exp $ + * $Id: floppy.c,v 1.30 1998/10/12 23:45:06 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -56,18 +56,17 @@ static Boolean floppyMounted; char *distWanted; +static char mountpoint[] = "/dist"; Boolean mediaInitFloppy(Device *dev) { struct msdosfs_args dosargs; struct ufs_args u_args; - char *mountpoint; if (floppyMounted) return TRUE; - mountpoint = (char *)dev->private; if (Mkdir(mountpoint)) { msgConfirm("Unable to make %s directory mountpoint for %s!", mountpoint, dev->devname); return FALSE; @@ -93,12 +92,11 @@ mediaInitFloppy(Device *dev) if (mount("msdos", mountpoint, MNT_RDONLY, (caddr_t)&dosargs) == -1) { if (mount("ufs", mountpoint, MNT_RDONLY, (caddr_t)&u_args) == -1) { - msgConfirm("Error mounting floppy %s (%s) on %s : %s", dev->name, dev->devname, mountpoint, - strerror(errno)); + msgConfirm("Error mounting floppy %s (%s) on %s : %s", + dev->name, dev->devname, mountpoint, strerror(errno)); return FALSE; } } - msgDebug("initFloppy: mounted floppy %s successfully on %s\n", dev->devname, mountpoint); floppyMounted = TRUE; distWanted = NULL; return TRUE; @@ -111,10 +109,12 @@ mediaGetFloppy(Device *dev, char *file, Boolean probe) FILE *fp; int nretries = 5; - snprintf(buf, PATH_MAX, "%s/%s", (char *)dev->private, file); - - if (isDebug()) - msgDebug("Request for %s from floppy on %s, probe is %d.\n", buf, (char *)dev->private, probe); + /* + * floppies don't use mediaGenericGet() because it's too expensive + * 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); if (!file_readable(buf)) { if (probe) return NULL; @@ -138,17 +138,13 @@ mediaGetFloppy(Device *dev, char *file, Boolean probe) void mediaShutdownFloppy(Device *dev) { - char *mountpoint = (char *)dev->private; - if (floppyMounted) { if (unmount(mountpoint, MNT_FORCE) != 0) msgDebug("Umount of floppy on %s failed: %s (%d)\n", mountpoint, strerror(errno), errno); else { floppyMounted = FALSE; - msgDebug("Floppy unmounted successfully.\n"); if (!variable_get(VAR_NONINTERACTIVE)) - msgConfirm("You may remove the floppy from %s", - dev->description); + msgConfirm("You may remove the floppy from %s", dev->description); } } } diff --git a/usr.sbin/sysinstall/ftp.c b/usr.sbin/sysinstall/ftp.c index f6d6bc7..4f1e542 100644 --- a/usr.sbin/sysinstall/ftp.c +++ b/usr.sbin/sysinstall/ftp.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: ftp.c,v 1.34 1997/10/03 14:00:09 jkh Exp $ + * $Id: ftp.c,v 1.35 1998/01/28 04:42:38 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -80,9 +80,6 @@ mediaInitFTP(Device *dev) if (ftpInitted) return TRUE; - if (isDebug()) - msgDebug("Init routine for FTP called.\n"); - if (OpenConn) { fclose(OpenConn); OpenConn = NULL; @@ -167,8 +164,6 @@ try: else goto punt; } - if (isDebug()) - msgDebug("mediaInitFTP was successful (logged in and chdir'd)\n"); ftpInitted = TRUE; return TRUE; @@ -221,7 +216,7 @@ mediaGetFTP(Device *dev, char *file, Boolean probe) /* Try some alternatives */ switch (nretries++) { case 1: - sprintf(buf, "dists/%s", file); + sprintf(buf, "releases/%s", file); try = buf; break; @@ -231,7 +226,7 @@ mediaGetFTP(Device *dev, char *file, Boolean probe) break; case 3: - sprintf(buf, "%s/dists/%s", variable_get(VAR_RELNAME), file); + sprintf(buf, "%s/releases/%s", variable_get(VAR_RELNAME), file); try = buf; break; @@ -250,7 +245,6 @@ mediaShutdownFTP(Device *dev) if (!ftpInitted) return; - msgDebug("FTP shutdown called. OpenConn = %x\n", OpenConn); if (OpenConn != NULL) { fclose(OpenConn); OpenConn = NULL; diff --git a/usr.sbin/sysinstall/index.c b/usr.sbin/sysinstall/index.c index bd6c97c..7dde147 100644 --- a/usr.sbin/sysinstall/index.c +++ b/usr.sbin/sysinstall/index.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: index.c,v 1.57 1998/10/15 06:50:43 jkh Exp $ + * $Id: index.c,v 1.58 1998/12/13 23:37:33 steve Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -82,6 +82,7 @@ static char *descrs[] = { "deskutils", "Various Desktop utilities.", "documentation", "Document preparation utilities.", "editors", "Common text editors.", + "elisp", "Things related to Emacs Lisp.", "emulation", "Utilities for emulating other OS types.", "emulators", "Utilities for emulating other OS types.", "games", "Various and sundry amusements.", diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c index 05080d6..87f63f4 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.92 1998/11/02 10:42:18 obrien Exp $ + * $Id: media.c,v 1.93 1998/12/02 03:27:37 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -204,8 +204,6 @@ mediaSetFloppy(dialogMenuItem *self) } else mediaDevice = devs[0]; - if (mediaDevice) - mediaDevice->private = "/dist"; return (mediaDevice ? DITEM_LEAVE_MENU : DITEM_FAILURE) | DITEM_RESTORE; } @@ -764,3 +762,23 @@ mediaSetCPIOVerbosity(dialogMenuItem *self) } return DITEM_SUCCESS; } + +/* A generic open which follows a well-known "path" of places to look */ +FILE * +mediaGenericGet(char *base, const char *file) +{ + char buf[PATH_MAX]; + + snprintf(buf, PATH_MAX, "%s/%s", base, file); + if (file_readable(buf)) + return fopen(buf, "r"); + snprintf(buf, PATH_MAX, "%s/releases/%s", base, file); + if (file_readable(buf)) + return fopen(buf, "r"); + snprintf(buf, PATH_MAX, "%s/%s/%s", base, variable_get(VAR_RELNAME), file); + if (file_readable(buf)) + return fopen(buf, "r"); + snprintf(buf, PATH_MAX, "%s/releases/%s/%s", base, variable_get(VAR_RELNAME), file); + return fopen(buf, "r"); +} + diff --git a/usr.sbin/sysinstall/menus.c b/usr.sbin/sysinstall/menus.c index 4a051fb..3335c97 100644 --- a/usr.sbin/sysinstall/menus.c +++ b/usr.sbin/sysinstall/menus.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: menus.c,v 1.175 1998/12/02 03:34:14 jkh Exp $ + * $Id: menus.c,v 1.176 1998/12/09 02:46:19 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -303,13 +303,13 @@ DMenu MenuInitial = { { "2 Doc", "Installation instructions, README, etc.", NULL, dmenuSubmenu, NULL, &MenuDocumentation }, { "3 Keymap", "Select keyboard type", NULL, dmenuSubmenu, NULL, &MenuSysconsKeymap }, { "4 Options", "View/Set various installation options", NULL, optionsEditor }, - { "5 Novice", "Begin a novice installation (for beginners)", NULL, installNovice }, - { "6 Express", "Begin a quick installation (for the impatient)", NULL, installExpress }, - { "7 Custom", "Begin a custom installation (for experts)", NULL, dmenuSubmenu, NULL, &MenuInstallCustom }, - { "8 Fixit", "Enter repair mode with CDROM/floppy or start shell", NULL, dmenuSubmenu, NULL, &MenuFixit }, - { "9 Upgrade", "Upgrade an existing system", NULL, installUpgrade }, - { "c Configure", "Do post-install configuration of FreeBSD", NULL, dmenuSubmenu, NULL, &MenuConfigure }, - { "l Load Config","Load default install configuration", NULL, dispatch_load_floppy }, + { "5 Configure", "Do post-install configuration of FreeBSD", NULL, dmenuSubmenu, NULL, &MenuConfigure }, + { "6 Novice", "Begin a novice installation (for beginners)", NULL, installNovice }, + { "7 Express", "Begin a quick installation (for the impatient)", NULL, installExpress }, + { "8 Custom", "Begin a custom installation (for experts)", NULL, dmenuSubmenu, NULL, &MenuInstallCustom }, + { "9 Fixit", "Enter repair mode with CDROM/floppy or start shell", NULL, dmenuSubmenu, NULL, &MenuFixit }, + { "U Upgrade", "Upgrade an existing system", NULL, installUpgrade }, + { "L Load Config","Load default install configuration", NULL, dispatch_load_floppy }, { "0 Index", "Glossary of functions", NULL, dmenuSubmenu, NULL, &MenuIndex }, { NULL } }, }; @@ -489,8 +489,6 @@ DMenu MenuMediaFTP = { VAR_FTP_PATH "=ftp://current.freebsd.org/pub/FreeBSD/" }, { "2.2 SNAP Server", "releng22.freebsd.org", NULL, dmenuSetVariable, NULL, VAR_FTP_PATH "=ftp://releng22.freebsd.org/pub/FreeBSD/" }, - { "2.1 SNAP Server", "releng210.freebsd.org", NULL, dmenuSetVariable, NULL, - VAR_FTP_PATH "=ftp://releng210.freebsd.org/pub/FreeBSD/" }, { "Argentina", "ftp.ar.freebsd.org", NULL, dmenuSetVariable, NULL, VAR_FTP_PATH "=ftp://ftp.ar.freebsd.org/pub/FreeBSD/" }, { "Australia", "ftp.au.freebsd.org", NULL, dmenuSetVariable, NULL, @@ -1214,7 +1212,7 @@ DMenu MenuNetworking = { { "Gateway", "This machine will route packets between interfaces", dmenuVarCheck, dmenuToggleVariable, NULL, "gateway_enable=YES" }, { "Ntpdate", "Select a clock-synchronization server", - dmenuVarCheck, dmenuSubmenu, NULL, &MenuNTP, '[', 'X', ']', "ntpdate_enable=YES" }, + dmenuVarCheck, dmenuSubmenu, NULL, &MenuNTP, '[', 'X', ']', (int)"ntpdate_enable=YES" }, { "router", "Select routing daemon (default: routed)", dmenuVarCheck, configRouter, NULL, "router" }, { "Rwhod", "This machine wants to run the rwho daemon", diff --git a/usr.sbin/sysinstall/nfs.c b/usr.sbin/sysinstall/nfs.c index 8ab7521..aeb1dc0 100644 --- a/usr.sbin/sysinstall/nfs.c +++ b/usr.sbin/sysinstall/nfs.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$ + * $Id: nfs.c,v 1.18 1997/02/22 14:12:14 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -42,11 +42,11 @@ #include Boolean NFSMounted; +static char mountpoint[] = "/dist"; Boolean mediaInitNFS(Device *dev) { - char *mountpoint = "/dist"; Device *netDevice = (Device *)dev->private; if (NFSMounted) @@ -68,43 +68,26 @@ mediaInitNFS(Device *dev) return FALSE; } NFSMounted = TRUE; - msgDebug("Mounted NFS device %s onto %s\n", dev->name, mountpoint); + if (isDebug()) + msgDebug("Mounted NFS device %s onto %s\n", dev->name, mountpoint); return TRUE; } FILE * mediaGetNFS(Device *dev, char *file, Boolean probe) { - char buf[PATH_MAX]; - - if (isDebug()) - msgDebug("Request for %s from NFS\n", file); - snprintf(buf, PATH_MAX, "/dist/%s", file); - if (file_readable(buf)) - return fopen(buf, "r"); - snprintf(buf, PATH_MAX, "/dist/dists/%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 mediaShutdownNFS(Device *dev) { - /* Device *netdev = (Device *)dev->private; */ - char *mountpoint = "/dist"; - if (!NFSMounted) return; + msgNotify("Unmounting NFS partition on %s", mountpoint); if (unmount(mountpoint, MNT_FORCE) != 0) msgConfirm("Could not unmount the NFS partition: %s", strerror(errno)); - msgDebug("Unmount of NFS partition successful\n"); - /* if (netdev) netdev->shutdown(netdev); */ NFSMounted = FALSE; return; } diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index 80833d0..2b027b0 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -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: sysinstall.h,v 1.150 1998/11/15 09:06:20 jkh Exp $ + * $Id: sysinstall.h,v 1.151 1998/11/24 00:18:56 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -584,6 +584,7 @@ extern Boolean mediaExtractDist(char *dir, char *dist, FILE *fp); extern Boolean mediaExtractDistBegin(char *dir, int *fd, int *zpid, int *cpic); extern Boolean mediaExtractDistEnd(int zpid, int cpid); extern Boolean mediaVerify(void); +extern FILE *mediaGenericGet(char *base, const char *file); /* misc.c */ extern Boolean file_readable(char *fname); diff --git a/usr.sbin/sysinstall/tape.c b/usr.sbin/sysinstall/tape.c index df39892..995a0fe 100644 --- a/usr.sbin/sysinstall/tape.c +++ b/usr.sbin/sysinstall/tape.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$ + * $Id: tape.c,v 1.19 1997/02/22 14:12:21 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -98,7 +98,7 @@ mediaGetTape(Device *dev, char *file, Boolean probe) if (file_readable(buf)) fp = fopen(buf, "r"); else { - sprintf(buf, "%s/dists/%s", (char *)dev->private, file); + sprintf(buf, "%s/releases/%s", (char *)dev->private, file); fp = fopen(buf, "r"); } /* Nuke the files behind us to save space */ @@ -112,8 +112,9 @@ mediaShutdownTape(Device *dev) { if (!tapeInitted) return; - if (file_readable(dev->private)) { - msgNotify("Cleaning up results of tape extract in %s..", dev->private); + if (file_readable((char *)dev->private)) { + msgNotify("Cleaning up results of tape extract in %s..", + (char *)dev->private); (void)vsystem("rm -rf %s", (char *)dev->private); } tapeInitted = FALSE; diff --git a/usr.sbin/sysinstall/ufs.c b/usr.sbin/sysinstall/ufs.c index 8f61cbe..73c0667 100644 --- a/usr.sbin/sysinstall/ufs.c +++ b/usr.sbin/sysinstall/ufs.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: ufs.c,v 1.12 1997/02/22 14:12:35 peter Exp $ + * $Id: ufs.c,v 1.13 1998/09/14 19:14:11 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -45,19 +45,5 @@ FILE * mediaGetUFS(Device *dev, char *file, Boolean probe) { - char buf[PATH_MAX]; - - if (isDebug()) - msgDebug("Request for %s from UFS\n", file); - snprintf(buf, PATH_MAX, "%s/%s", (char *)dev->private, file); - if (file_readable(buf)) - return fopen(buf, "r"); - snprintf(buf, PATH_MAX, "%s/dists/%s", (char *)dev->private, file); - if (file_readable(buf)) - return fopen(buf, "r"); - snprintf(buf, PATH_MAX, "%s/%s/%s", (char *)dev->private, variable_get(VAR_RELNAME), file); - if (file_readable(buf)) - return fopen(buf, "r"); - snprintf(buf, PATH_MAX, "%s/%s/dists/%s", (char *)dev->private, variable_get(VAR_RELNAME), file); - return fopen(buf, "r"); + return mediaGenericGet((char *)dev->private, file); } -- cgit v1.1