diff options
author | Jordan K. Hubbard <jkh@FreeBSD.org> | 1996-12-08 12:27:58 +0000 |
---|---|---|
committer | Jordan K. Hubbard <jkh@FreeBSD.org> | 1996-12-08 12:27:58 +0000 |
commit | ba5555f0e64be223addf772bb3a13733f8d15d83 (patch) | |
tree | 8648139dc4eb497c395e1a22bf82b327bf3d4481 /usr.sbin | |
parent | 5703427770eb6696740443850ffdfd9aa2c52e99 (diff) | |
download | src-ba5555f0e64be223addf772bb3a13733f8d15d83.tar.gz src-ba5555f0e64be223addf772bb3a13733f8d15d83.zip |
Several areas of improvement:
o Incorporate some of Tatsumi's bug fixes.
o Remove the xperimnt and commerce distribution items; they haven't
been actual distributions for awhile.
o Try to sanitize the device checking code a little more.
o Cosmetic work on the network code.
Notes
Notes:
svn path=/head/; revision=20208
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/sade/devices.c | 31 | ||||
-rw-r--r-- | usr.sbin/sade/menus.c | 6 | ||||
-rw-r--r-- | usr.sbin/sysinstall/devices.c | 31 | ||||
-rw-r--r-- | usr.sbin/sysinstall/dist.c | 4 | ||||
-rw-r--r-- | usr.sbin/sysinstall/dist.h | 6 | ||||
-rw-r--r-- | usr.sbin/sysinstall/installUpgrade.c | 4 | ||||
-rw-r--r-- | usr.sbin/sysinstall/menus.c | 6 | ||||
-rw-r--r-- | usr.sbin/sysinstall/network.c | 17 |
8 files changed, 50 insertions, 55 deletions
diff --git a/usr.sbin/sade/devices.c b/usr.sbin/sade/devices.c index 3ab8e1a11fb1..56d9ec34974d 100644 --- a/usr.sbin/sade/devices.c +++ b/usr.sbin/sade/devices.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: devices.c,v 1.50 1996/11/15 19:53:08 jkh Exp $ + * $Id: devices.c,v 1.51 1996/11/27 01:01:52 joerg Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -80,7 +80,7 @@ static struct { { DEVICE_TYPE_NETWORK, "ppp", "Point-to-Point Protocol (PPP) interface" }, { DEVICE_TYPE_NETWORK, "de", "DEC DE435 PCI NIC or other DC21040-AA based card" }, { DEVICE_TYPE_NETWORK, "fxp", "Intel EtherExpress Pro/100B PCI Fast Ethernet card" }, - { DEVICE_TYPE_NETWORK, "ed", "WD/SMC 80xx; Novell NE1000/2000; 3Com 3C503 cards" }, + { DEVICE_TYPE_NETWORK, "ed", "WD/SMC 80xx; Novell NE1000/2000; 3Com 3C503 card" }, { DEVICE_TYPE_NETWORK, "ep", "3Com 3C509 ethernet card" }, { DEVICE_TYPE_NETWORK, "el", "3Com 3C501 ethernet card" }, { DEVICE_TYPE_NETWORK, "fe", "Fujitsu MB86960A/MB86965A ethernet card" }, @@ -200,7 +200,7 @@ deviceGetAll(void) msgFatal("Unable to open disk %s", names[i]); (void)deviceRegister(names[i], names[i], d->name, DEVICE_TYPE_DISK, FALSE, NULL, NULL, NULL, NULL, d); - msgDebug("Found a device of type disk named: %s\n", names[i]); + msgDebug("Found a disk device named %s\n", names[i]); /* Look for existing DOS partitions to register */ for (c1 = d->chunks->part; c1; c1 = c1->next) { @@ -227,11 +227,11 @@ deviceGetAll(void) s = socket(AF_INET, SOCK_DGRAM, 0); if (s < 0) { msgConfirm("ifconfig: socket"); - return; + goto skipif; /* Jump over network iface probing */ } if (ioctl(s, SIOCGIFCONF, (char *) &ifc) < 0) { msgConfirm("ifconfig (SIOCGIFCONF)"); - return; + goto skipif; /* Jump over network iface probing */ } ifflags = ifc.ifc_req->ifr_flags; end = (struct ifreq *) (ifc.ifc_buf + ifc.ifc_len); @@ -241,12 +241,13 @@ deviceGetAll(void) /* If it's not a link entry, forget it */ if (ifptr->ifr_ifru.ifru_addr.sa_family != AF_LINK) continue; + /* Eliminate network devices that don't make sense */ - if (!strncmp(ifptr->ifr_name, "tun", 3) - || !strncmp(ifptr->ifr_name, "lo0", 3)) + if (!strncmp(ifptr->ifr_name, "tun", 3) || !strncmp(ifptr->ifr_name, "lo0", 3)) continue; - descr = NULL; - for (i = 0; device_names[i].name; i++) { + + /* Try and find its description */ + for (i = 0, descr = NULL; device_names[i].name; i++) { int len = strlen(device_names[i].name); if (!strncmp(ifptr->ifr_name, device_names[i].name, len)) { @@ -256,9 +257,10 @@ deviceGetAll(void) } if (!descr) descr = "<unknown network interface type>"; + deviceRegister(ifptr->ifr_name, descr, strdup(ifptr->ifr_name), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, NULL, NULL, mediaShutdownNetwork, NULL); - msgDebug("Found a device of type network named: %s\n", ifptr->ifr_name); + msgDebug("Found a network device named %s\n", ifptr->ifr_name); close(s); if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { msgConfirm("ifconfig: socket"); @@ -268,6 +270,7 @@ deviceGetAll(void) ifptr = (struct ifreq *)((caddr_t)ifptr + ifptr->ifr_addr.sa_len - sizeof(struct sockaddr)); } +skipif: /* Finally, try to find all the types of devices one might need * during the second stage of the installation. */ @@ -283,7 +286,7 @@ deviceGetAll(void) (void)deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_CDROM, TRUE, mediaInitCDROM, mediaGetCDROM, NULL, mediaShutdownCDROM, NULL); - msgDebug("Found a device of type CDROM named: %s\n", device_names[i].name); + msgDebug("Found a CDROM device named %s\n", device_names[i].name); } break; @@ -293,7 +296,7 @@ deviceGetAll(void) if (fd) close(fd); deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_TAPE, TRUE, mediaInitTape, mediaGetTape, NULL, mediaShutdownTape, NULL); - msgDebug("Found a device of type TAPE named: %s\n", device_names[i].name); + msgDebug("Found a TAPE device named %s\n", device_names[i].name); } break; @@ -304,7 +307,7 @@ deviceGetAll(void) deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_FLOPPY, TRUE, mediaInitFloppy, mediaGetFloppy, NULL, mediaShutdownFloppy, NULL); - msgDebug("Found a device of type floppy named: %s\n", device_names[i].name); + msgDebug("Found a floppy device named %s\n", device_names[i].name); } break; @@ -327,7 +330,7 @@ deviceGetAll(void) sprintf(newdesc, cp, "PPP interface"); deviceRegister("ppp0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, NULL, NULL, mediaShutdownNetwork, NULL); - msgDebug("Found a device of type network named: %s\n", device_names[i].name); + msgDebug("Found a serial network device named %s on %s\n", device_names[i].name, try); } break; diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c index 46fc43a9e824..dc20fcfb82f3 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.97 1996/11/27 12:44:43 jkh Exp $ + * $Id: menus.c,v 1.98 1996/11/29 23:52:20 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -641,8 +641,6 @@ DMenu MenuSubDistributions = { NULL, { { "bin", "Binary base distribution (required) [36M]", dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_BIN }, - { "commerce", "Commercial and shareware demos [10M]", - dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_COMMERCIAL }, { "compat1x", "FreeBSD 1.x binary compatibility [2M]", dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_COMPAT1X }, { "compat20", "FreeBSD 2.0 binary compatibility [2M]", @@ -667,8 +665,6 @@ DMenu MenuSubDistributions = { srcFlagCheck, distSetSrc }, { "XFree86", "The XFree86 3.2 distribution", x11FlagCheck, distSetXF86 }, - { "xperimnt", "Experimental work in progress!", - dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_EXPERIMENTAL }, { "All", "All sources, binaries and XFree86 binaries [700M]", NULL, distSetEverything, NULL, NULL, ' ', ' ', ' ' }, { "Clear", "Reset all of the above [0M]", diff --git a/usr.sbin/sysinstall/devices.c b/usr.sbin/sysinstall/devices.c index 3ab8e1a11fb1..56d9ec34974d 100644 --- a/usr.sbin/sysinstall/devices.c +++ b/usr.sbin/sysinstall/devices.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: devices.c,v 1.50 1996/11/15 19:53:08 jkh Exp $ + * $Id: devices.c,v 1.51 1996/11/27 01:01:52 joerg Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -80,7 +80,7 @@ static struct { { DEVICE_TYPE_NETWORK, "ppp", "Point-to-Point Protocol (PPP) interface" }, { DEVICE_TYPE_NETWORK, "de", "DEC DE435 PCI NIC or other DC21040-AA based card" }, { DEVICE_TYPE_NETWORK, "fxp", "Intel EtherExpress Pro/100B PCI Fast Ethernet card" }, - { DEVICE_TYPE_NETWORK, "ed", "WD/SMC 80xx; Novell NE1000/2000; 3Com 3C503 cards" }, + { DEVICE_TYPE_NETWORK, "ed", "WD/SMC 80xx; Novell NE1000/2000; 3Com 3C503 card" }, { DEVICE_TYPE_NETWORK, "ep", "3Com 3C509 ethernet card" }, { DEVICE_TYPE_NETWORK, "el", "3Com 3C501 ethernet card" }, { DEVICE_TYPE_NETWORK, "fe", "Fujitsu MB86960A/MB86965A ethernet card" }, @@ -200,7 +200,7 @@ deviceGetAll(void) msgFatal("Unable to open disk %s", names[i]); (void)deviceRegister(names[i], names[i], d->name, DEVICE_TYPE_DISK, FALSE, NULL, NULL, NULL, NULL, d); - msgDebug("Found a device of type disk named: %s\n", names[i]); + msgDebug("Found a disk device named %s\n", names[i]); /* Look for existing DOS partitions to register */ for (c1 = d->chunks->part; c1; c1 = c1->next) { @@ -227,11 +227,11 @@ deviceGetAll(void) s = socket(AF_INET, SOCK_DGRAM, 0); if (s < 0) { msgConfirm("ifconfig: socket"); - return; + goto skipif; /* Jump over network iface probing */ } if (ioctl(s, SIOCGIFCONF, (char *) &ifc) < 0) { msgConfirm("ifconfig (SIOCGIFCONF)"); - return; + goto skipif; /* Jump over network iface probing */ } ifflags = ifc.ifc_req->ifr_flags; end = (struct ifreq *) (ifc.ifc_buf + ifc.ifc_len); @@ -241,12 +241,13 @@ deviceGetAll(void) /* If it's not a link entry, forget it */ if (ifptr->ifr_ifru.ifru_addr.sa_family != AF_LINK) continue; + /* Eliminate network devices that don't make sense */ - if (!strncmp(ifptr->ifr_name, "tun", 3) - || !strncmp(ifptr->ifr_name, "lo0", 3)) + if (!strncmp(ifptr->ifr_name, "tun", 3) || !strncmp(ifptr->ifr_name, "lo0", 3)) continue; - descr = NULL; - for (i = 0; device_names[i].name; i++) { + + /* Try and find its description */ + for (i = 0, descr = NULL; device_names[i].name; i++) { int len = strlen(device_names[i].name); if (!strncmp(ifptr->ifr_name, device_names[i].name, len)) { @@ -256,9 +257,10 @@ deviceGetAll(void) } if (!descr) descr = "<unknown network interface type>"; + deviceRegister(ifptr->ifr_name, descr, strdup(ifptr->ifr_name), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, NULL, NULL, mediaShutdownNetwork, NULL); - msgDebug("Found a device of type network named: %s\n", ifptr->ifr_name); + msgDebug("Found a network device named %s\n", ifptr->ifr_name); close(s); if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { msgConfirm("ifconfig: socket"); @@ -268,6 +270,7 @@ deviceGetAll(void) ifptr = (struct ifreq *)((caddr_t)ifptr + ifptr->ifr_addr.sa_len - sizeof(struct sockaddr)); } +skipif: /* Finally, try to find all the types of devices one might need * during the second stage of the installation. */ @@ -283,7 +286,7 @@ deviceGetAll(void) (void)deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_CDROM, TRUE, mediaInitCDROM, mediaGetCDROM, NULL, mediaShutdownCDROM, NULL); - msgDebug("Found a device of type CDROM named: %s\n", device_names[i].name); + msgDebug("Found a CDROM device named %s\n", device_names[i].name); } break; @@ -293,7 +296,7 @@ deviceGetAll(void) if (fd) close(fd); deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_TAPE, TRUE, mediaInitTape, mediaGetTape, NULL, mediaShutdownTape, NULL); - msgDebug("Found a device of type TAPE named: %s\n", device_names[i].name); + msgDebug("Found a TAPE device named %s\n", device_names[i].name); } break; @@ -304,7 +307,7 @@ deviceGetAll(void) deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_FLOPPY, TRUE, mediaInitFloppy, mediaGetFloppy, NULL, mediaShutdownFloppy, NULL); - msgDebug("Found a device of type floppy named: %s\n", device_names[i].name); + msgDebug("Found a floppy device named %s\n", device_names[i].name); } break; @@ -327,7 +330,7 @@ deviceGetAll(void) sprintf(newdesc, cp, "PPP interface"); deviceRegister("ppp0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, NULL, NULL, mediaShutdownNetwork, NULL); - msgDebug("Found a device of type network named: %s\n", device_names[i].name); + msgDebug("Found a serial network device named %s on %s\n", device_names[i].name, try); } break; diff --git a/usr.sbin/sysinstall/dist.c b/usr.sbin/sysinstall/dist.c index 58a95c362f01..7ecd8ddc1a2b 100644 --- a/usr.sbin/sysinstall/dist.c +++ b/usr.sbin/sysinstall/dist.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: dist.c,v 1.78 1996/11/09 19:26:01 jkh Exp $ + * $Id: dist.c,v 1.79 1996/11/09 19:47:24 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -73,8 +73,6 @@ static Distribution DistTable[] = { { "compat1x", "/", &Dists, DIST_COMPAT1X, NULL }, { "compat20", "/", &Dists, DIST_COMPAT20, NULL }, { "compat21", "/", &Dists, DIST_COMPAT21, NULL }, -{ "commerce", "/usr/local", &Dists, DIST_COMMERCIAL, NULL }, -{ "xperimnt", "/usr/local", &Dists, DIST_EXPERIMENTAL, NULL }, { "XF8632", "/usr", &Dists, DIST_XF86, XF86DistTable }, { NULL }, }; diff --git a/usr.sbin/sysinstall/dist.h b/usr.sbin/sysinstall/dist.h index 58f35c7cd828..3f34f068257f 100644 --- a/usr.sbin/sysinstall/dist.h +++ b/usr.sbin/sysinstall/dist.h @@ -14,10 +14,8 @@ #define DIST_COMPAT20 0x0200 #define DIST_COMPAT21 0x0400 #define DIST_XF86 0x0800 -#define DIST_COMMERCIAL 0x1000 -#define DIST_DES 0x2000 -#define DIST_EXPERIMENTAL 0x4000 -#define DIST_ALL 0xFFFF +#define DIST_DES 0x1000 +#define DIST_ALL 0x1FFF /* Canned distribution sets */ #define _DIST_DEVELOPER \ diff --git a/usr.sbin/sysinstall/installUpgrade.c b/usr.sbin/sysinstall/installUpgrade.c index 4c87a6f3da5a..5438e8e50534 100644 --- a/usr.sbin/sysinstall/installUpgrade.c +++ b/usr.sbin/sysinstall/installUpgrade.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: installUpgrade.c,v 1.32 1996/09/18 18:40:37 jkh Exp $ + * $Id: installUpgrade.c,v 1.33 1996/10/09 09:53:35 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -291,7 +291,7 @@ installUpgrade(dialogMenuItem *self) msgNotify("Preserving /etc directory.."); if (vsystem("tar -cf - -C /etc . | tar -xpf - -C %s", saved_etc)) if (msgYesNo("Unable to backup your /etc into %s.\n" - "Do you want to continue anyway?") != 0) + "Do you want to continue anyway?", saved_etc) != 0) return DITEM_FAILURE | DITEM_RECREATE; } if (file_readable("/kernel")) { diff --git a/usr.sbin/sysinstall/menus.c b/usr.sbin/sysinstall/menus.c index 46fc43a9e824..dc20fcfb82f3 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.97 1996/11/27 12:44:43 jkh Exp $ + * $Id: menus.c,v 1.98 1996/11/29 23:52:20 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -641,8 +641,6 @@ DMenu MenuSubDistributions = { NULL, { { "bin", "Binary base distribution (required) [36M]", dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_BIN }, - { "commerce", "Commercial and shareware demos [10M]", - dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_COMMERCIAL }, { "compat1x", "FreeBSD 1.x binary compatibility [2M]", dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_COMPAT1X }, { "compat20", "FreeBSD 2.0 binary compatibility [2M]", @@ -667,8 +665,6 @@ DMenu MenuSubDistributions = { srcFlagCheck, distSetSrc }, { "XFree86", "The XFree86 3.2 distribution", x11FlagCheck, distSetXF86 }, - { "xperimnt", "Experimental work in progress!", - dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_EXPERIMENTAL }, { "All", "All sources, binaries and XFree86 binaries [700M]", NULL, distSetEverything, NULL, NULL, ' ', ' ', ' ' }, { "Clear", "Reset all of the above [0M]", diff --git a/usr.sbin/sysinstall/network.c b/usr.sbin/sysinstall/network.c index 01868494fea0..e0d46810e931 100644 --- a/usr.sbin/sysinstall/network.c +++ b/usr.sbin/sysinstall/network.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: network.c,v 1.15 1996/07/08 10:08:16 jkh Exp $ + * $Id: network.c,v 1.16 1996/08/03 10:11:26 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -106,7 +106,7 @@ mediaInitNetwork(Device *dev) "in the Networking configuration menu before proceeding.", dev->name); return FALSE; } - msgNotify("Configuring network device %s.", dev->name); + msgNotify("ifconfig %s %s", dev->name, cp); i = vsystem("ifconfig %s %s", dev->name, cp); if (i) { msgConfirm("Unable to configure the %s interface!\n" @@ -123,7 +123,8 @@ mediaInitNetwork(Device *dev) msgNotify("Adding default route to %s.", rp); vsystem("route add default %s", rp); } - msgDebug("Network initialized successfully.\n"); + if (isDebug()) + msgDebug("Network initialized successfully.\n"); networkInitialized = TRUE; return TRUE; } @@ -136,7 +137,8 @@ mediaShutdownNetwork(Device *dev) if (!RunningAsInit || !networkInitialized) return; - msgDebug("Shutdown called for network device %s\n", dev->name); + if (isDebug()) + msgDebug("Shutdown called for network device %s\n", dev->name); /* Not a serial device? */ if (strncmp("sl", dev->name, 2) && strncmp("ppp", dev->name, 3)) { int i; @@ -146,7 +148,7 @@ mediaShutdownNetwork(Device *dev) cp = variable_get(ifconfig); if (!cp) return; - msgNotify("Shutting interface %s down.", dev->name); + msgNotify("ifconfig %s down", dev->name); i = vsystem("ifconfig %s down", dev->name); if (i) msgConfirm("Warning: Unable to down the %s interface properly", dev->name); @@ -155,14 +157,13 @@ mediaShutdownNetwork(Device *dev) msgNotify("Deleting default route."); vsystem("route delete default"); } - networkInitialized = FALSE; } else if (dev->private) { /* ppp sticks its PID there */ - msgNotify("Killing PPP process %d.", (int)dev->private); + msgNotify("Killing previous PPP process %d.", (int)dev->private); kill((pid_t)dev->private, SIGTERM); dev->private = NULL; - networkInitialized = FALSE; } + networkInitialized = FALSE; } /* Start PPP on the 3rd screen */ |