summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1996-03-18 15:28:10 +0000
committerjkh <jkh@FreeBSD.org>1996-03-18 15:28:10 +0000
commit6e8165c16a87270a576fb00bc626ad6c02849c41 (patch)
treebbbb1da098bedb9748f8fa6faa46c10cb2c30d4a
parente938ba728f7b191c0b62d04b1b01689391c2751a (diff)
downloadFreeBSD-src-6e8165c16a87270a576fb00bc626ad6c02849c41.zip
FreeBSD-src-6e8165c16a87270a576fb00bc626ad6c02849c41.tar.gz
Lots of fixes:
1. Revamp package installer to use new dependency lists and also pkg_add's new `read from stdin' mode to prevent a copy of the package from hitting the disk unnecessarily. 2. More fixes for running "not as init" - don't get upset if CDROM already mounted, do the right thing instead. 3. If running as init, assume first-time install and _don't show the (W)rite option in the fdisk screen. 4. Many other little tweaks, some of which will have to wait for fuller testing until I can create a boot floppy (testing certain system-destroying features of sysinstall can be a royal pain). Expect some more commits.
-rw-r--r--release/sysinstall/anonFTP.c116
-rw-r--r--release/sysinstall/apache.c276
-rw-r--r--release/sysinstall/cdrom.c24
-rw-r--r--release/sysinstall/config.c6
-rw-r--r--release/sysinstall/devices.c15
-rw-r--r--release/sysinstall/disks.c6
-rw-r--r--release/sysinstall/index.c63
-rw-r--r--release/sysinstall/install.c12
-rw-r--r--release/sysinstall/installFinal.c4
-rw-r--r--release/sysinstall/label.c6
-rw-r--r--release/sysinstall/media.c4
-rw-r--r--release/sysinstall/misc.c4
-rw-r--r--release/sysinstall/package.c202
-rw-r--r--release/sysinstall/sysinstall.h7
-rw-r--r--release/sysinstall/system.c4
-rw-r--r--release/sysinstall/termcap.c4
-rw-r--r--usr.sbin/sade/config.c6
-rw-r--r--usr.sbin/sade/devices.c15
-rw-r--r--usr.sbin/sade/disks.c6
-rw-r--r--usr.sbin/sade/install.c12
-rw-r--r--usr.sbin/sade/label.c6
-rw-r--r--usr.sbin/sade/misc.c4
-rw-r--r--usr.sbin/sade/sade.h7
-rw-r--r--usr.sbin/sade/system.c4
-rw-r--r--usr.sbin/sade/termcap.c4
-rw-r--r--usr.sbin/sysinstall/anonFTP.c116
-rw-r--r--usr.sbin/sysinstall/cdrom.c24
-rw-r--r--usr.sbin/sysinstall/config.c6
-rw-r--r--usr.sbin/sysinstall/devices.c15
-rw-r--r--usr.sbin/sysinstall/disks.c6
-rw-r--r--usr.sbin/sysinstall/index.c63
-rw-r--r--usr.sbin/sysinstall/install.c12
-rw-r--r--usr.sbin/sysinstall/label.c6
-rw-r--r--usr.sbin/sysinstall/media.c4
-rw-r--r--usr.sbin/sysinstall/misc.c4
-rw-r--r--usr.sbin/sysinstall/package.c202
-rw-r--r--usr.sbin/sysinstall/sysinstall.h7
-rw-r--r--usr.sbin/sysinstall/system.c4
-rw-r--r--usr.sbin/sysinstall/termcap.c4
39 files changed, 549 insertions, 741 deletions
diff --git a/release/sysinstall/anonFTP.c b/release/sysinstall/anonFTP.c
index e65847c..beb54e6 100644
--- a/release/sysinstall/anonFTP.c
+++ b/release/sysinstall/anonFTP.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: anonFTP.c,v 1.6 1995/11/12 07:27:55 jkh Exp $
+ * $Id: anonFTP.c,v 1.7 1996/03/02 07:31:48 jkh Exp $
*
* Copyright (c) 1995
* Coranth Gryphon. All rights reserved.
@@ -153,7 +153,7 @@ static Layout layout[] = {
};
int
-createFtpUser()
+createFtpUser(void)
{
struct passwd *tpw;
struct group *tgrp;
@@ -219,7 +219,7 @@ createFtpUser()
/* This is it - how to get the setup values */
int
-anonftpOpenDialog()
+anonftpOpenDialog(void)
{
WINDOW *ds_win;
ComposeObj *obj = NULL;
@@ -231,12 +231,11 @@ anonftpOpenDialog()
/* We need a curses window */
ds_win = newwin(LINES, COLS, 0, 0);
- if (ds_win == 0)
- {
- beep();
- msgConfirm("Cannot open anonymous ftp dialog window!!");
- return(RET_SUCCESS);
- }
+ if (ds_win == 0) {
+ beep();
+ msgConfirm("Cannot open anonymous ftp dialog window!!");
+ return(RET_FAIL);
+ }
/* Say where our help comes from */
systemHelpFile(ANONFTP_HELPFILE, help);
@@ -325,72 +324,71 @@ anonftpOpenDialog()
switch (ret) {
/* Bail out */
case SEL_ESC:
- quit = TRUE, cancel=TRUE;
- break;
+ quit = TRUE, cancel=TRUE;
+ break;
- /* This doesn't work for list dialogs. Oh well. Perhaps
- should special case the move from the OK button ``up''
- to make it go to the interface list, but then it gets
- awkward for the user to go back and correct screw up's
- in the per-interface section */
+ /* This doesn't work for list dialogs. Oh well. Perhaps
+ should special case the move from the OK button ``up''
+ to make it go to the interface list, but then it gets
+ awkward for the user to go back and correct screw up's
+ in the per-interface section */
case KEY_UP:
- if (obj->prev !=NULL ) {
- obj = obj->prev;
- --n;
- } else {
- obj = last;
- n = max;
- }
- break;
+ if (obj->prev !=NULL ) {
+ obj = obj->prev;
+ --n;
+ } else {
+ obj = last;
+ n = max;
+ }
+ break;
case KEY_DOWN:
- if (obj->next != NULL) {
- obj = obj->next;
- ++n;
- } else {
- obj = first;
- n = 0;
- }
- break;
-
+ if (obj->next != NULL) {
+ obj = obj->next;
+ ++n;
+ } else {
+ obj = first;
+ n = 0;
+ }
+ break;
+
case SEL_TAB:
- if (n < max)
- ++n;
- else
- n = 0;
- break;
+ if (n < max)
+ ++n;
+ else
+ n = 0;
+ break;
- /* The user has pressed enter over a button object */
+ /* The user has pressed enter over a button object */
case SEL_BUTTON:
- quit = TRUE;
- if (cancelbutton)
- cancel = TRUE;
- break;
+ quit = TRUE;
+ if (cancelbutton)
+ cancel = TRUE;
+ break;
- /* Generic CR handler */
+ /* Generic CR handler */
case SEL_CR:
- if (n < max)
- ++n;
- else
- n = 0;
- break;
+ if (n < max)
+ ++n;
+ else
+ n = 0;
+ break;
case SEL_BACKTAB:
- if (n)
- --n;
- else
- n = max;
- break;
+ if (n)
+ --n;
+ else
+ n = max;
+ break;
case KEY_F(1):
- display_helpfile();
+ display_helpfile();
/* They tried some key combination we don't support - tell them! */
default:
- beep();
+ beep();
}
-
}
/* Clear this crap off the screen */
@@ -439,11 +437,11 @@ configAnonFTP(char *unused)
/*** If HomeDir does not exist, create it ***/
- if (!directoryExists(tconf.homedir)) {
+ if (!directory_exists(tconf.homedir)) {
vsystem("mkdir -p %s" ,tconf.homedir);
}
- if (directoryExists(tconf.homedir)) {
+ if (directory_exists(tconf.homedir)) {
msgNotify("Configuring %s for use by anon FTP.", tconf.homedir);
vsystem("chmod 555 %s && chown root.%s %s", tconf.homedir, tconf.group, tconf.homedir);
vsystem("mkdir %s/bin && chmod 555 %s/bin", tconf.homedir, tconf.homedir);
diff --git a/release/sysinstall/apache.c b/release/sysinstall/apache.c
index 4343cfb..2fcb232 100644
--- a/release/sysinstall/apache.c
+++ b/release/sysinstall/apache.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: apache.c,v 1.13 1996/01/21 19:38:05 jkh Exp $
+ * $Id: apache.c,v 1.14 1996/03/02 07:31:49 jkh Exp $
*
* Copyright (c) 1995
* Coranth Gryphon. All rights reserved.
@@ -76,8 +76,7 @@
/* Set up the structure to hold configuration information */
/* Note that this is only what we could fit onto the one screen */
-typedef struct
-{
+typedef struct {
char docroot[128]; /* DocumentRoot */
char userdir[128]; /* UserDir */
char welcome[32]; /* Welcome Doc */
@@ -125,76 +124,76 @@ typedef struct _layout {
} Layout;
static Layout layout[] = {
-{ 1, 2, 30, HOSTNAME_FIELD_LEN - 1,
+ { 1, 2, 30, HOSTNAME_FIELD_LEN - 1,
"Host Name:",
"What name to report this host as to client browsers",
tconf.hostname, STRINGOBJ, NULL },
#define LAYOUT_HOSTNAME 0
-
-{ 1, 40, 32, APACHE_EMAIL_LEN - 1,
+
+ { 1, 40, 32, APACHE_EMAIL_LEN - 1,
"Email Address:",
"The email address of the site maintainer, e.g. webmaster@bar.com",
tconf.email, STRINGOBJ, NULL },
#define LAYOUT_EMAIL 1
-
-{ 5, 5, 20, APACHE_WELCOME_LEN - 1,
+
+ { 5, 5, 20, APACHE_WELCOME_LEN - 1,
"Default Document:",
"The name of the default document found in each directory",
tconf.welcome, STRINGOBJ, NULL },
#define LAYOUT_WELCOME 2
-
-{ 5, 40, 14, APACHE_DEFUSER_LEN - 1,
+
+ { 5, 40, 14, APACHE_DEFUSER_LEN - 1,
"Default UserID:", "Default UID for access to web pages",
tconf.defuser, STRINGOBJ, NULL },
#define LAYOUT_DEFUSER 3
-
-{ 5, 60, 14, APACHE_DEFGROUP_LEN - 1,
+
+ { 5, 60, 14, APACHE_DEFGROUP_LEN - 1,
"Default Group ID:", "Default GID for access to web pages",
tconf.defgroup, STRINGOBJ, NULL },
#define LAYOUT_DEFGROUP 4
-
-{ 10, 4, 36, APACHE_DOCROOT_LEN - 1,
+
+ { 10, 4, 36, APACHE_DOCROOT_LEN - 1,
"Root Document Path:",
"The top directory that holds the system web pages",
tconf.docroot, STRINGOBJ, NULL },
#define LAYOUT_DOCROOT 5
-
-{ 10, 50, 14, APACHE_USERDIR_LEN - 1,
+
+ { 10, 50, 14, APACHE_USERDIR_LEN - 1,
"User Directory:",
"Personal sub-directory that holds users' web pages (eg. ~/Web)",
tconf.userdir, STRINGOBJ, NULL },
#define LAYOUT_USERDIR 6
-
-{ 14, 4, 28, APACHE_LOGDIR_LEN - 1,
+
+ { 14, 4, 28, APACHE_LOGDIR_LEN - 1,
"Log Dir:", "Directory to put httpd log files",
tconf.logdir, STRINGOBJ, NULL },
#define LAYOUT_LOGDIR 7
-
-{ 14, 38, 16, APACHE_ACCESSLOG_LEN - 1,
+
+ { 14, 38, 16, APACHE_ACCESSLOG_LEN - 1,
"Access Log:", "Name of log file to report access",
tconf.accesslog, STRINGOBJ, NULL },
#define LAYOUT_ACCESSLOG 8
-
-{ 14, 60, 16, APACHE_ERRORLOG_LEN - 1,
+
+ { 14, 60, 16, APACHE_ERRORLOG_LEN - 1,
"Error Log:", "Name of log file to report errors",
tconf.errorlog, STRINGOBJ, NULL },
#define LAYOUT_ERRORLOG 9
-
-{ 19, 15, 0, 0,
+
+ { 19, 15, 0, 0,
"OK", "Select this if you are happy with these settings",
&okbutton, BUTTONOBJ, NULL },
#define LAYOUT_OKBUTTON 10
-
-{ 19, 45, 0, 0,
+
+ { 19, 45, 0, 0,
"CANCEL", "Select this if you wish to cancel this screen",
&cancelbutton, BUTTONOBJ, NULL },
#define LAYOUT_CANCELBUTTON 11
-{ NULL },
+ { NULL },
};
/* This is it - how to get Apache setup values */
int
-apacheOpenDialog()
+apacheOpenDialog(void)
{
WINDOW *ds_win;
ComposeObj *obj = NULL;
@@ -234,42 +233,41 @@ apacheOpenDialog()
bzero(&tconf, sizeof(tconf));
tmp = variable_get(VAR_DOMAINNAME);
- if (tmp)
- {
+ if (tmp) {
sprintf(tconf.email, "webmaster@%s", tmp);
sprintf(tconf.hostname, "www.%s", tmp);
}
strcpy(tconf.defuser, DEFAULT_USER);
strcpy(tconf.defgroup, DEFAULT_GROUP);
-
+
strcpy(tconf.userdir, USER_HOMEDIR);
strcpy(tconf.welcome, WELCOME_FILE);
-
+
strcpy(tconf.logdir, LOGS_SUBDIR);
strcpy(tconf.accesslog, ACCESS_LOGNAME);
strcpy(tconf.errorlog, ERROR_LOGNAME);
-
+
sprintf(tconf.docroot, "%s/%s", APACHE_BASE,DATA_SUBDIR);
/* Loop over the layout list, create the objects, and add them
onto the chain of objects that dialog uses for traversal*/
n = 0;
-
+
#define lt layout[n]
while (lt.help != NULL) {
switch (lt.type) {
case STRINGOBJ:
lt.obj = NewStringObj(ds_win, lt.prompt, lt.var,
- lt.y + APACHE_DIALOG_Y, lt.x + APACHE_DIALOG_X,
- lt.len, lt.maxlen);
+ lt.y + APACHE_DIALOG_Y, lt.x + APACHE_DIALOG_X,
+ lt.len, lt.maxlen);
break;
case BUTTONOBJ:
lt.obj = NewButtonObj(ds_win, lt.prompt, lt.var,
- lt.y + APACHE_DIALOG_Y, lt.x + APACHE_DIALOG_X);
+ lt.y + APACHE_DIALOG_Y, lt.x + APACHE_DIALOG_X);
break;
default:
@@ -304,93 +302,91 @@ apacheOpenDialog()
/* Display the help line at the bottom of the screen */
for (i = 0; i < 79; i++)
help_line[i] = (i < len) ? lt.help[i] : ' ';
- help_line[i] = '\0';
- use_helpline(help_line);
- display_helpline(ds_win, LINES - 1, COLS - 1);
-
- /* Ask for libdialog to do its stuff */
- ret = PollObj(&obj);
-
-
- /* We are in the Hostname field - calculate the e-mail addr */
-
- if (n == LAYOUT_HOSTNAME) {
- if ((tmp = index(tconf.hostname, '.')) != NULL) {
- sprintf(tconf.email,"webmaster@%s",tmp+1);
- RefreshStringObj(layout[LAYOUT_EMAIL].obj);
- }
- }
-
- /* Handle special case stuff that libdialog misses. Sigh */
- switch (ret) {
- /* Bail out */
- case SEL_ESC:
- quit = TRUE, cancel=TRUE;
- break;
-
- /* This doesn't work for list dialogs. Oh well. Perhaps
- should special case the move from the OK button ``up''
- to make it go to the interface list, but then it gets
- awkward for the user to go back and correct screw up's
- in the per-interface section */
-
- case KEY_UP:
- if (obj->prev !=NULL ) {
- obj = obj->prev;
- --n;
- } else {
- obj = last;
- n = max;
- }
- break;
-
- case KEY_DOWN:
- if (obj->next != NULL) {
- obj = obj->next;
- ++n;
- } else {
- obj = first;
- n = 0;
- }
- break;
+ help_line[i] = '\0';
+ use_helpline(help_line);
+ display_helpline(ds_win, LINES - 1, COLS - 1);
- case SEL_TAB:
- if (n < max)
- ++n;
- else
- n = 0;
- break;
+ /* Ask for libdialog to do its stuff */
+ ret = PollObj(&obj);
- /* The user has pressed enter over a button object */
- case SEL_BUTTON:
- quit = TRUE;
- if (cancelbutton)
- cancel = TRUE;
- break;
-
- /* Generic CR handler */
- case SEL_CR:
- if (n < max)
- ++n;
- else
- n = 0;
- break;
-
- case SEL_BACKTAB:
- if (n)
- --n;
- else
- n = max;
- break;
+ /* We are in the Hostname field - calculate the e-mail addr */
+ if (n == LAYOUT_HOSTNAME) {
+ if ((tmp = index(tconf.hostname, '.')) != NULL) {
+ sprintf(tconf.email,"webmaster@%s",tmp+1);
+ RefreshStringObj(layout[LAYOUT_EMAIL].obj);
+ }
+ }
- case KEY_F(1):
- display_helpfile();
+ /* Handle special case stuff that libdialog misses. Sigh */
+ switch (ret) {
+ /* Bail out */
+ case SEL_ESC:
+ quit = TRUE, cancel=TRUE;
+ break;
+
+ /* This doesn't work for list dialogs. Oh well. Perhaps
+ should special case the move from the OK button ``up''
+ to make it go to the interface list, but then it gets
+ awkward for the user to go back and correct screw up's
+ in the per-interface section */
+
+ case KEY_UP:
+ if (obj->prev !=NULL ) {
+ obj = obj->prev;
+ --n;
+ } else {
+ obj = last;
+ n = max;
+ }
+ break;
+
+ case KEY_DOWN:
+ if (obj->next != NULL) {
+ obj = obj->next;
+ ++n;
+ } else {
+ obj = first;
+ n = 0;
+ }
+ break;
+
+ case SEL_TAB:
+ if (n < max)
+ ++n;
+ else
+ n = 0;
+ break;
+
+ /* The user has pressed enter over a button object */
+ case SEL_BUTTON:
+ quit = TRUE;
+ if (cancelbutton)
+ cancel = TRUE;
+ break;
+
+ /* Generic CR handler */
+ case SEL_CR:
+ if (n < max)
+ ++n;
+ else
+ n = 0;
+ break;
+
+ case SEL_BACKTAB:
+ if (n)
+ --n;
+ else
+ n = max;
+ break;
+
+ case KEY_F(1):
+ display_helpfile();
/* They tried some key combination we don't support - tell them! */
- default:
- beep();
- }
-
+ default:
+ beep();
+ }
+
}
/* Clear this crap off the screen */
@@ -410,10 +406,10 @@ configApache(char *unused)
char company[64], file[128];
char *tptr;
FILE *fptr;
-
+
/* Be optimistic */
i = RET_SUCCESS;
-
+
dialog_clear();
msgConfirm("Since you elected to install the WEB server, we'll now add the\n"
"Apache HTTPD package and set up a few configuration files.");
@@ -451,25 +447,23 @@ configApache(char *unused)
strcpy(tconf.defuser, DEFAULT_USER);
if (! tconf.defgroup[0])
strcpy(tconf.defgroup, DEFAULT_GROUP);
-
+
/*** If the user did not specify a directory, use default ***/
- if (tconf.docroot[strlen(tconf.docroot)-1] == '/')
- tconf.docroot[strlen(tconf.docroot)-1] = '\0';
+ if (tconf.docroot[strlen(tconf.docroot) - 1] == '/')
+ tconf.docroot[strlen(tconf.docroot) - 1] = '\0';
if (!tconf.docroot[0])
sprintf(tconf.docroot,"%s/%s",APACHE_BASE,DATA_SUBDIR);
/*** If DocRoot does not exist, create it ***/
- if (!directoryExists(tconf.docroot))
+ if (!directory_exists(tconf.docroot))
vsystem("mkdir -p %s", tconf.docroot);
- if (directoryExists(tconf.docroot))
- {
+ if (directory_exists(tconf.docroot)) {
sprintf(file,"%s/%s", tconf.docroot, tconf.welcome);
- if (!file_readable(file))
- {
+ if (!file_readable(file)) {
dialog_clear();
tptr = msgGetInput(NULL,
"What is your company name?");
@@ -480,21 +474,18 @@ configApache(char *unused)
msgNotify("Creating sample web page...");
fptr = fopen(file,"w");
- if (fptr)
- {
+ if (fptr) {
fprintf(fptr,"<CENTER>\n<TITLE>Welcome Page</TITLE>\n");
fprintf(fptr,"<H1>Welcome to %s </H1>\n</CENTER>\n",company);
fprintf(fptr,"<P><HR SIZE=4>\n<CENTER>\n");
fprintf(fptr,"<A HREF=\"http://www.FreeBSD.org/What\">\n");
fprintf(fptr,"<IMG SRC=\"./power.gif\" ALIGN=CENTER BORDER=0 ");
fprintf(fptr," ALT=\"Powered by FreeBSD\"></A>\n");
- if (! tconf.email[0])
- {
+ if (! tconf.email[0]) {
if ((tptr = variable_get(VAR_DOMAINNAME)))
sprintf(tconf.email,"root@%s",tptr);
}
- if (tconf.email[0])
- {
+ if (tconf.email[0]) {
fprintf(fptr,"<ADDRESS><H4>\n");
fprintf(fptr," For questions or comments, please send mail to:\n");
fprintf(fptr," <A HREF=\"mailto:%s\">%s</A>\n",
@@ -519,15 +510,14 @@ configApache(char *unused)
}
msgNotify("Writing configuration files....");
-
+
(void)vsystem("mkdir -p %s/%s", APACHE_BASE,CONFIG_SUBDIR);
sprintf(file, "%s/%s/access.conf", APACHE_BASE,CONFIG_SUBDIR);
if (file_readable(file))
vsystem("mv -f %s %s.ORIG", file, file);
-
+
fptr = fopen(file,"w");
- if (fptr)
- {
+ if (fptr) {
fprintf(fptr,"<Directory %s/cgi-bin>\n", APACHE_BASE);
fprintf(fptr,"Options Indexes FollowSymLinks\n");
fprintf(fptr,"</Directory>\n");
@@ -548,10 +538,9 @@ configApache(char *unused)
sprintf(file, "%s/%s/httpd.conf", APACHE_BASE,CONFIG_SUBDIR);
if (file_readable(file))
vsystem("mv -f %s %s.ORIG", file, file);
-
+
fptr = fopen(file,"w");
- if (fptr)
- {
+ if (fptr) {
fprintf(fptr,"ServerType standalone\n");
fprintf(fptr,"Port 80\n");
fprintf(fptr,"TimeOut 400\n");
@@ -587,8 +576,7 @@ configApache(char *unused)
if (file_readable(file))
vsystem("mv -f %s %s.ORIG", file, file);
fptr = fopen(file,"w");
- if (fptr)
- {
+ if (fptr) {
fprintf(fptr,"FancyIndexing on\n");
fprintf(fptr,"DefaultType text/plain\n");
fprintf(fptr,"IndexIgnore */.??* *~ *# */HEADER* */README* */RCS\n");
diff --git a/release/sysinstall/cdrom.c b/release/sysinstall/cdrom.c
index 8179e0e..7752df0 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.9 1995/12/07 10:33:32 peter Exp $
+ * $Id: cdrom.c,v 1.10 1996/03/02 07:31:50 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -58,9 +58,15 @@
#include <sys/mount.h>
#undef CD9660
-/* This isn't static, like the others, since it's often useful to know whether or not we have a CDROM
- available in some of the other installation screens. */
-Boolean cdromMounted;
+/*
+ * This isn't static, like the others, since it's often useful to know whether
+ * or not we have a CDROM available in some of the other installation screens.
+ * This also isn't a boolean like the others since we have 3 states for it:
+ * 0 = cdrom isn't mounted, 1 = cdrom is mounted and we mounted it, 2 = cdrom
+ * was already mounted when we came in and we should leave it that way when
+ * we leave.
+ */
+int cdromMounted;
Boolean
mediaInitCDROM(Device *dev)
@@ -79,7 +85,9 @@ mediaInitCDROM(Device *dev)
args.fspec = dev->devname;
args.flags = 0;
- if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) {
+ if (directory_exists("/cdrom/dists"))
+ cdromMounted = 2;
+ else if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) {
dialog_clear();
msgConfirm("Error mounting %s on /cdrom: %s (%u)", dev->devname, strerror(errno), errno);
return FALSE;
@@ -104,7 +112,7 @@ mediaInitCDROM(Device *dev)
return FALSE;
}
}
- cdromMounted = TRUE;
+ cdromMounted = 1;
msgDebug("Mounted CDROM device %s on /cdrom\n", dev->devname);
return TRUE;
}
@@ -131,7 +139,7 @@ mediaGetCDROM(Device *dev, char *file, Boolean probe)
void
mediaShutdownCDROM(Device *dev)
{
- if (!RunningAsInit || !cdromMounted)
+ if (!RunningAsInit || !cdromMounted || cdromMounted == 2)
return;
msgDebug("Unmounting %s from /cdrom\n", dev->devname);
if (unmount("/cdrom", MNT_FORCE) != 0) {
@@ -139,6 +147,6 @@ mediaShutdownCDROM(Device *dev)
msgConfirm("Could not unmount the CDROM from /cdrom: %s", strerror(errno));
}
msgDebug("Unmount successful\n");
- cdromMounted = FALSE;
+ cdromMounted = 0;
return;
}
diff --git a/release/sysinstall/config.c b/release/sysinstall/config.c
index e49b574..8b90941 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.17 1995/09/18 16:52:22 peter Exp $
+ * $Id: config.c,v 1.18 1995/12/07 10:33:35 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -455,7 +455,7 @@ configPackages(char *str)
if (ret == RET_DONE)
break;
else if (ret != RET_FAIL) {
- index_extract(mediaDevice, &plist);
+ index_extract(mediaDevice, &top, &plist);
break;
}
}
@@ -477,7 +477,7 @@ configPorts(char *str)
if (!variable_get(VAR_PORTS_PATH))
variable_set2(VAR_PORTS_PATH, dist = "/cdrom/ports");
- while (!directoryExists(dist)) {
+ while (!directory_exists(dist)) {
dist = variable_get_value(VAR_PORTS_PATH,
"Unable to locate a ports tree on CDROM. Please specify the\n"
"location of the master ports directory you wish to create the\n"
diff --git a/release/sysinstall/devices.c b/release/sysinstall/devices.c
index 035234e..3781bee 100644
--- a/release/sysinstall/devices.c
+++ b/release/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.39 1996/02/10 09:33:52 phk Exp $
+ * $Id: devices.c,v 1.40 1996/03/02 07:31:51 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -66,17 +66,11 @@ static struct {
char *description;
} device_names[] = {
{ DEVICE_TYPE_CDROM, "cd0a", "SCSI CDROM drive" },
- { DEVICE_TYPE_CDROM, "cd1a", "SCSI CDROM drive (2nd unit)" },
{ DEVICE_TYPE_CDROM, "mcd0a", "Mitsumi (old model) CDROM drive" },
- { DEVICE_TYPE_CDROM, "mcd1a", "Mitsumi (old model) CDROM drive (2nd unit)" },
{ DEVICE_TYPE_CDROM, "scd0a", "Sony CDROM drive - CDU31/33A type", },
- { DEVICE_TYPE_CDROM, "scd1a", "Sony CDROM drive - CDU31/33A type (2nd unit)" },
{ DEVICE_TYPE_CDROM, "matcd0a", "Matsushita CDROM ('sound blaster' type)" },
- { DEVICE_TYPE_CDROM, "matcd1a", "Matsushita CDROM (2nd unit)" },
{ DEVICE_TYPE_CDROM, "wcd0c", "ATAPI IDE CDROM" },
- { DEVICE_TYPE_CDROM, "wcd1c", "ATAPI IDE CDROM (2nd unit)" },
{ DEVICE_TYPE_TAPE, "rst0", "SCSI tape drive" },
- { DEVICE_TYPE_TAPE, "rst1", "SCSI tape drive (2nd unit)" },
{ DEVICE_TYPE_TAPE, "rft0", "Floppy tape drive (QIC-02)" },
{ DEVICE_TYPE_TAPE, "rwt0", "Wangtek tape drive" },
{ DEVICE_TYPE_DISK, "sd", "SCSI disk device" },
@@ -92,6 +86,7 @@ static struct {
{ DEVICE_TYPE_NETWORK, "sl", "Serial-line IP (SLIP) interface" },
{ 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, "ep", "3Com 3C509 ethernet card" },
{ DEVICE_TYPE_NETWORK, "el", "3Com 3C501 ethernet card" },
@@ -217,7 +212,7 @@ deviceGetAll(void)
/* Look for existing DOS partitions to register */
for (c1 = d->chunks->part; c1; c1 = c1->next) {
- if (c1->type == fat) {
+ if (c1->type == fat || c1->type == extended) {
Device *dev;
char devname[80];
@@ -243,8 +238,8 @@ deviceGetAll(void)
switch(device_names[i].type) {
case DEVICE_TYPE_CDROM:
fd = deviceTry(device_names[i].name, try);
- if (fd >= 0) {
- if (fd) close(fd);
+ if (fd >= 0 || errno == EBUSY) { /* EBUSY if already mounted */
+ if (fd >= 0) close(fd);
(void)deviceRegister(device_names[i].name, device_names[i].description, strdup(try),
DEVICE_TYPE_CDROM, TRUE, mediaInitCDROM, mediaGetCDROM, NULL,
mediaShutdownCDROM, NULL);
diff --git a/release/sysinstall/disks.c b/release/sysinstall/disks.c
index 8b9096c..94e9999 100644
--- a/release/sysinstall/disks.c
+++ b/release/sysinstall/disks.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: disks.c,v 1.34 1995/12/11 16:32:31 jkh Exp $
+ * $Id: disks.c,v 1.35 1996/01/23 21:05:22 joerg Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -126,7 +126,9 @@ print_command_summary()
mvprintw(14, 0, "The following commands are supported (in upper or lower case):");
mvprintw(16, 0, "A = Use Entire Disk B = Bad Block Scan C = Create Partition");
mvprintw(17, 0, "D = Delete Partition G = Set Drive Geometry S = Set Bootable");
- mvprintw(18, 0, "U = Undo All Changes Q = Finish W = Write Changes");
+ mvprintw(18, 0, "U = Undo All Changes Q = Finish");
+ if (!RunningAsInit)
+ mvprintw(18, 48, "W = Write Changes");
mvprintw(20, 0, "The currently selected partition is displayed in ");
attrset(A_REVERSE); addstr("reverse"); attrset(A_NORMAL); addstr(" video.");
mvprintw(21, 0, "Use F1 or ? to get more help, arrow keys to move.");
diff --git a/release/sysinstall/index.c b/release/sysinstall/index.c
index 6198a5e..5697735 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.19 1995/11/06 22:26:28 jkh Exp $
+ * $Id: index.c,v 1.20 1995/11/12 20:47:12 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -53,6 +53,8 @@
#define MAX_MENU 13
#define _MAX_DESC 62
+static int index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who);
+
/* Smarter strdup */
inline char *
_strdup(char *ptr)
@@ -92,6 +94,7 @@ static char *descrs[] = {
"libraries", "Software development libraries.",
"mail", "Electronic mail packages and utilities.",
"math", "Mathematical computation software.",
+ "misc", "Miscellaneous utilities.",
"net", "Networking utilities.",
"networking", "Networking utilities.",
"news", "USENET News support software.",
@@ -105,6 +108,7 @@ static char *descrs[] = {
"security", "System security software.",
"shells", "Various shells (tcsh, bash, etc).",
"sysutils", "Various system utilities.",
+ "www", "WEB utilities (browers, HTTP servers, etc).",
"troff", "TROFF Text formatting utilities.",
"utils", "Various user utilities.",
"utilities", "Various user utilities.",
@@ -135,7 +139,7 @@ new_pkg_node(char *name, node_type type)
}
static IndexEntryPtr
-new_index(char *name, char *pathto, char *prefix, char *comment, char *descr, char *maint)
+new_index(char *name, char *pathto, char *prefix, char *comment, char *descr, char *maint, char *deps)
{
IndexEntryPtr tmp = safe_malloc(sizeof(IndexEntry));
@@ -145,6 +149,7 @@ new_index(char *name, char *pathto, char *prefix, char *comment, char *descr, ch
tmp->comment = _strdup(comment);
tmp->descrfile = _strdup(descr);
tmp->maintainer = _strdup(maint);
+ tmp->deps = _strdup(deps);
return tmp;
}
@@ -203,8 +208,7 @@ readline(int fd, char *buf, int max)
}
int
-index_parse(int fd, char *name, char *pathto, char *prefix, char *comment, char *descr, char *maint,
- char *cats, char *keys)
+index_parse(int fd, char *name, char *pathto, char *prefix, char *comment, char *descr, char *maint, char *cats, char *deps)
{
char line[1024];
char *cp;
@@ -221,7 +225,8 @@ index_parse(int fd, char *name, char *pathto, char *prefix, char *comment, char
cp += copy_to_sep(descr, cp, '|');
cp += copy_to_sep(maint, cp, '|');
cp += copy_to_sep(cats, cp, '|');
- strcpy(keys, cp);
+ (void)copy_to_sep(deps, cp, '|');
+ /* We're not actually interested in any of the other fields */
return 0;
}
@@ -244,13 +249,13 @@ index_get(char *fname, PkgNodePtr papa)
int
index_read(int fd, PkgNodePtr papa)
{
- char name[127], pathto[255], prefix[255], comment[255], descr[127], maint[127], cats[511], keys[511];
+ char name[127], pathto[255], prefix[255], comment[255], descr[127], maint[127], cats[511], deps[511];
- while (index_parse(fd, name, pathto, prefix, comment, descr, maint, cats, keys) != EOF) {
+ while (index_parse(fd, name, pathto, prefix, comment, descr, maint, cats, deps) != EOF) {
char *cp, *cp2, tmp[511];
IndexEntryPtr idx;
- idx = new_index(name, pathto, prefix, comment, descr, maint);
+ idx = new_index(name, pathto, prefix, comment, descr, maint, deps);
/* For now, we only add things to menus if they're in categories. Keywords are ignored */
for (cp = strcpy(tmp, cats); (cp2 = strchr(cp, ' ')) != NULL; cp = cp2 + 1) {
*cp2 = '\0';
@@ -556,14 +561,48 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
}
int
-index_extract(Device *dev, PkgNodePtr plist)
+index_extract(Device *dev, PkgNodePtr top, PkgNodePtr plist)
{
PkgNodePtr tmp;
int status = RET_SUCCESS;
- for (tmp = plist->kids; tmp; tmp = tmp->next) {
- if (package_extract(dev, tmp->name) != RET_SUCCESS)
- status = RET_FAIL;
+ for (tmp = plist->kids; tmp; tmp = tmp->next)
+ status = index_extract_one(dev, top, tmp);
+ return status;
+}
+
+static int
+index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who)
+{
+ int status = RET_SUCCESS;
+ PkgNodePtr tmp2;
+
+ if (((IndexEntryPtr)who->data)->deps) {
+ char t[1024], *cp, *cp2;
+
+ strcpy(t, ((IndexEntryPtr)who->data)->deps);
+ cp = t;
+ while (cp) {
+ if ((cp2 = index(cp, ' ')) != NULL)
+ *cp2 = '\0';
+ if (index_search(top, cp, &tmp2)) {
+ status = index_extract_one(dev, top, tmp2);
+ if (status != RET_SUCCESS) {
+ msgDebug("Loading of dependant package %s failed\n", cp);
+ break;
+ }
+ status = package_extract(dev, cp);
+ if (status != RET_SUCCESS)
+ break;
+ if (cp2)
+ cp = cp2 + 1;
+ else
+ cp = NULL;
+ }
+ }
}
+ /* Done with the deps? Load the real m'coy */
+ if (status == RET_SUCCESS)
+ status = package_extract(dev, who->name);
return status;
}
diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c
index a609c09..9c9e60a 100644
--- a/release/sysinstall/install.c
+++ b/release/sysinstall/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.75 1996/01/29 20:17:27 joerg Exp $
+ * $Id: install.c,v 1.76 1996/03/02 07:31:54 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -242,9 +242,9 @@ installFixit(char *str)
dialog_update();
end_dialog();
DialogActive = FALSE;
- if (!directoryExists("/tmp"))
+ if (!directory_exists("/tmp"))
(void)symlink("/mnt2/tmp", "/tmp");
- if (!directoryExists("/var/tmp/vi.recover")) {
+ if (!directory_exists("/var/tmp/vi.recover")) {
if (Mkdir("/var/tmp/vi.recover", NULL) != RET_SUCCESS) {
dialog_clear();
msgConfirm("Warning: Was unable to create a /var/tmp/vi.recover directory.\n"
@@ -385,7 +385,7 @@ int
installCommit(char *str)
{
int i;
- extern Boolean cdromMounted;
+ extern int cdromMounted;
if (!mediaVerify())
return RET_FAIL;
@@ -469,7 +469,7 @@ installCommit(char *str)
if (!msgYesNo("Does this system have a mouse attached to it?"))
dmenuOpenSimple(&MenuMouse);
- if (directoryExists("/usr/X11R6")) {
+ if (directory_exists("/usr/X11R6")) {
dialog_clear();
if (!msgYesNo("Would you like to configure your X server at this time?"))
systemExecute("/usr/X11R6/bin/xf86config");
@@ -604,7 +604,7 @@ installFixup(char *str)
msgNotify("Fixing permissions..");
/* BOGON #1: XFree86 extracting /usr/X11R6 with root-only perms */
- if (directoryExists("/usr/X11R6")) {
+ if (directory_exists("/usr/X11R6")) {
system("chmod -R a+r /usr/X11R6");
system("find /usr/X11R6 -type d | xargs chmod a+x");
}
diff --git a/release/sysinstall/installFinal.c b/release/sysinstall/installFinal.c
index 050e86e..c3fbf50 100644
--- a/release/sysinstall/installFinal.c
+++ b/release/sysinstall/installFinal.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: installFinal.c,v 1.20 1995/11/12 11:12:25 jkh Exp $
+ * $Id: installFinal.c,v 1.21 1995/11/17 23:49:32 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard & Coranth Gryphon. All rights reserved.
@@ -158,7 +158,7 @@ configSamba(char *unused)
strcpy(tbuf, tptr);
if (tbuf[len - 1] == '/')
tbuf[len - 1] = '\0';
- if (directoryExists(tbuf)) {
+ if (directory_exists(tbuf)) {
tptr = msgGetInput(pathBaseName(tbuf), "What do you want to call this share?");
if (tptr && *tptr) {
fprintf(fptr, "[%s]\npath = %s\n", tptr, tbuf);
diff --git a/release/sysinstall/label.c b/release/sysinstall/label.c
index 4085b3b..4580c20 100644
--- a/release/sysinstall/label.c
+++ b/release/sysinstall/label.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: label.c,v 1.36 1996/03/02 20:00:50 jkh Exp $
+ * $Id: label.c,v 1.37 1996/03/02 20:02:13 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -169,8 +169,10 @@ diskLabelCommit(char *str)
int i;
/* Already done? */
- if ((cp = variable_get(DISK_LABELLED)) && strcmp(cp, "yes"))
+ if ((cp = variable_get(DISK_LABELLED)) && strcmp(cp, "yes")) {
+ variable_set2(DISK_PARTITIONED, "yes");
i = RET_SUCCESS;
+ }
else if (!cp) {
dialog_clear();
msgConfirm("You must assign disk labels before this option can be used.");
diff --git a/release/sysinstall/media.c b/release/sysinstall/media.c
index d502c1e..6c77800 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.26 1995/09/18 16:52:31 peter Exp $
+ * $Id: media.c,v 1.27 1995/12/07 10:34:00 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -92,7 +92,7 @@ mediaSetCDROM(char *str)
Device **devs;
int cnt;
- if (!RunningAsInit) {
+ if (!file_readable("/cdrom/kernel")) {
vsystem("mount /cdrom");
if (!file_readable("/cdrom/kernel")) {
msgConfirm("Can't find a FreeBSD CD in /cdrom?");
diff --git a/release/sysinstall/misc.c b/release/sysinstall/misc.c
index 6d3730a..296daf7 100644
--- a/release/sysinstall/misc.c
+++ b/release/sysinstall/misc.c
@@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
- * $Id: misc.c,v 1.13 1995/12/07 10:34:07 peter Exp $
+ * $Id: misc.c,v 1.14 1996/01/14 21:48:57 phk Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -130,7 +130,7 @@ string_copy(char *s1, char *s2)
}
Boolean
-directoryExists(const char *dirname)
+directory_exists(const char *dirname)
{
DIR *tptr;
diff --git a/release/sysinstall/package.c b/release/sysinstall/package.c
index 201fb3d..5e936c7 100644
--- a/release/sysinstall/package.c
+++ b/release/sysinstall/package.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: package.c,v 1.27 1995/11/12 20:47:15 jkh Exp $
+ * $Id: package.c,v 1.28 1995/12/04 02:22:02 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -50,8 +50,6 @@
#include <sys/stat.h>
#include "sysinstall.h"
-static char *make_playpen(char *pen, size_t sz);
-
/* Like package_extract, but assumes current media device */
int
package_add(char *name)
@@ -66,8 +64,6 @@ int
package_extract(Device *dev, char *name)
{
char path[511];
- char pen[FILENAME_MAX];
- char *where;
int fd, ret;
/* If necessary, initialize the ldconfig hints */
@@ -92,94 +88,51 @@ package_extract(Device *dev, char *name)
if (!variable_get("PKG_TMPDIR")) {
Mkdir("/usr/tmp", NULL);
Mkdir("/var/tmp", NULL);
+ /* Set it to a location with as much space as possible */
+ variable_set2("PKG_TMPDIR", "/usr/tmp");
}
sprintf(path, "packages/All/%s%s", name, strstr(name, ".tgz") ? "" : ".tgz");
msgNotify("Adding %s\nfrom %s", path, dev->name);
fd = dev->get(dev, path, TRUE);
if (fd >= 0) {
- pen[0] = '\0';
- if ((where = make_playpen(pen, 0)) != NULL) {
- if (mediaExtractDist(pen, fd)) {
- if (file_readable("+CONTENTS")) {
- /* Set some hints for pkg_add so that it knows how we got here in case of any depends */
- switch (mediaDevice->type) {
- case DEVICE_TYPE_FTP:
- if (variable_get(VAR_FTP_PATH)) {
- char ftppath[512];
-
- /* Special case to leave hint for pkg_add that this is an FTP install */
- sprintf(ftppath, "%spackages/All/", variable_get(VAR_FTP_PATH));
- variable_set2("PKG_ADD_BASE", ftppath);
- }
- break;
-
- case DEVICE_TYPE_DOS:
- variable_set2("PKG_PATH", "/dos/freebsd/packages/All:/dos/packages/All");
- break;
-
- case DEVICE_TYPE_CDROM:
- variable_set2("PKG_PATH", "/cdrom/packages/All:/cdrom/usr/ports/packages/All");
- break;
-
- default:
- variable_set2("PKG_PATH", "/dist/packages/All:/dist/freebsd/packages/All");
- break;
- }
-
- if (vsystem("(pwd; cat +CONTENTS) | pkg_add %s-S",
- !strcmp(variable_get(VAR_CPIO_VERBOSITY), "high") ? "-v " : "")) {
- dialog_clear();
- if (!variable_get(VAR_NO_CONFIRM))
- msgConfirm("An error occurred while trying to pkg_add %s.\n"
- "Please check debugging screen for possible further details.", name);
- else
- msgNotify("An error occurred while trying to pkg_add %s.", name);
- }
- else {
- msgNotify("Package %s added successfully!", name);
- ret = RET_SUCCESS;
- }
- }
- else {
- dialog_clear();
- if (!variable_get(VAR_NO_CONFIRM))
- msgConfirm("The package specified (%s) has no CONTENTS file. This means\n"
- "that there was either a media error of some sort or the package\n"
- "file itself is corrupted. It is also possible that you simply\n"
- "ran out of temporary space and need to go to the options editor\n"
- "to select a package temp directory with more space. Either way,\n"
- "you may wish to look into the problem and try again.", name);
- else
- msgNotify("The package specified (%s) has no CONTENTS file. Skipping.", name);
- }
- }
- else {
- ret = RET_FAIL;
- if (!variable_get(VAR_NO_CONFIRM))
- msgConfirm("Unable to extract the contents of package %s. This means\n"
- "that there was either a media error of some sort or the package\n"
- "file itself is corrupted.\n"
- "You may wish to look into this and try again.", name);
- else
- msgNotify("Unable to extract the contents of package %s. Skipping.", name);
- }
- if (chdir(where) == -1)
- msgFatal("Unable to get back to where I was before, Jojo! (That was: %s)", where);
- vsystem("rm -rf %s", pen);
+ int i, tot, pfd[2];
+ pid_t pid;
+
+ pipe(pfd);
+ pid = fork();
+ if (!pid) {
+ dup2(pfd[0], 0); close(pfd[0]);
+ dup2(DebugFD, 1);
+ dup2(DebugFD, 2);
+ close(pfd[1]);
+ i = execl("/usr/sbin/pkg_add", "/usr/sbin/pkg_add", "-", 0);
if (isDebug())
- msgDebug("Nuked pen: %s\n", pen);
+ msgDebug("pkg_add returns %d status\n", i);
}
else {
+ char buf[BUFSIZ];
+
dialog_clear();
- msgConfirm("Unable to find a temporary location to unpack this stuff in.\n"
- "You must simply not have enough space or you've configured your\n"
- "system oddly. Sorry!");
- ret = RET_FAIL;
+ tot = 0;
+ while ((i = read(fd, buf, BUFSIZ)) > 0) {
+ write(pfd[1], buf, i);
+ tot += i;
+ mvprintw(0, 0, "%d bytes read from package %s", tot, name);
+ clrtoeol();
+ refresh();
+ }
+ close(fd);
+ close(pfd[1]);
+ dialog_clear();
+ i = waitpid(pid, &tot, 0);
+ if (i < 0 || WEXITSTATUS(tot)) {
+ msgNotify("Add of package %s aborted due to some error -\n"
+ "Please check the debug screen for more info.");
+ }
+ else
+ msgNotify("Package %s was added successfully", name);
}
- dev->close(dev, fd);
- if (dev->type == DEVICE_TYPE_TAPE)
- unlink(path);
}
else {
msgDebug("pkg_extract: get operation returned %d\n", fd);
@@ -194,88 +147,3 @@ package_extract(Device *dev, char *name)
}
return ret;
}
-
-static size_t
-min_free(char *tmpdir)
-{
- struct statfs buf;
-
- if (statfs(tmpdir, &buf) != 0) {
- msgDebug("Error in statfs, errno = %d\n", errno);
- return -1;
- }
- return buf.f_bavail * buf.f_bsize;
-}
-
-/* Find a good place to play. */
-static char *
-find_play_pen(char *pen, size_t sz)
-{
- struct stat sb;
-
- if (pen[0] && stat(pen, &sb) != RET_FAIL && (min_free(pen) >= sz))
- return pen;
- else if (stat("/var/tmp", &sb) != RET_FAIL && min_free("/var/tmp") >= sz)
- strcpy(pen, "/var/tmp/instmp.XXXXXX");
- else if (stat("/tmp", &sb) != RET_FAIL && min_free("/tmp") >= sz)
- strcpy(pen, "/tmp/instmp.XXXXXX");
- else if ((stat("/usr/tmp", &sb) == RET_SUCCESS || mkdir("/usr/tmp", 01777) == RET_SUCCESS) &&
- min_free("/usr/tmp") >= sz)
- strcpy(pen, "/usr/tmp/instmp.XXXXXX");
- else {
- dialog_clear();
- msgConfirm("Can't find enough temporary space to extract the files, please try\n"
- "This again after your system is up (you can run /stand/sysinstall\n"
- "directly) and you've had a chance to point /var/tmp somewhere with\n"
- "sufficient temporary space available.");
- return NULL;
- }
- return pen;
-}
-
-/*
- * Make a temporary directory to play in and chdir() to it, returning
- * pathname of previous working directory.
- */
-static char *
-make_playpen(char *pen, size_t sz)
-{
- static char Previous[FILENAME_MAX];
-
- if (!find_play_pen(pen, sz))
- return NULL;
-
- if (!mktemp(pen)) {
- dialog_clear();
- msgConfirm("Can't mktemp '%s'.", pen);
- return NULL;
- }
- if (mkdir(pen, 0755) == RET_FAIL) {
- dialog_clear();
- msgConfirm("Can't mkdir '%s'.", pen);
- return NULL;
- }
- if (isDebug()) {
- if (sz)
- msgDebug("Requested space: %d bytes, free space: %d bytes in %s\n", (int)sz, min_free(pen), pen);
- }
- if (min_free(pen) < sz) {
- rmdir(pen);
- dialog_clear();
- msgConfirm("Not enough free space to create: `%s'\n"
- "Please try this again after your system is up (you can run\n"
- "/stand/sysinstall directly) and you've had a chance to point\n"
- "/var/tmp somewhere with sufficient temporary space available.");
- return NULL;
- }
- if (!getcwd(Previous, FILENAME_MAX)) {
- dialog_clear();
- msgConfirm("getcwd");
- return NULL;
- }
- if (chdir(pen) == RET_FAIL) {
- dialog_clear();
- msgConfirm("Can't chdir to '%s'.", pen);
- }
- return Previous;
-}
diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h
index 8f15b8e..679d45c 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.44 1995/12/07 10:34:14 peter Exp $
+ * $Id: sysinstall.h,v 1.45 1996/03/02 07:31:56 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -278,6 +278,7 @@ typedef struct _indexEntry { /* A single entry in an INDEX file */
char *prefix; /* port prefix */
char *comment; /* one line description */
char *descrfile; /* path to description file */
+ char *deps; /* packages this depends on */
char *maintainer; /* maintainer */
} IndexEntry;
typedef IndexEntry *IndexEntryPtr;
@@ -469,7 +470,7 @@ void index_init(PkgNodePtr top, PkgNodePtr plist);
void index_node_free(PkgNodePtr top, PkgNodePtr plist);
void index_sort(PkgNodePtr top);
void index_print(PkgNodePtr top, int level);
-int index_extract(Device *dev, PkgNodePtr plist);
+int index_extract(Device *dev, PkgNodePtr top, PkgNodePtr plist);
/* install.c */
extern int installCommit(char *str);
@@ -534,7 +535,7 @@ extern Boolean mediaVerify(void);
/* misc.c */
extern Boolean file_readable(char *fname);
extern Boolean file_executable(char *fname);
-extern Boolean directoryExists(const char *dirname);
+extern Boolean directory_exists(const char *dirname);
extern char *string_concat(char *p1, char *p2);
extern char *string_concat3(char *p1, char *p2, char *p3);
extern char *string_prune(char *str);
diff --git a/release/sysinstall/system.c b/release/sysinstall/system.c
index 7eb2328..26b6b74 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.46 1995/12/07 10:34:16 peter Exp $
+ * $Id: system.c,v 1.47 1996/03/02 07:31:56 jkh Exp $
*
* Jordan Hubbard
*
@@ -52,7 +52,7 @@ systemInitialize(int argc, char **argv)
close(1); dup(0);
close(2); dup(0);
printf("%s running as init\n", argv[0]);
-
+ RunningAsInit = 1;
i = ioctl(0, TIOCSCTTY, (char *)NULL);
setlogin("root");
setenv("PATH", "/stand:/bin:/sbin:/usr/sbin:/usr/bin:/mnt/bin:/mnt/sbin:/mnt/usr/sbin:/mnt/usr/bin:/usr/X11R6/bin", 1);
diff --git a/release/sysinstall/termcap.c b/release/sysinstall/termcap.c
index 3ab2088..7256b53c 100644
--- a/release/sysinstall/termcap.c
+++ b/release/sysinstall/termcap.c
@@ -29,15 +29,13 @@ set_termcap(void)
char *term;
int stat;
- OnVTY = RunningAsInit = FALSE;
+ OnVTY = FALSE;
term = getenv("TERM");
stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay);
if (getpid() != 1)
DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644);
- else
- RunningAsInit = TRUE;
if (stat < 0) {
if (!term) {
diff --git a/usr.sbin/sade/config.c b/usr.sbin/sade/config.c
index e49b574..8b90941 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.17 1995/09/18 16:52:22 peter Exp $
+ * $Id: config.c,v 1.18 1995/12/07 10:33:35 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -455,7 +455,7 @@ configPackages(char *str)
if (ret == RET_DONE)
break;
else if (ret != RET_FAIL) {
- index_extract(mediaDevice, &plist);
+ index_extract(mediaDevice, &top, &plist);
break;
}
}
@@ -477,7 +477,7 @@ configPorts(char *str)
if (!variable_get(VAR_PORTS_PATH))
variable_set2(VAR_PORTS_PATH, dist = "/cdrom/ports");
- while (!directoryExists(dist)) {
+ while (!directory_exists(dist)) {
dist = variable_get_value(VAR_PORTS_PATH,
"Unable to locate a ports tree on CDROM. Please specify the\n"
"location of the master ports directory you wish to create the\n"
diff --git a/usr.sbin/sade/devices.c b/usr.sbin/sade/devices.c
index 035234e..3781bee 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.39 1996/02/10 09:33:52 phk Exp $
+ * $Id: devices.c,v 1.40 1996/03/02 07:31:51 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -66,17 +66,11 @@ static struct {
char *description;
} device_names[] = {
{ DEVICE_TYPE_CDROM, "cd0a", "SCSI CDROM drive" },
- { DEVICE_TYPE_CDROM, "cd1a", "SCSI CDROM drive (2nd unit)" },
{ DEVICE_TYPE_CDROM, "mcd0a", "Mitsumi (old model) CDROM drive" },
- { DEVICE_TYPE_CDROM, "mcd1a", "Mitsumi (old model) CDROM drive (2nd unit)" },
{ DEVICE_TYPE_CDROM, "scd0a", "Sony CDROM drive - CDU31/33A type", },
- { DEVICE_TYPE_CDROM, "scd1a", "Sony CDROM drive - CDU31/33A type (2nd unit)" },
{ DEVICE_TYPE_CDROM, "matcd0a", "Matsushita CDROM ('sound blaster' type)" },
- { DEVICE_TYPE_CDROM, "matcd1a", "Matsushita CDROM (2nd unit)" },
{ DEVICE_TYPE_CDROM, "wcd0c", "ATAPI IDE CDROM" },
- { DEVICE_TYPE_CDROM, "wcd1c", "ATAPI IDE CDROM (2nd unit)" },
{ DEVICE_TYPE_TAPE, "rst0", "SCSI tape drive" },
- { DEVICE_TYPE_TAPE, "rst1", "SCSI tape drive (2nd unit)" },
{ DEVICE_TYPE_TAPE, "rft0", "Floppy tape drive (QIC-02)" },
{ DEVICE_TYPE_TAPE, "rwt0", "Wangtek tape drive" },
{ DEVICE_TYPE_DISK, "sd", "SCSI disk device" },
@@ -92,6 +86,7 @@ static struct {
{ DEVICE_TYPE_NETWORK, "sl", "Serial-line IP (SLIP) interface" },
{ 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, "ep", "3Com 3C509 ethernet card" },
{ DEVICE_TYPE_NETWORK, "el", "3Com 3C501 ethernet card" },
@@ -217,7 +212,7 @@ deviceGetAll(void)
/* Look for existing DOS partitions to register */
for (c1 = d->chunks->part; c1; c1 = c1->next) {
- if (c1->type == fat) {
+ if (c1->type == fat || c1->type == extended) {
Device *dev;
char devname[80];
@@ -243,8 +238,8 @@ deviceGetAll(void)
switch(device_names[i].type) {
case DEVICE_TYPE_CDROM:
fd = deviceTry(device_names[i].name, try);
- if (fd >= 0) {
- if (fd) close(fd);
+ if (fd >= 0 || errno == EBUSY) { /* EBUSY if already mounted */
+ if (fd >= 0) close(fd);
(void)deviceRegister(device_names[i].name, device_names[i].description, strdup(try),
DEVICE_TYPE_CDROM, TRUE, mediaInitCDROM, mediaGetCDROM, NULL,
mediaShutdownCDROM, NULL);
diff --git a/usr.sbin/sade/disks.c b/usr.sbin/sade/disks.c
index 8b9096c..94e9999 100644
--- a/usr.sbin/sade/disks.c
+++ b/usr.sbin/sade/disks.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: disks.c,v 1.34 1995/12/11 16:32:31 jkh Exp $
+ * $Id: disks.c,v 1.35 1996/01/23 21:05:22 joerg Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -126,7 +126,9 @@ print_command_summary()
mvprintw(14, 0, "The following commands are supported (in upper or lower case):");
mvprintw(16, 0, "A = Use Entire Disk B = Bad Block Scan C = Create Partition");
mvprintw(17, 0, "D = Delete Partition G = Set Drive Geometry S = Set Bootable");
- mvprintw(18, 0, "U = Undo All Changes Q = Finish W = Write Changes");
+ mvprintw(18, 0, "U = Undo All Changes Q = Finish");
+ if (!RunningAsInit)
+ mvprintw(18, 48, "W = Write Changes");
mvprintw(20, 0, "The currently selected partition is displayed in ");
attrset(A_REVERSE); addstr("reverse"); attrset(A_NORMAL); addstr(" video.");
mvprintw(21, 0, "Use F1 or ? to get more help, arrow keys to move.");
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
index a609c09..9c9e60a 100644
--- a/usr.sbin/sade/install.c
+++ b/usr.sbin/sade/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.75 1996/01/29 20:17:27 joerg Exp $
+ * $Id: install.c,v 1.76 1996/03/02 07:31:54 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -242,9 +242,9 @@ installFixit(char *str)
dialog_update();
end_dialog();
DialogActive = FALSE;
- if (!directoryExists("/tmp"))
+ if (!directory_exists("/tmp"))
(void)symlink("/mnt2/tmp", "/tmp");
- if (!directoryExists("/var/tmp/vi.recover")) {
+ if (!directory_exists("/var/tmp/vi.recover")) {
if (Mkdir("/var/tmp/vi.recover", NULL) != RET_SUCCESS) {
dialog_clear();
msgConfirm("Warning: Was unable to create a /var/tmp/vi.recover directory.\n"
@@ -385,7 +385,7 @@ int
installCommit(char *str)
{
int i;
- extern Boolean cdromMounted;
+ extern int cdromMounted;
if (!mediaVerify())
return RET_FAIL;
@@ -469,7 +469,7 @@ installCommit(char *str)
if (!msgYesNo("Does this system have a mouse attached to it?"))
dmenuOpenSimple(&MenuMouse);
- if (directoryExists("/usr/X11R6")) {
+ if (directory_exists("/usr/X11R6")) {
dialog_clear();
if (!msgYesNo("Would you like to configure your X server at this time?"))
systemExecute("/usr/X11R6/bin/xf86config");
@@ -604,7 +604,7 @@ installFixup(char *str)
msgNotify("Fixing permissions..");
/* BOGON #1: XFree86 extracting /usr/X11R6 with root-only perms */
- if (directoryExists("/usr/X11R6")) {
+ if (directory_exists("/usr/X11R6")) {
system("chmod -R a+r /usr/X11R6");
system("find /usr/X11R6 -type d | xargs chmod a+x");
}
diff --git a/usr.sbin/sade/label.c b/usr.sbin/sade/label.c
index 4085b3b..4580c20 100644
--- a/usr.sbin/sade/label.c
+++ b/usr.sbin/sade/label.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: label.c,v 1.36 1996/03/02 20:00:50 jkh Exp $
+ * $Id: label.c,v 1.37 1996/03/02 20:02:13 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -169,8 +169,10 @@ diskLabelCommit(char *str)
int i;
/* Already done? */
- if ((cp = variable_get(DISK_LABELLED)) && strcmp(cp, "yes"))
+ if ((cp = variable_get(DISK_LABELLED)) && strcmp(cp, "yes")) {
+ variable_set2(DISK_PARTITIONED, "yes");
i = RET_SUCCESS;
+ }
else if (!cp) {
dialog_clear();
msgConfirm("You must assign disk labels before this option can be used.");
diff --git a/usr.sbin/sade/misc.c b/usr.sbin/sade/misc.c
index 6d3730a..296daf7 100644
--- a/usr.sbin/sade/misc.c
+++ b/usr.sbin/sade/misc.c
@@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
- * $Id: misc.c,v 1.13 1995/12/07 10:34:07 peter Exp $
+ * $Id: misc.c,v 1.14 1996/01/14 21:48:57 phk Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -130,7 +130,7 @@ string_copy(char *s1, char *s2)
}
Boolean
-directoryExists(const char *dirname)
+directory_exists(const char *dirname)
{
DIR *tptr;
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index 8f15b8e..679d45c 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.44 1995/12/07 10:34:14 peter Exp $
+ * $Id: sysinstall.h,v 1.45 1996/03/02 07:31:56 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -278,6 +278,7 @@ typedef struct _indexEntry { /* A single entry in an INDEX file */
char *prefix; /* port prefix */
char *comment; /* one line description */
char *descrfile; /* path to description file */
+ char *deps; /* packages this depends on */
char *maintainer; /* maintainer */
} IndexEntry;
typedef IndexEntry *IndexEntryPtr;
@@ -469,7 +470,7 @@ void index_init(PkgNodePtr top, PkgNodePtr plist);
void index_node_free(PkgNodePtr top, PkgNodePtr plist);
void index_sort(PkgNodePtr top);
void index_print(PkgNodePtr top, int level);
-int index_extract(Device *dev, PkgNodePtr plist);
+int index_extract(Device *dev, PkgNodePtr top, PkgNodePtr plist);
/* install.c */
extern int installCommit(char *str);
@@ -534,7 +535,7 @@ extern Boolean mediaVerify(void);
/* misc.c */
extern Boolean file_readable(char *fname);
extern Boolean file_executable(char *fname);
-extern Boolean directoryExists(const char *dirname);
+extern Boolean directory_exists(const char *dirname);
extern char *string_concat(char *p1, char *p2);
extern char *string_concat3(char *p1, char *p2, char *p3);
extern char *string_prune(char *str);
diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c
index 7eb2328..26b6b74 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.46 1995/12/07 10:34:16 peter Exp $
+ * $Id: system.c,v 1.47 1996/03/02 07:31:56 jkh Exp $
*
* Jordan Hubbard
*
@@ -52,7 +52,7 @@ systemInitialize(int argc, char **argv)
close(1); dup(0);
close(2); dup(0);
printf("%s running as init\n", argv[0]);
-
+ RunningAsInit = 1;
i = ioctl(0, TIOCSCTTY, (char *)NULL);
setlogin("root");
setenv("PATH", "/stand:/bin:/sbin:/usr/sbin:/usr/bin:/mnt/bin:/mnt/sbin:/mnt/usr/sbin:/mnt/usr/bin:/usr/X11R6/bin", 1);
diff --git a/usr.sbin/sade/termcap.c b/usr.sbin/sade/termcap.c
index 3ab2088..7256b53c 100644
--- a/usr.sbin/sade/termcap.c
+++ b/usr.sbin/sade/termcap.c
@@ -29,15 +29,13 @@ set_termcap(void)
char *term;
int stat;
- OnVTY = RunningAsInit = FALSE;
+ OnVTY = FALSE;
term = getenv("TERM");
stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay);
if (getpid() != 1)
DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644);
- else
- RunningAsInit = TRUE;
if (stat < 0) {
if (!term) {
diff --git a/usr.sbin/sysinstall/anonFTP.c b/usr.sbin/sysinstall/anonFTP.c
index e65847c..beb54e6 100644
--- a/usr.sbin/sysinstall/anonFTP.c
+++ b/usr.sbin/sysinstall/anonFTP.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: anonFTP.c,v 1.6 1995/11/12 07:27:55 jkh Exp $
+ * $Id: anonFTP.c,v 1.7 1996/03/02 07:31:48 jkh Exp $
*
* Copyright (c) 1995
* Coranth Gryphon. All rights reserved.
@@ -153,7 +153,7 @@ static Layout layout[] = {
};
int
-createFtpUser()
+createFtpUser(void)
{
struct passwd *tpw;
struct group *tgrp;
@@ -219,7 +219,7 @@ createFtpUser()
/* This is it - how to get the setup values */
int
-anonftpOpenDialog()
+anonftpOpenDialog(void)
{
WINDOW *ds_win;
ComposeObj *obj = NULL;
@@ -231,12 +231,11 @@ anonftpOpenDialog()
/* We need a curses window */
ds_win = newwin(LINES, COLS, 0, 0);
- if (ds_win == 0)
- {
- beep();
- msgConfirm("Cannot open anonymous ftp dialog window!!");
- return(RET_SUCCESS);
- }
+ if (ds_win == 0) {
+ beep();
+ msgConfirm("Cannot open anonymous ftp dialog window!!");
+ return(RET_FAIL);
+ }
/* Say where our help comes from */
systemHelpFile(ANONFTP_HELPFILE, help);
@@ -325,72 +324,71 @@ anonftpOpenDialog()
switch (ret) {
/* Bail out */
case SEL_ESC:
- quit = TRUE, cancel=TRUE;
- break;
+ quit = TRUE, cancel=TRUE;
+ break;
- /* This doesn't work for list dialogs. Oh well. Perhaps
- should special case the move from the OK button ``up''
- to make it go to the interface list, but then it gets
- awkward for the user to go back and correct screw up's
- in the per-interface section */
+ /* This doesn't work for list dialogs. Oh well. Perhaps
+ should special case the move from the OK button ``up''
+ to make it go to the interface list, but then it gets
+ awkward for the user to go back and correct screw up's
+ in the per-interface section */
case KEY_UP:
- if (obj->prev !=NULL ) {
- obj = obj->prev;
- --n;
- } else {
- obj = last;
- n = max;
- }
- break;
+ if (obj->prev !=NULL ) {
+ obj = obj->prev;
+ --n;
+ } else {
+ obj = last;
+ n = max;
+ }
+ break;
case KEY_DOWN:
- if (obj->next != NULL) {
- obj = obj->next;
- ++n;
- } else {
- obj = first;
- n = 0;
- }
- break;
-
+ if (obj->next != NULL) {
+ obj = obj->next;
+ ++n;
+ } else {
+ obj = first;
+ n = 0;
+ }
+ break;
+
case SEL_TAB:
- if (n < max)
- ++n;
- else
- n = 0;
- break;
+ if (n < max)
+ ++n;
+ else
+ n = 0;
+ break;
- /* The user has pressed enter over a button object */
+ /* The user has pressed enter over a button object */
case SEL_BUTTON:
- quit = TRUE;
- if (cancelbutton)
- cancel = TRUE;
- break;
+ quit = TRUE;
+ if (cancelbutton)
+ cancel = TRUE;
+ break;
- /* Generic CR handler */
+ /* Generic CR handler */
case SEL_CR:
- if (n < max)
- ++n;
- else
- n = 0;
- break;
+ if (n < max)
+ ++n;
+ else
+ n = 0;
+ break;
case SEL_BACKTAB:
- if (n)
- --n;
- else
- n = max;
- break;
+ if (n)
+ --n;
+ else
+ n = max;
+ break;
case KEY_F(1):
- display_helpfile();
+ display_helpfile();
/* They tried some key combination we don't support - tell them! */
default:
- beep();
+ beep();
}
-
}
/* Clear this crap off the screen */
@@ -439,11 +437,11 @@ configAnonFTP(char *unused)
/*** If HomeDir does not exist, create it ***/
- if (!directoryExists(tconf.homedir)) {
+ if (!directory_exists(tconf.homedir)) {
vsystem("mkdir -p %s" ,tconf.homedir);
}
- if (directoryExists(tconf.homedir)) {
+ if (directory_exists(tconf.homedir)) {
msgNotify("Configuring %s for use by anon FTP.", tconf.homedir);
vsystem("chmod 555 %s && chown root.%s %s", tconf.homedir, tconf.group, tconf.homedir);
vsystem("mkdir %s/bin && chmod 555 %s/bin", tconf.homedir, tconf.homedir);
diff --git a/usr.sbin/sysinstall/cdrom.c b/usr.sbin/sysinstall/cdrom.c
index 8179e0e..7752df0 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.9 1995/12/07 10:33:32 peter Exp $
+ * $Id: cdrom.c,v 1.10 1996/03/02 07:31:50 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -58,9 +58,15 @@
#include <sys/mount.h>
#undef CD9660
-/* This isn't static, like the others, since it's often useful to know whether or not we have a CDROM
- available in some of the other installation screens. */
-Boolean cdromMounted;
+/*
+ * This isn't static, like the others, since it's often useful to know whether
+ * or not we have a CDROM available in some of the other installation screens.
+ * This also isn't a boolean like the others since we have 3 states for it:
+ * 0 = cdrom isn't mounted, 1 = cdrom is mounted and we mounted it, 2 = cdrom
+ * was already mounted when we came in and we should leave it that way when
+ * we leave.
+ */
+int cdromMounted;
Boolean
mediaInitCDROM(Device *dev)
@@ -79,7 +85,9 @@ mediaInitCDROM(Device *dev)
args.fspec = dev->devname;
args.flags = 0;
- if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) {
+ if (directory_exists("/cdrom/dists"))
+ cdromMounted = 2;
+ else if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) {
dialog_clear();
msgConfirm("Error mounting %s on /cdrom: %s (%u)", dev->devname, strerror(errno), errno);
return FALSE;
@@ -104,7 +112,7 @@ mediaInitCDROM(Device *dev)
return FALSE;
}
}
- cdromMounted = TRUE;
+ cdromMounted = 1;
msgDebug("Mounted CDROM device %s on /cdrom\n", dev->devname);
return TRUE;
}
@@ -131,7 +139,7 @@ mediaGetCDROM(Device *dev, char *file, Boolean probe)
void
mediaShutdownCDROM(Device *dev)
{
- if (!RunningAsInit || !cdromMounted)
+ if (!RunningAsInit || !cdromMounted || cdromMounted == 2)
return;
msgDebug("Unmounting %s from /cdrom\n", dev->devname);
if (unmount("/cdrom", MNT_FORCE) != 0) {
@@ -139,6 +147,6 @@ mediaShutdownCDROM(Device *dev)
msgConfirm("Could not unmount the CDROM from /cdrom: %s", strerror(errno));
}
msgDebug("Unmount successful\n");
- cdromMounted = FALSE;
+ cdromMounted = 0;
return;
}
diff --git a/usr.sbin/sysinstall/config.c b/usr.sbin/sysinstall/config.c
index e49b574..8b90941 100644
--- a/usr.sbin/sysinstall/config.c
+++ b/usr.sbin/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.17 1995/09/18 16:52:22 peter Exp $
+ * $Id: config.c,v 1.18 1995/12/07 10:33:35 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -455,7 +455,7 @@ configPackages(char *str)
if (ret == RET_DONE)
break;
else if (ret != RET_FAIL) {
- index_extract(mediaDevice, &plist);
+ index_extract(mediaDevice, &top, &plist);
break;
}
}
@@ -477,7 +477,7 @@ configPorts(char *str)
if (!variable_get(VAR_PORTS_PATH))
variable_set2(VAR_PORTS_PATH, dist = "/cdrom/ports");
- while (!directoryExists(dist)) {
+ while (!directory_exists(dist)) {
dist = variable_get_value(VAR_PORTS_PATH,
"Unable to locate a ports tree on CDROM. Please specify the\n"
"location of the master ports directory you wish to create the\n"
diff --git a/usr.sbin/sysinstall/devices.c b/usr.sbin/sysinstall/devices.c
index 035234e..3781bee 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.39 1996/02/10 09:33:52 phk Exp $
+ * $Id: devices.c,v 1.40 1996/03/02 07:31:51 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -66,17 +66,11 @@ static struct {
char *description;
} device_names[] = {
{ DEVICE_TYPE_CDROM, "cd0a", "SCSI CDROM drive" },
- { DEVICE_TYPE_CDROM, "cd1a", "SCSI CDROM drive (2nd unit)" },
{ DEVICE_TYPE_CDROM, "mcd0a", "Mitsumi (old model) CDROM drive" },
- { DEVICE_TYPE_CDROM, "mcd1a", "Mitsumi (old model) CDROM drive (2nd unit)" },
{ DEVICE_TYPE_CDROM, "scd0a", "Sony CDROM drive - CDU31/33A type", },
- { DEVICE_TYPE_CDROM, "scd1a", "Sony CDROM drive - CDU31/33A type (2nd unit)" },
{ DEVICE_TYPE_CDROM, "matcd0a", "Matsushita CDROM ('sound blaster' type)" },
- { DEVICE_TYPE_CDROM, "matcd1a", "Matsushita CDROM (2nd unit)" },
{ DEVICE_TYPE_CDROM, "wcd0c", "ATAPI IDE CDROM" },
- { DEVICE_TYPE_CDROM, "wcd1c", "ATAPI IDE CDROM (2nd unit)" },
{ DEVICE_TYPE_TAPE, "rst0", "SCSI tape drive" },
- { DEVICE_TYPE_TAPE, "rst1", "SCSI tape drive (2nd unit)" },
{ DEVICE_TYPE_TAPE, "rft0", "Floppy tape drive (QIC-02)" },
{ DEVICE_TYPE_TAPE, "rwt0", "Wangtek tape drive" },
{ DEVICE_TYPE_DISK, "sd", "SCSI disk device" },
@@ -92,6 +86,7 @@ static struct {
{ DEVICE_TYPE_NETWORK, "sl", "Serial-line IP (SLIP) interface" },
{ 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, "ep", "3Com 3C509 ethernet card" },
{ DEVICE_TYPE_NETWORK, "el", "3Com 3C501 ethernet card" },
@@ -217,7 +212,7 @@ deviceGetAll(void)
/* Look for existing DOS partitions to register */
for (c1 = d->chunks->part; c1; c1 = c1->next) {
- if (c1->type == fat) {
+ if (c1->type == fat || c1->type == extended) {
Device *dev;
char devname[80];
@@ -243,8 +238,8 @@ deviceGetAll(void)
switch(device_names[i].type) {
case DEVICE_TYPE_CDROM:
fd = deviceTry(device_names[i].name, try);
- if (fd >= 0) {
- if (fd) close(fd);
+ if (fd >= 0 || errno == EBUSY) { /* EBUSY if already mounted */
+ if (fd >= 0) close(fd);
(void)deviceRegister(device_names[i].name, device_names[i].description, strdup(try),
DEVICE_TYPE_CDROM, TRUE, mediaInitCDROM, mediaGetCDROM, NULL,
mediaShutdownCDROM, NULL);
diff --git a/usr.sbin/sysinstall/disks.c b/usr.sbin/sysinstall/disks.c
index 8b9096c..94e9999 100644
--- a/usr.sbin/sysinstall/disks.c
+++ b/usr.sbin/sysinstall/disks.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: disks.c,v 1.34 1995/12/11 16:32:31 jkh Exp $
+ * $Id: disks.c,v 1.35 1996/01/23 21:05:22 joerg Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -126,7 +126,9 @@ print_command_summary()
mvprintw(14, 0, "The following commands are supported (in upper or lower case):");
mvprintw(16, 0, "A = Use Entire Disk B = Bad Block Scan C = Create Partition");
mvprintw(17, 0, "D = Delete Partition G = Set Drive Geometry S = Set Bootable");
- mvprintw(18, 0, "U = Undo All Changes Q = Finish W = Write Changes");
+ mvprintw(18, 0, "U = Undo All Changes Q = Finish");
+ if (!RunningAsInit)
+ mvprintw(18, 48, "W = Write Changes");
mvprintw(20, 0, "The currently selected partition is displayed in ");
attrset(A_REVERSE); addstr("reverse"); attrset(A_NORMAL); addstr(" video.");
mvprintw(21, 0, "Use F1 or ? to get more help, arrow keys to move.");
diff --git a/usr.sbin/sysinstall/index.c b/usr.sbin/sysinstall/index.c
index 6198a5e..5697735 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.19 1995/11/06 22:26:28 jkh Exp $
+ * $Id: index.c,v 1.20 1995/11/12 20:47:12 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -53,6 +53,8 @@
#define MAX_MENU 13
#define _MAX_DESC 62
+static int index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who);
+
/* Smarter strdup */
inline char *
_strdup(char *ptr)
@@ -92,6 +94,7 @@ static char *descrs[] = {
"libraries", "Software development libraries.",
"mail", "Electronic mail packages and utilities.",
"math", "Mathematical computation software.",
+ "misc", "Miscellaneous utilities.",
"net", "Networking utilities.",
"networking", "Networking utilities.",
"news", "USENET News support software.",
@@ -105,6 +108,7 @@ static char *descrs[] = {
"security", "System security software.",
"shells", "Various shells (tcsh, bash, etc).",
"sysutils", "Various system utilities.",
+ "www", "WEB utilities (browers, HTTP servers, etc).",
"troff", "TROFF Text formatting utilities.",
"utils", "Various user utilities.",
"utilities", "Various user utilities.",
@@ -135,7 +139,7 @@ new_pkg_node(char *name, node_type type)
}
static IndexEntryPtr
-new_index(char *name, char *pathto, char *prefix, char *comment, char *descr, char *maint)
+new_index(char *name, char *pathto, char *prefix, char *comment, char *descr, char *maint, char *deps)
{
IndexEntryPtr tmp = safe_malloc(sizeof(IndexEntry));
@@ -145,6 +149,7 @@ new_index(char *name, char *pathto, char *prefix, char *comment, char *descr, ch
tmp->comment = _strdup(comment);
tmp->descrfile = _strdup(descr);
tmp->maintainer = _strdup(maint);
+ tmp->deps = _strdup(deps);
return tmp;
}
@@ -203,8 +208,7 @@ readline(int fd, char *buf, int max)
}
int
-index_parse(int fd, char *name, char *pathto, char *prefix, char *comment, char *descr, char *maint,
- char *cats, char *keys)
+index_parse(int fd, char *name, char *pathto, char *prefix, char *comment, char *descr, char *maint, char *cats, char *deps)
{
char line[1024];
char *cp;
@@ -221,7 +225,8 @@ index_parse(int fd, char *name, char *pathto, char *prefix, char *comment, char
cp += copy_to_sep(descr, cp, '|');
cp += copy_to_sep(maint, cp, '|');
cp += copy_to_sep(cats, cp, '|');
- strcpy(keys, cp);
+ (void)copy_to_sep(deps, cp, '|');
+ /* We're not actually interested in any of the other fields */
return 0;
}
@@ -244,13 +249,13 @@ index_get(char *fname, PkgNodePtr papa)
int
index_read(int fd, PkgNodePtr papa)
{
- char name[127], pathto[255], prefix[255], comment[255], descr[127], maint[127], cats[511], keys[511];
+ char name[127], pathto[255], prefix[255], comment[255], descr[127], maint[127], cats[511], deps[511];
- while (index_parse(fd, name, pathto, prefix, comment, descr, maint, cats, keys) != EOF) {
+ while (index_parse(fd, name, pathto, prefix, comment, descr, maint, cats, deps) != EOF) {
char *cp, *cp2, tmp[511];
IndexEntryPtr idx;
- idx = new_index(name, pathto, prefix, comment, descr, maint);
+ idx = new_index(name, pathto, prefix, comment, descr, maint, deps);
/* For now, we only add things to menus if they're in categories. Keywords are ignored */
for (cp = strcpy(tmp, cats); (cp2 = strchr(cp, ' ')) != NULL; cp = cp2 + 1) {
*cp2 = '\0';
@@ -556,14 +561,48 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
}
int
-index_extract(Device *dev, PkgNodePtr plist)
+index_extract(Device *dev, PkgNodePtr top, PkgNodePtr plist)
{
PkgNodePtr tmp;
int status = RET_SUCCESS;
- for (tmp = plist->kids; tmp; tmp = tmp->next) {
- if (package_extract(dev, tmp->name) != RET_SUCCESS)
- status = RET_FAIL;
+ for (tmp = plist->kids; tmp; tmp = tmp->next)
+ status = index_extract_one(dev, top, tmp);
+ return status;
+}
+
+static int
+index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who)
+{
+ int status = RET_SUCCESS;
+ PkgNodePtr tmp2;
+
+ if (((IndexEntryPtr)who->data)->deps) {
+ char t[1024], *cp, *cp2;
+
+ strcpy(t, ((IndexEntryPtr)who->data)->deps);
+ cp = t;
+ while (cp) {
+ if ((cp2 = index(cp, ' ')) != NULL)
+ *cp2 = '\0';
+ if (index_search(top, cp, &tmp2)) {
+ status = index_extract_one(dev, top, tmp2);
+ if (status != RET_SUCCESS) {
+ msgDebug("Loading of dependant package %s failed\n", cp);
+ break;
+ }
+ status = package_extract(dev, cp);
+ if (status != RET_SUCCESS)
+ break;
+ if (cp2)
+ cp = cp2 + 1;
+ else
+ cp = NULL;
+ }
+ }
}
+ /* Done with the deps? Load the real m'coy */
+ if (status == RET_SUCCESS)
+ status = package_extract(dev, who->name);
return status;
}
diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c
index a609c09..9c9e60a 100644
--- a/usr.sbin/sysinstall/install.c
+++ b/usr.sbin/sysinstall/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.75 1996/01/29 20:17:27 joerg Exp $
+ * $Id: install.c,v 1.76 1996/03/02 07:31:54 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -242,9 +242,9 @@ installFixit(char *str)
dialog_update();
end_dialog();
DialogActive = FALSE;
- if (!directoryExists("/tmp"))
+ if (!directory_exists("/tmp"))
(void)symlink("/mnt2/tmp", "/tmp");
- if (!directoryExists("/var/tmp/vi.recover")) {
+ if (!directory_exists("/var/tmp/vi.recover")) {
if (Mkdir("/var/tmp/vi.recover", NULL) != RET_SUCCESS) {
dialog_clear();
msgConfirm("Warning: Was unable to create a /var/tmp/vi.recover directory.\n"
@@ -385,7 +385,7 @@ int
installCommit(char *str)
{
int i;
- extern Boolean cdromMounted;
+ extern int cdromMounted;
if (!mediaVerify())
return RET_FAIL;
@@ -469,7 +469,7 @@ installCommit(char *str)
if (!msgYesNo("Does this system have a mouse attached to it?"))
dmenuOpenSimple(&MenuMouse);
- if (directoryExists("/usr/X11R6")) {
+ if (directory_exists("/usr/X11R6")) {
dialog_clear();
if (!msgYesNo("Would you like to configure your X server at this time?"))
systemExecute("/usr/X11R6/bin/xf86config");
@@ -604,7 +604,7 @@ installFixup(char *str)
msgNotify("Fixing permissions..");
/* BOGON #1: XFree86 extracting /usr/X11R6 with root-only perms */
- if (directoryExists("/usr/X11R6")) {
+ if (directory_exists("/usr/X11R6")) {
system("chmod -R a+r /usr/X11R6");
system("find /usr/X11R6 -type d | xargs chmod a+x");
}
diff --git a/usr.sbin/sysinstall/label.c b/usr.sbin/sysinstall/label.c
index 4085b3b..4580c20 100644
--- a/usr.sbin/sysinstall/label.c
+++ b/usr.sbin/sysinstall/label.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: label.c,v 1.36 1996/03/02 20:00:50 jkh Exp $
+ * $Id: label.c,v 1.37 1996/03/02 20:02:13 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -169,8 +169,10 @@ diskLabelCommit(char *str)
int i;
/* Already done? */
- if ((cp = variable_get(DISK_LABELLED)) && strcmp(cp, "yes"))
+ if ((cp = variable_get(DISK_LABELLED)) && strcmp(cp, "yes")) {
+ variable_set2(DISK_PARTITIONED, "yes");
i = RET_SUCCESS;
+ }
else if (!cp) {
dialog_clear();
msgConfirm("You must assign disk labels before this option can be used.");
diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c
index d502c1e..6c77800 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.26 1995/09/18 16:52:31 peter Exp $
+ * $Id: media.c,v 1.27 1995/12/07 10:34:00 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -92,7 +92,7 @@ mediaSetCDROM(char *str)
Device **devs;
int cnt;
- if (!RunningAsInit) {
+ if (!file_readable("/cdrom/kernel")) {
vsystem("mount /cdrom");
if (!file_readable("/cdrom/kernel")) {
msgConfirm("Can't find a FreeBSD CD in /cdrom?");
diff --git a/usr.sbin/sysinstall/misc.c b/usr.sbin/sysinstall/misc.c
index 6d3730a..296daf7 100644
--- a/usr.sbin/sysinstall/misc.c
+++ b/usr.sbin/sysinstall/misc.c
@@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
- * $Id: misc.c,v 1.13 1995/12/07 10:34:07 peter Exp $
+ * $Id: misc.c,v 1.14 1996/01/14 21:48:57 phk Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -130,7 +130,7 @@ string_copy(char *s1, char *s2)
}
Boolean
-directoryExists(const char *dirname)
+directory_exists(const char *dirname)
{
DIR *tptr;
diff --git a/usr.sbin/sysinstall/package.c b/usr.sbin/sysinstall/package.c
index 201fb3d..5e936c7 100644
--- a/usr.sbin/sysinstall/package.c
+++ b/usr.sbin/sysinstall/package.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: package.c,v 1.27 1995/11/12 20:47:15 jkh Exp $
+ * $Id: package.c,v 1.28 1995/12/04 02:22:02 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -50,8 +50,6 @@
#include <sys/stat.h>
#include "sysinstall.h"
-static char *make_playpen(char *pen, size_t sz);
-
/* Like package_extract, but assumes current media device */
int
package_add(char *name)
@@ -66,8 +64,6 @@ int
package_extract(Device *dev, char *name)
{
char path[511];
- char pen[FILENAME_MAX];
- char *where;
int fd, ret;
/* If necessary, initialize the ldconfig hints */
@@ -92,94 +88,51 @@ package_extract(Device *dev, char *name)
if (!variable_get("PKG_TMPDIR")) {
Mkdir("/usr/tmp", NULL);
Mkdir("/var/tmp", NULL);
+ /* Set it to a location with as much space as possible */
+ variable_set2("PKG_TMPDIR", "/usr/tmp");
}
sprintf(path, "packages/All/%s%s", name, strstr(name, ".tgz") ? "" : ".tgz");
msgNotify("Adding %s\nfrom %s", path, dev->name);
fd = dev->get(dev, path, TRUE);
if (fd >= 0) {
- pen[0] = '\0';
- if ((where = make_playpen(pen, 0)) != NULL) {
- if (mediaExtractDist(pen, fd)) {
- if (file_readable("+CONTENTS")) {
- /* Set some hints for pkg_add so that it knows how we got here in case of any depends */
- switch (mediaDevice->type) {
- case DEVICE_TYPE_FTP:
- if (variable_get(VAR_FTP_PATH)) {
- char ftppath[512];
-
- /* Special case to leave hint for pkg_add that this is an FTP install */
- sprintf(ftppath, "%spackages/All/", variable_get(VAR_FTP_PATH));
- variable_set2("PKG_ADD_BASE", ftppath);
- }
- break;
-
- case DEVICE_TYPE_DOS:
- variable_set2("PKG_PATH", "/dos/freebsd/packages/All:/dos/packages/All");
- break;
-
- case DEVICE_TYPE_CDROM:
- variable_set2("PKG_PATH", "/cdrom/packages/All:/cdrom/usr/ports/packages/All");
- break;
-
- default:
- variable_set2("PKG_PATH", "/dist/packages/All:/dist/freebsd/packages/All");
- break;
- }
-
- if (vsystem("(pwd; cat +CONTENTS) | pkg_add %s-S",
- !strcmp(variable_get(VAR_CPIO_VERBOSITY), "high") ? "-v " : "")) {
- dialog_clear();
- if (!variable_get(VAR_NO_CONFIRM))
- msgConfirm("An error occurred while trying to pkg_add %s.\n"
- "Please check debugging screen for possible further details.", name);
- else
- msgNotify("An error occurred while trying to pkg_add %s.", name);
- }
- else {
- msgNotify("Package %s added successfully!", name);
- ret = RET_SUCCESS;
- }
- }
- else {
- dialog_clear();
- if (!variable_get(VAR_NO_CONFIRM))
- msgConfirm("The package specified (%s) has no CONTENTS file. This means\n"
- "that there was either a media error of some sort or the package\n"
- "file itself is corrupted. It is also possible that you simply\n"
- "ran out of temporary space and need to go to the options editor\n"
- "to select a package temp directory with more space. Either way,\n"
- "you may wish to look into the problem and try again.", name);
- else
- msgNotify("The package specified (%s) has no CONTENTS file. Skipping.", name);
- }
- }
- else {
- ret = RET_FAIL;
- if (!variable_get(VAR_NO_CONFIRM))
- msgConfirm("Unable to extract the contents of package %s. This means\n"
- "that there was either a media error of some sort or the package\n"
- "file itself is corrupted.\n"
- "You may wish to look into this and try again.", name);
- else
- msgNotify("Unable to extract the contents of package %s. Skipping.", name);
- }
- if (chdir(where) == -1)
- msgFatal("Unable to get back to where I was before, Jojo! (That was: %s)", where);
- vsystem("rm -rf %s", pen);
+ int i, tot, pfd[2];
+ pid_t pid;
+
+ pipe(pfd);
+ pid = fork();
+ if (!pid) {
+ dup2(pfd[0], 0); close(pfd[0]);
+ dup2(DebugFD, 1);
+ dup2(DebugFD, 2);
+ close(pfd[1]);
+ i = execl("/usr/sbin/pkg_add", "/usr/sbin/pkg_add", "-", 0);
if (isDebug())
- msgDebug("Nuked pen: %s\n", pen);
+ msgDebug("pkg_add returns %d status\n", i);
}
else {
+ char buf[BUFSIZ];
+
dialog_clear();
- msgConfirm("Unable to find a temporary location to unpack this stuff in.\n"
- "You must simply not have enough space or you've configured your\n"
- "system oddly. Sorry!");
- ret = RET_FAIL;
+ tot = 0;
+ while ((i = read(fd, buf, BUFSIZ)) > 0) {
+ write(pfd[1], buf, i);
+ tot += i;
+ mvprintw(0, 0, "%d bytes read from package %s", tot, name);
+ clrtoeol();
+ refresh();
+ }
+ close(fd);
+ close(pfd[1]);
+ dialog_clear();
+ i = waitpid(pid, &tot, 0);
+ if (i < 0 || WEXITSTATUS(tot)) {
+ msgNotify("Add of package %s aborted due to some error -\n"
+ "Please check the debug screen for more info.");
+ }
+ else
+ msgNotify("Package %s was added successfully", name);
}
- dev->close(dev, fd);
- if (dev->type == DEVICE_TYPE_TAPE)
- unlink(path);
}
else {
msgDebug("pkg_extract: get operation returned %d\n", fd);
@@ -194,88 +147,3 @@ package_extract(Device *dev, char *name)
}
return ret;
}
-
-static size_t
-min_free(char *tmpdir)
-{
- struct statfs buf;
-
- if (statfs(tmpdir, &buf) != 0) {
- msgDebug("Error in statfs, errno = %d\n", errno);
- return -1;
- }
- return buf.f_bavail * buf.f_bsize;
-}
-
-/* Find a good place to play. */
-static char *
-find_play_pen(char *pen, size_t sz)
-{
- struct stat sb;
-
- if (pen[0] && stat(pen, &sb) != RET_FAIL && (min_free(pen) >= sz))
- return pen;
- else if (stat("/var/tmp", &sb) != RET_FAIL && min_free("/var/tmp") >= sz)
- strcpy(pen, "/var/tmp/instmp.XXXXXX");
- else if (stat("/tmp", &sb) != RET_FAIL && min_free("/tmp") >= sz)
- strcpy(pen, "/tmp/instmp.XXXXXX");
- else if ((stat("/usr/tmp", &sb) == RET_SUCCESS || mkdir("/usr/tmp", 01777) == RET_SUCCESS) &&
- min_free("/usr/tmp") >= sz)
- strcpy(pen, "/usr/tmp/instmp.XXXXXX");
- else {
- dialog_clear();
- msgConfirm("Can't find enough temporary space to extract the files, please try\n"
- "This again after your system is up (you can run /stand/sysinstall\n"
- "directly) and you've had a chance to point /var/tmp somewhere with\n"
- "sufficient temporary space available.");
- return NULL;
- }
- return pen;
-}
-
-/*
- * Make a temporary directory to play in and chdir() to it, returning
- * pathname of previous working directory.
- */
-static char *
-make_playpen(char *pen, size_t sz)
-{
- static char Previous[FILENAME_MAX];
-
- if (!find_play_pen(pen, sz))
- return NULL;
-
- if (!mktemp(pen)) {
- dialog_clear();
- msgConfirm("Can't mktemp '%s'.", pen);
- return NULL;
- }
- if (mkdir(pen, 0755) == RET_FAIL) {
- dialog_clear();
- msgConfirm("Can't mkdir '%s'.", pen);
- return NULL;
- }
- if (isDebug()) {
- if (sz)
- msgDebug("Requested space: %d bytes, free space: %d bytes in %s\n", (int)sz, min_free(pen), pen);
- }
- if (min_free(pen) < sz) {
- rmdir(pen);
- dialog_clear();
- msgConfirm("Not enough free space to create: `%s'\n"
- "Please try this again after your system is up (you can run\n"
- "/stand/sysinstall directly) and you've had a chance to point\n"
- "/var/tmp somewhere with sufficient temporary space available.");
- return NULL;
- }
- if (!getcwd(Previous, FILENAME_MAX)) {
- dialog_clear();
- msgConfirm("getcwd");
- return NULL;
- }
- if (chdir(pen) == RET_FAIL) {
- dialog_clear();
- msgConfirm("Can't chdir to '%s'.", pen);
- }
- return Previous;
-}
diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h
index 8f15b8e..679d45c 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.44 1995/12/07 10:34:14 peter Exp $
+ * $Id: sysinstall.h,v 1.45 1996/03/02 07:31:56 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -278,6 +278,7 @@ typedef struct _indexEntry { /* A single entry in an INDEX file */
char *prefix; /* port prefix */
char *comment; /* one line description */
char *descrfile; /* path to description file */
+ char *deps; /* packages this depends on */
char *maintainer; /* maintainer */
} IndexEntry;
typedef IndexEntry *IndexEntryPtr;
@@ -469,7 +470,7 @@ void index_init(PkgNodePtr top, PkgNodePtr plist);
void index_node_free(PkgNodePtr top, PkgNodePtr plist);
void index_sort(PkgNodePtr top);
void index_print(PkgNodePtr top, int level);
-int index_extract(Device *dev, PkgNodePtr plist);
+int index_extract(Device *dev, PkgNodePtr top, PkgNodePtr plist);
/* install.c */
extern int installCommit(char *str);
@@ -534,7 +535,7 @@ extern Boolean mediaVerify(void);
/* misc.c */
extern Boolean file_readable(char *fname);
extern Boolean file_executable(char *fname);
-extern Boolean directoryExists(const char *dirname);
+extern Boolean directory_exists(const char *dirname);
extern char *string_concat(char *p1, char *p2);
extern char *string_concat3(char *p1, char *p2, char *p3);
extern char *string_prune(char *str);
diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c
index 7eb2328..26b6b74 100644
--- a/usr.sbin/sysinstall/system.c
+++ b/usr.sbin/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.46 1995/12/07 10:34:16 peter Exp $
+ * $Id: system.c,v 1.47 1996/03/02 07:31:56 jkh Exp $
*
* Jordan Hubbard
*
@@ -52,7 +52,7 @@ systemInitialize(int argc, char **argv)
close(1); dup(0);
close(2); dup(0);
printf("%s running as init\n", argv[0]);
-
+ RunningAsInit = 1;
i = ioctl(0, TIOCSCTTY, (char *)NULL);
setlogin("root");
setenv("PATH", "/stand:/bin:/sbin:/usr/sbin:/usr/bin:/mnt/bin:/mnt/sbin:/mnt/usr/sbin:/mnt/usr/bin:/usr/X11R6/bin", 1);
diff --git a/usr.sbin/sysinstall/termcap.c b/usr.sbin/sysinstall/termcap.c
index 3ab2088..7256b53c 100644
--- a/usr.sbin/sysinstall/termcap.c
+++ b/usr.sbin/sysinstall/termcap.c
@@ -29,15 +29,13 @@ set_termcap(void)
char *term;
int stat;
- OnVTY = RunningAsInit = FALSE;
+ OnVTY = FALSE;
term = getenv("TERM");
stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay);
if (getpid() != 1)
DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644);
- else
- RunningAsInit = TRUE;
if (stat < 0) {
if (!term) {
OpenPOWER on IntegriCloud