summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sade
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-05-26 19:28:06 +0000
committerjkh <jkh@FreeBSD.org>1995-05-26 19:28:06 +0000
commit6b747bddcf3bf43203ec4f1d5388a4bb11d6f6e3 (patch)
tree997fee1538b557fbf986fbd9bdde12b7d18b2206 /usr.sbin/sade
parentc6563af053bb945798648d329cceeba5bccbce41 (diff)
downloadFreeBSD-src-6b747bddcf3bf43203ec4f1d5388a4bb11d6f6e3.zip
FreeBSD-src-6b747bddcf3bf43203ec4f1d5388a4bb11d6f6e3.tar.gz
Clean up the configuration stuff a bit more - we should now populate
/etc with good things(tm). Fire off ppp with all the proper initial options set.
Diffstat (limited to 'usr.sbin/sade')
-rw-r--r--usr.sbin/sade/config.c69
-rw-r--r--usr.sbin/sade/menus.c18
-rw-r--r--usr.sbin/sade/sade.h10
-rw-r--r--usr.sbin/sade/system.c10
4 files changed, 83 insertions, 24 deletions
diff --git a/usr.sbin/sade/config.c b/usr.sbin/sade/config.c
index 8e72ebd..a9a6637 100644
--- a/usr.sbin/sade/config.c
+++ b/usr.sbin/sade/config.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: config.c,v 1.6 1995/05/25 18:48:22 jkh Exp $
+ * $Id: config.c,v 1.7 1995/05/26 08:41:35 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -43,6 +43,7 @@
#include "sysinstall.h"
#include <sys/disklabel.h>
+#include <sys/wait.h>
static Chunk *chunk_list[MAX_CHUNKS];
static int nchunks;
@@ -179,7 +180,7 @@ configFstab(void)
}
Mkdir("/proc", NULL);
- fprintf(fstab, "proc\t\t\t/proc\t\tprocfs rw 0 0\n");
+ fprintf(fstab, "proc\t\t\t\t/proc\t\tprocfs rw 0 0\n");
/* Now look for the CDROMs */
devs = deviceFind(NULL, DEVICE_TYPE_CDROM);
@@ -251,8 +252,28 @@ configSysconfig(void)
msgConfirm("Unable to re-write /etc/sysconfig file! Things may work\nrather strangely as a result of this.");
return;
}
- for (i = 0; i < nlines; i++)
+ for (i = 0; i < nlines; i++) {
fprintf(fp, lines[i]);
+ free(lines[i]);
+
+ /* Stand by for bogus special case handling - we try to dump the interface specs here */
+ if (!strncmp(lines[i], VAR_INTERFACES, strlen(VAR_INTERFACES))) {
+ Device **devp;
+ int j, cnt;
+
+ devp = deviceFind(NULL, DEVICE_TYPE_NETWORK);
+ cnt = deviceCount(devp);
+ for (j = 0; j < cnt; j++) {
+ if (devp[j]->private) {
+ char iname[64];
+
+ snprintf(iname, 64, "%s%s", VAR_IFCONFIG, devp[j]->name);
+ if (getenv(iname))
+ fprintf(fp, "%s=%s\n", iname, getenv(iname));
+ }
+ }
+ }
+ }
fclose(fp);
}
@@ -290,21 +311,57 @@ configResolv(void)
fprintf(fp, "nameserver\t%s\n", getenv(VAR_NAMESERVER));
msgNotify("Wrote /etc/resolv.conf");
fclose(fp);
+ if (getenv(VAR_IPADDR)) {
+ fp = fopen("/etc/hosts", "a");
+ fprintf(fp, "%s\t\t%s\n", getenv(VAR_IPADDR), getenv(VAR_HOSTNAME));
+ fclose(fp);
+ }
alreadyDone = TRUE;
}
int
configPackages(char *str)
{
+ int i, pstat;
+ pid_t pid;
+ Boolean onCD;
+
+ onCD = FALSE;
+ i = -1;
if (!mediaDevice || mediaDevice->type != DEVICE_TYPE_CDROM) {
if (getpid() == 1) {
if (!mediaSetCDROM(NULL))
- return 0;
+ onCD = FALSE;
else
- vsystem("pkg_manage /cdrom");
+ onCD = TRUE;
+ }
+ else
+ onCD = FALSE;
+ }
+ else if (mediaDevice && mediaDevice->type == DEVICE_TYPE_CDROM)
+ onCD = TRUE;
+ if (onCD) {
+ if (!(pid = fork())) {
+ execl("/stand/sh", "sh", "-c", "pkg_manage /cdrom", (char *)NULL);
+ exit(1);
+ }
+ else {
+ pid = waitpid(pid, (int *)&pstat, 0);
+ i = (pid == -1) ? -1 : WEXITSTATUS(pstat);
+ }
+ }
+ else {
+ if (!(pid = fork())) {
+ execl("/stand/sh", "sh", "-c", "pkg_manage", (char *)NULL);
+ exit(1);
+ }
+ else {
+ pid = waitpid(pid, (int *)&pstat, 0);
+ i = (pid == -1) ? -1 : WEXITSTATUS(pstat);
}
}
- vsystem("pkg_manage");
+ if (i != 0)
+ msgDebug("pkg_manage returns status of %d\n", i);
return 0;
}
diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c
index 0bf0160..f47e144 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.31 1995/05/26 08:41:46 jkh Exp $
+ * $Id: menus.c,v 1.32 1995/05/26 11:21:53 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -640,21 +640,21 @@ When you're done, select Cancel",
"Press F1 for more information on these options",
"configure.hlp",
{ { "Add User", "Add users to the system",
- DMENU_SYSTEM_COMMAND, "adduser", 0, 0 },
+ DMENU_SYSTEM_COMMAND, "adduser", 0, 0 },
{ "Networking", "Configure additional network devices",
- DMENU_CALL, tcpDeviceSelect, 0, 0 },
+ DMENU_CALL, tcpDeviceSelect, 0, 0 },
{ "Time Zone", "Set which time zone you're in",
- DMENU_SYSTEM_COMMAND, "tzsetup", 0, 0 },
+ DMENU_SYSTEM_COMMAND, "tzsetup", 0, 0 },
{ "Packages", "Install extra FreeBSD packaged software",
- DMENU_CALL, configPackages, 0, 0 },
+ DMENU_CALL, configPackages, 0, 0 },
{ "Ports", "Enable the FreeBSD Ports Collection from CD",
DMENU_CALL, configPorts, 0, 1 },
{ "Root Password", "Set the system manager's password",
- DMENU_SYSTEM_COMMAND, "passwd root", 0, 0 },
+ DMENU_SYSTEM_COMMAND, "passwd root", 0, 0 },
{ "Screen", "Customize system console behavior",
- DMENU_SUBMENU, &MenuSyscons, 0, 0 },
+ DMENU_SUBMENU, &MenuSyscons, 0, 0 },
{ "Sysconfig", "Edit the system configuration file (with vi)",
- DMENU_SYSTEM_COMMAND, "vi /etc/sysconfig", 0, 0 },
+ DMENU_SYSTEM_COMMAND, "vi /etc/sysconfig", 0, 0 },
{ "XFree86", "Configure XFree86 (if installed)",
DMENU_SYSTEM_COMMAND, "PATH=/usr/bin:/bin:/usr/X11R6/bin xf86config", 0, 0 },
{ NULL } },
@@ -667,7 +667,7 @@ DMenu MenuSyscons = {
number of configuration options which may be set according to\n\
your preference. When you are done setting configuration options,\n\
select Cancel.",
- NULL,
+ "Configure your screen saver settings",
NULL,
{ { "blank", "Screen-blanking saver",
DMENU_SET_VARIABLE, "saver=star", 0, 0 },
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index abaae20..6dd558c 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.33 1995/05/25 18:48:30 jkh Exp $
+ * $Id: sysinstall.h,v 1.34 1995/05/26 08:41:48 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -90,9 +90,11 @@
#define VAR_HOSTNAME "hostname"
#define VAR_DOMAINNAME "domainname"
#define VAR_NAMESERVER "nameserver"
-#define VAR_GATEWAY "gateway"
+#define VAR_GATEWAY "defaultrouter"
+#define VAR_IPADDR "ipaddr"
#define VAR_IFCONFIG "ifconfig_"
+#define VAR_INTERFACES "network_interfaces"
/* The help file for the TCP/IP setup screen */
#define TCP_HELPFILE "tcp.hlp"
@@ -398,9 +400,9 @@ extern void systemChangeScreenmap(const u_char newmap[]);
extern int vsystem(char *fmt, ...);
/* tcpip.c */
-extern int tcpOpenDialog(Device *);
+extern int tcpOpenDialog(Device *dev);
extern int tcpDeviceSelect(char *str);
-extern Boolean tcpStartPPP(void);
+extern Boolean tcpStartPPP(Device *dev);
/* termcap.c */
extern int set_termcap(void);
diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c
index 2fdb0a7..3ce3555 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.34 1995/05/25 18:48:31 jkh Exp $
+ * $Id: system.c,v 1.35 1995/05/26 08:41:49 jkh Exp $
*
* Jordan Hubbard
*
@@ -71,7 +71,7 @@ systemInitialize(int argc, char **argv)
i = ioctl(0, TIOCSCTTY, (char *)NULL);
setlogin("root");
- setenv("PATH", "/stand:/bin:/sbin:/usr/sbin:/mnt/bin:/mnt/sbin:/mnt/usr/sbin:/mnt/usr/bin", 1);
+ setenv("PATH", "/stand:/bin:/sbin:/usr/sbin:/usr/bin:/mnt/bin:/mnt/sbin:/mnt/usr/sbin:/mnt/usr/bin", 1);
setbuf(stdin, 0);
setbuf(stderr, 0);
}
@@ -279,7 +279,7 @@ int
vsystem(char *fmt, ...)
{
va_list args;
- union wait pstat;
+ int pstat;
pid_t pid;
int omask;
sig_t intsave, quitsave;
@@ -343,11 +343,11 @@ vsystem(char *fmt, ...)
}
intsave = signal(SIGINT, SIG_IGN);
quitsave = signal(SIGQUIT, SIG_IGN);
- pid = waitpid(pid, (int *)&pstat, 0);
+ pid = waitpid(pid, &pstat, 0);
(void)sigsetmask(omask);
(void)signal(SIGINT, intsave);
(void)signal(SIGQUIT, quitsave);
- i = (pid == -1) ? -1 : pstat.w_status;
+ i = (pid == -1) ? -1 : WEXITSTATUS(pstat);
msgDebug("Command `%s' returns status of %d\n", cmd, i);
free(cmd);
return i;
OpenPOWER on IntegriCloud