summaryrefslogtreecommitdiffstats
path: root/release
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 /release
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 'release')
-rw-r--r--release/sysinstall/config.c69
-rw-r--r--release/sysinstall/ftp.c4
-rw-r--r--release/sysinstall/media_strategy.c7
-rw-r--r--release/sysinstall/menus.c18
-rw-r--r--release/sysinstall/sysinstall.h10
-rw-r--r--release/sysinstall/system.c10
-rw-r--r--release/sysinstall/tcpip.c40
7 files changed, 125 insertions, 33 deletions
diff --git a/release/sysinstall/config.c b/release/sysinstall/config.c
index 8e72ebd..a9a6637 100644
--- a/release/sysinstall/config.c
+++ b/release/sysinstall/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/release/sysinstall/ftp.c b/release/sysinstall/ftp.c
index 937f596..02e6c19 100644
--- a/release/sysinstall/ftp.c
+++ b/release/sysinstall/ftp.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: ftp.c,v 1.8 1995/05/24 19:31:26 phk Exp $
+ * $Id: ftp.c,v 1.9 1995/05/25 06:15:38 phk Exp $
*
*/
@@ -229,10 +229,12 @@ FtpOpen(FTP_t ftp, char *host, char *user, char *passwd)
ftp->state = isopen;
return 0;
+#if 0
fail:
close(ftp->fd_ctrl);
ftp->fd_ctrl = -1;
return -1;
+#endif
}
void
diff --git a/release/sysinstall/media_strategy.c b/release/sysinstall/media_strategy.c
index 57e92d5..e168153 100644
--- a/release/sysinstall/media_strategy.c
+++ b/release/sysinstall/media_strategy.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_strategy.c,v 1.25 1995/05/26 10:58:51 jkh Exp $
+ * $Id: media_strategy.c,v 1.26 1995/05/26 11:21:49 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -554,10 +554,7 @@ mediaInitNetwork(Device *dev)
configResolv();
if (!strncmp("cuaa", dev->name, 4)) {
- if (tcpStartPPP()) {
- msgConfirm("You have selected a serial device as your network installation device.\nThe PPP dialer is now running on the 3rd screen (type ALT-F3 to interact\nwith it) and should be used to establish the link BEFORE YOU HIT RETURN\nhere! Once you hit return in this screen (type ALT-F1 to return to this\nscreen from the PPP screen) the installation will assume that your link\nis set up and begin transfering the distributions over PPP.");
- }
- else {
+ if (!tcpStartPPP(dev)) {
msgConfirm("Unable to start PPP! This installation method\ncannot be used.");
return FALSE;
}
diff --git a/release/sysinstall/menus.c b/release/sysinstall/menus.c
index 0bf0160..f47e144 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.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/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h
index abaae20..6dd558c 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.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/release/sysinstall/system.c b/release/sysinstall/system.c
index 2fdb0a7..3ce3555 100644
--- a/release/sysinstall/system.c
+++ b/release/sysinstall/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;
diff --git a/release/sysinstall/tcpip.c b/release/sysinstall/tcpip.c
index 79e5d93..28483e0 100644
--- a/release/sysinstall/tcpip.c
+++ b/release/sysinstall/tcpip.c
@@ -1,5 +1,5 @@
/*
- * $Id: tcpip.c,v 1.14 1995/05/25 18:48:32 jkh Exp $
+ * $Id: tcpip.c,v 1.16 1995/05/26 08:58:35 jkh Exp $
*
* Copyright (c) 1995
* Gary J Palmer. All rights reserved.
@@ -421,6 +421,10 @@ tcpOpenDialog(Device *devp)
sprintf(temp, "inet %s %s netmask %s", ipaddr, extras, netmask);
sprintf(ifn, "%s%s", VAR_IFCONFIG, devp->name);
variable_set2(ifn, temp);
+ sprintf(ifn, "%s %s", devp->name, getenv(VAR_INTERFACES) ? getenv(VAR_INTERFACES) : "");
+ variable_set2(VAR_INTERFACES, ifn);
+ if (ipaddr[0])
+ variable_set2(VAR_IPADDR, ipaddr);
return 0;
}
return 1;
@@ -460,9 +464,13 @@ tcpDeviceSelect(char *str)
/* Start PPP on the 3rd screen */
Boolean
-tcpStartPPP(void)
+tcpStartPPP(Device *devp)
{
int fd;
+ FILE *fp;
+ char *val;
+ char myaddr[16];
+ char netmask[16];
fd = open("/dev/ttyv2", O_RDWR);
if (fd == -1)
@@ -470,9 +478,34 @@ tcpStartPPP(void)
Mkdir("/var/log", NULL);
Mkdir("/var/spool/lock", NULL);
Mkdir("/etc/ppp", NULL);
- /* XXX Put our IP addr in the right file instead of this stupidity!! XXX */
vsystem("touch /etc/ppp/ppp.linkup; chmod +x /etc/ppp/ppp.linkup");
vsystem("touch /etc/ppp/ppp.secret; chmod +x /etc/ppp/ppp.secret");
+ fp = fopen("/etc/ppp/ppp.conf", "w");
+ if (!fp) {
+ msgConfirm("Couldn't open /etc/ppp/ppp.conf file! This isn't going to work");
+ return FALSE;
+ }
+ fprintf(fp, "default:\n");
+ fprintf(fp, " set device %s\n", devp->devname);
+ val = msgGetInput("115200", "Enter baud rate for your modem - this can be higher\nthan the actual maximum data rate since most modems can talk\nat one speed to the host (us) and at another speed to the remote end.\nIf you're not sure what to put here, just select the default.");
+ if (!val)
+ val = "115200";
+ fprintf(fp, " set speed %s\n", val);
+ val = msgGetInput("0", "Enter the IP address of your service provider or 0 if you\ndon't know it and would prefer to negotiate it dynamically.");
+ if (!val)
+ val = "0";
+ if (devp->private && ((DevInfo *)devp->private)->ipaddr[0])
+ strcpy(myaddr, ((DevInfo *)devp->private)->ipaddr);
+ else
+ strcpy(myaddr, "0");
+ fprintf(fp, " set ifaddr %s %s\n", myaddr, val);
+ if (devp->private && ((DevInfo *)devp->private)->netmask[0])
+ strcpy(netmask, ((DevInfo *)devp->private)->netmask);
+ else
+ strcpy(netmask, "255.255.255.240");
+ if (strcmp(val, "0"))
+ fprintf(fp, "add 0 %s %s\n", netmask, val);
+ fclose(fp);
if (!fork()) {
dup2(fd, 0);
dup2(fd, 1);
@@ -480,5 +513,6 @@ tcpStartPPP(void)
execl("/stand/ppp", "/stand/ppp", (char *)NULL);
exit(1);
}
+ msgConfirm("The PPP command is now started on screen 3 (type ALT-F3 to\ninteract with it, ALT-F1 to switch back here). The only command\nyou'll probably want or need to use is the \"term\" command\nwhich starts a terminal emulator you can use to talk to your\nmodem and dial the service provider. Once you're connected,\ncome back to this screen and hit return. DO NOT PRESS RETURN\nHERE UNTIL THE CONNECTION IS FULLY ESTABLISHED!");
return TRUE;
}
OpenPOWER on IntegriCloud