diff --git a/release/sysinstall/media.c b/release/sysinstall/media.c index 384e4198dd93..2d9ba187ef40 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.21 1995/05/28 03:04:58 jkh Exp $ + * $Id: media.c,v 1.22 1995/05/29 11:01:27 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -232,7 +232,6 @@ mediaSetFTP(char *str) static Device ftpDevice; char *cp; - tcpDeviceSelect(NULL); dmenuOpenSimple(&MenuMediaFTP); cp = getenv("ftp"); if (!cp) @@ -244,9 +243,9 @@ mediaSetFTP(char *str) else variable_set2("ftp", cp); } - + tcpDeviceSelect(NULL); strcpy(ftpDevice.name, cp); - ftpDevice.type = DEVICE_TYPE_NETWORK; + ftpDevice.type = DEVICE_TYPE_FTP; ftpDevice.init = mediaInitFTP; ftpDevice.get = mediaGetFTP; ftpDevice.close = mediaCloseFTP; @@ -282,12 +281,13 @@ mediaSetNFS(char *str) val = msgGetInput(NULL, "Please enter the full NFS file specification for the remote\nhost and directory containing the FreeBSD distribution files.\nThis should be in the format: hostname:/some/freebsd/dir"); if (!val) return 0; - strcpy(nfsDevice.name, "nfs"); + tcpDeviceSelect(NULL); + strncpy(nfsDevice.name, val, DEV_NAME_MAX); nfsDevice.type = DEVICE_TYPE_NFS; nfsDevice.init = mediaInitNFS; nfsDevice.get = mediaGetNFS; nfsDevice.shutdown = mediaShutdownNFS; - nfsDevice.private = strdup(val); + nfsDevice.private = mediaDevice; mediaDevice = &nfsDevice; return 1; } diff --git a/release/sysinstall/menus.c b/release/sysinstall/menus.c index ed794a0fcb73..3008e982d7f0 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.38 1995/05/29 11:01:29 jkh Exp $ + * $Id: menus.c,v 1.39 1995/05/29 11:58:16 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -663,12 +663,13 @@ When you're done, select Cancel", }; DMenu MenuNetworking = { - DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, + DMENU_NORMAL_TYPE, "Network Services Menu", "You may have already configured one network device (and the\n\ other various hostname/gateway/name server parameters) in the process\n\ of installing FreeBSD. This menu allows you to configure other\n\ -aspects of your system's network configuration.", +aspects of your system's network configuration.\n\n\ +When you are done, select Cancel.", NULL, NULL, { { "NFS client", "This machine will be an NFS client", diff --git a/release/sysinstall/nfs.c b/release/sysinstall/nfs.c index 2ed22f64b64b..044e959f7722 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: media.c,v 1.21 1995/05/28 03:04:58 jkh Exp $ + * $Id: nfs.c,v 1.2 1995/05/29 11:01:35 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -53,17 +53,23 @@ Boolean NFSMounted; Boolean mediaInitNFS(Device *dev) { + Device *netDevice = (Device *)dev->private; + if (NFSMounted) return TRUE; + if (netDevice->init) + if (!(*netDevice->init)(netDevice)) + return FALSE; + if (Mkdir("/nfs", NULL)) return FALSE; if (!vsystem("mount_nfs %s %s %s /nfs", getenv("nfsSlowPC") ? "-r 1024 -w 1024" : "", - getenv("nfsServerSecure") ? "-P" : "", dev->private)) + getenv("nfsServerSecure") ? "-P" : "", dev->name)) return TRUE; else { - msgConfirm("Error mounting %s on /nfs: %s (%u)\n", dev->private, strerror(errno), errno); + msgConfirm("Error mounting %s on /nfs: %s (%u)\n", dev->name, strerror(errno), errno); return FALSE; } NFSMounted = TRUE; @@ -85,6 +91,8 @@ mediaGetNFS(char *file) void mediaShutdownNFS(Device *dev) { + Device *netdev = (Device *)dev->private; + if (!NFSMounted) return; msgDebug("Unmounting /nfs\n"); @@ -92,6 +100,8 @@ mediaShutdownNFS(Device *dev) msgConfirm("Could not unmount the NFS partition: %s\n", strerror(errno)); if (isDebug()) msgDebug("Unmount returned\n"); + if (netdev->shutdown) + (*netdev->shutdown)(netdev); NFSMounted = FALSE; return; } diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c index ed794a0fcb73..3008e982d7f0 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.38 1995/05/29 11:01:29 jkh Exp $ + * $Id: menus.c,v 1.39 1995/05/29 11:58:16 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -663,12 +663,13 @@ When you're done, select Cancel", }; DMenu MenuNetworking = { - DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, + DMENU_NORMAL_TYPE, "Network Services Menu", "You may have already configured one network device (and the\n\ other various hostname/gateway/name server parameters) in the process\n\ of installing FreeBSD. This menu allows you to configure other\n\ -aspects of your system's network configuration.", +aspects of your system's network configuration.\n\n\ +When you are done, select Cancel.", NULL, NULL, { { "NFS client", "This machine will be an NFS client", diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c index 384e4198dd93..2d9ba187ef40 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.21 1995/05/28 03:04:58 jkh Exp $ + * $Id: media.c,v 1.22 1995/05/29 11:01:27 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -232,7 +232,6 @@ mediaSetFTP(char *str) static Device ftpDevice; char *cp; - tcpDeviceSelect(NULL); dmenuOpenSimple(&MenuMediaFTP); cp = getenv("ftp"); if (!cp) @@ -244,9 +243,9 @@ mediaSetFTP(char *str) else variable_set2("ftp", cp); } - + tcpDeviceSelect(NULL); strcpy(ftpDevice.name, cp); - ftpDevice.type = DEVICE_TYPE_NETWORK; + ftpDevice.type = DEVICE_TYPE_FTP; ftpDevice.init = mediaInitFTP; ftpDevice.get = mediaGetFTP; ftpDevice.close = mediaCloseFTP; @@ -282,12 +281,13 @@ mediaSetNFS(char *str) val = msgGetInput(NULL, "Please enter the full NFS file specification for the remote\nhost and directory containing the FreeBSD distribution files.\nThis should be in the format: hostname:/some/freebsd/dir"); if (!val) return 0; - strcpy(nfsDevice.name, "nfs"); + tcpDeviceSelect(NULL); + strncpy(nfsDevice.name, val, DEV_NAME_MAX); nfsDevice.type = DEVICE_TYPE_NFS; nfsDevice.init = mediaInitNFS; nfsDevice.get = mediaGetNFS; nfsDevice.shutdown = mediaShutdownNFS; - nfsDevice.private = strdup(val); + nfsDevice.private = mediaDevice; mediaDevice = &nfsDevice; return 1; } diff --git a/usr.sbin/sysinstall/menus.c b/usr.sbin/sysinstall/menus.c index ed794a0fcb73..3008e982d7f0 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.38 1995/05/29 11:01:29 jkh Exp $ + * $Id: menus.c,v 1.39 1995/05/29 11:58:16 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -663,12 +663,13 @@ When you're done, select Cancel", }; DMenu MenuNetworking = { - DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, + DMENU_NORMAL_TYPE, "Network Services Menu", "You may have already configured one network device (and the\n\ other various hostname/gateway/name server parameters) in the process\n\ of installing FreeBSD. This menu allows you to configure other\n\ -aspects of your system's network configuration.", +aspects of your system's network configuration.\n\n\ +When you are done, select Cancel.", NULL, NULL, { { "NFS client", "This machine will be an NFS client", diff --git a/usr.sbin/sysinstall/nfs.c b/usr.sbin/sysinstall/nfs.c index 2ed22f64b64b..044e959f7722 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: media.c,v 1.21 1995/05/28 03:04:58 jkh Exp $ + * $Id: nfs.c,v 1.2 1995/05/29 11:01:35 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -53,17 +53,23 @@ Boolean NFSMounted; Boolean mediaInitNFS(Device *dev) { + Device *netDevice = (Device *)dev->private; + if (NFSMounted) return TRUE; + if (netDevice->init) + if (!(*netDevice->init)(netDevice)) + return FALSE; + if (Mkdir("/nfs", NULL)) return FALSE; if (!vsystem("mount_nfs %s %s %s /nfs", getenv("nfsSlowPC") ? "-r 1024 -w 1024" : "", - getenv("nfsServerSecure") ? "-P" : "", dev->private)) + getenv("nfsServerSecure") ? "-P" : "", dev->name)) return TRUE; else { - msgConfirm("Error mounting %s on /nfs: %s (%u)\n", dev->private, strerror(errno), errno); + msgConfirm("Error mounting %s on /nfs: %s (%u)\n", dev->name, strerror(errno), errno); return FALSE; } NFSMounted = TRUE; @@ -85,6 +91,8 @@ mediaGetNFS(char *file) void mediaShutdownNFS(Device *dev) { + Device *netdev = (Device *)dev->private; + if (!NFSMounted) return; msgDebug("Unmounting /nfs\n"); @@ -92,6 +100,8 @@ mediaShutdownNFS(Device *dev) msgConfirm("Could not unmount the NFS partition: %s\n", strerror(errno)); if (isDebug()) msgDebug("Unmount returned\n"); + if (netdev->shutdown) + (*netdev->shutdown)(netdev); NFSMounted = FALSE; return; }