summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--release/sysinstall/config.c64
-rw-r--r--release/sysinstall/ftp_strat.c4
-rw-r--r--release/sysinstall/index.c94
-rw-r--r--release/sysinstall/options.c6
-rw-r--r--release/sysinstall/package.c17
-rw-r--r--release/sysinstall/sysinstall.h4
-rw-r--r--release/sysinstall/system.c6
-rw-r--r--release/sysinstall/termcap.c12
-rw-r--r--usr.sbin/sade/config.c64
-rw-r--r--usr.sbin/sade/sade.h4
-rw-r--r--usr.sbin/sade/system.c6
-rw-r--r--usr.sbin/sade/termcap.c12
-rw-r--r--usr.sbin/sysinstall/config.c64
-rw-r--r--usr.sbin/sysinstall/index.c94
-rw-r--r--usr.sbin/sysinstall/options.c6
-rw-r--r--usr.sbin/sysinstall/package.c17
-rw-r--r--usr.sbin/sysinstall/sysinstall.h4
-rw-r--r--usr.sbin/sysinstall/system.c6
-rw-r--r--usr.sbin/sysinstall/termcap.c12
19 files changed, 238 insertions, 258 deletions
diff --git a/release/sysinstall/config.c b/release/sysinstall/config.c
index ffc0025..13b8167 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.19 1996/03/18 15:27:44 jkh Exp $
+ * $Id: config.c,v 1.20 1996/03/19 11:51:36 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -408,7 +408,9 @@ configRoutedFlags(char *str)
int
configPackages(char *str)
{
- PkgNode top, plist;
+ static PkgNode top, plist;
+ static Boolean index_initted = FALSE;
+ PkgNodePtr tmp;
int fd;
if (!mediaVerify())
@@ -416,31 +418,34 @@ configPackages(char *str)
if (!mediaDevice->init(mediaDevice))
return RET_FAIL;
-
- msgNotify("Attempting to fetch packages/INDEX file from selected media.");
- fd = mediaDevice->get(mediaDevice, "packages/INDEX", TRUE);
- if (fd < 0) {
- dialog_clear();
- msgConfirm("Unable to get packages/INDEX file from selected media.\n"
- "This may be because the packages collection is not available at\n"
- "on the distribution media you've chosen (most likely an FTP site\n"
- "without the packages collection mirrored). Please verify media\n"
- "(or path to media) and try again. If your local site does not\n"
- "carry the packages collection, then we recommend either a CD\n"
- "distribution or the master distribution on ftp.freebsd.org.");
- return RET_FAIL;
- }
- msgNotify("Got INDEX successfully, now building packages menu..");
- index_init(&top, &plist);
- if (index_read(fd, &top)) {
- dialog_clear();
- msgConfirm("I/O or format error on packages/INDEX file.\n"
- "Please verify media (or path to media) and try again.");
+
+ if (!index_initted) {
+ msgNotify("Attempting to fetch packages/INDEX file from selected media.");
+ fd = mediaDevice->get(mediaDevice, "packages/INDEX", TRUE);
+ if (fd < 0) {
+ dialog_clear();
+ msgConfirm("Unable to get packages/INDEX file from selected media.\n"
+ "This may be because the packages collection is not available at\n"
+ "on the distribution media you've chosen (most likely an FTP site\n"
+ "without the packages collection mirrored). Please verify media\n"
+ "(or path to media) and try again. If your local site does not\n"
+ "carry the packages collection, then we recommend either a CD\n"
+ "distribution or the master distribution on ftp.freebsd.org.");
+ return RET_FAIL;
+ }
+ msgNotify("Got INDEX successfully, now building packages menu..");
+ index_init(&top, &plist);
+ if (index_read(fd, &top)) {
+ dialog_clear();
+ msgConfirm("I/O or format error on packages/INDEX file.\n"
+ "Please verify media (or path to media) and try again.");
+ mediaDevice->close(mediaDevice, fd);
+ return RET_FAIL;
+ }
mediaDevice->close(mediaDevice, fd);
- return RET_FAIL;
+ index_sort(&top);
+ index_initted = TRUE;
}
- mediaDevice->close(mediaDevice, fd);
- index_sort(&top);
while (1) {
int ret, pos, scroll;
@@ -465,7 +470,14 @@ configPackages(char *str)
break;
}
}
- index_node_free(&top, &plist);
+ tmp = &plist;
+ while (tmp) {
+ PkgNodePtr tmp2 = tmp->next;
+
+ safe_free(tmp);
+ tmp = tmp2;
+ }
+ index_init(NULL, &plist);
mediaDevice->shutdown(mediaDevice);
return RET_SUCCESS;
}
diff --git a/release/sysinstall/ftp_strat.c b/release/sysinstall/ftp_strat.c
index 8417169..2ca9031 100644
--- a/release/sysinstall/ftp_strat.c
+++ b/release/sysinstall/ftp_strat.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: ftp_strat.c,v 1.9 1996/03/02 07:31:53 jkh Exp $
+ * $Id: ftp_strat.c,v 1.10 1996/03/19 12:23:54 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -200,7 +200,7 @@ retry:
FtpPassive(ftp, !strcmp(variable_get(VAR_FTP_STATE), "passive"));
FtpBinary(ftp, 1);
if (dir && *dir != '\0') {
- msgNotify("Attempt to chdir to distribution in %s..", dir);
+ msgDebug("Attempt to chdir to distribution in %s\n", dir);
if ((i = FtpChdir(ftp, dir)) != 0) {
if (i == -2 || ftpShouldAbort(dev, ++retries))
goto punt;
diff --git a/release/sysinstall/index.c b/release/sysinstall/index.c
index 5697735..ec86888 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.20 1995/11/12 20:47:12 jkh Exp $
+ * $Id: index.c,v 1.21 1996/03/18 15:27:51 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -53,7 +53,7 @@
#define MAX_MENU 13
#define _MAX_DESC 62
-static int index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who);
+static int index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended);
/* Smarter strdup */
inline char *
@@ -185,7 +185,6 @@ copy_to_sep(char *to, char *from, int sep)
tok = strchr(from, sep);
if (!tok) {
- fprintf(stderr, "missing '%c' token.\n", sep);
*to = '\0';
return 0;
}
@@ -272,53 +271,22 @@ index_read(int fd, PkgNodePtr papa)
void
index_init(PkgNodePtr top, PkgNodePtr plist)
{
- top->next = top->kids = NULL;
- top->name = "Package Selection";
- top->type = PLACE;
- top->desc = fetch_desc(top->name);
- top->data = NULL;
-
- plist->next = plist->kids = NULL;
- plist->name = "Package Targets";
- plist->type = PLACE;
- plist->desc = fetch_desc(plist->name);
- plist->data = NULL;
-}
-
-void
-index_entry_free(IndexEntryPtr top)
-{
- safe_free(top->name);
- safe_free(top->path);
- safe_free(top->prefix);
- safe_free(top->comment);
- safe_free(top->descrfile);
- safe_free(top->maintainer);
- free(top);
-}
-
-void
-index_node_free(PkgNodePtr top, PkgNodePtr plist)
-{
- PkgNodePtr tmp;
-
- tmp = plist;
- while (tmp) {
- PkgNodePtr tmp2 = tmp->next;
-
- safe_free(tmp);
- tmp = tmp2;
+ if (top) {
+ top->next = top->kids = NULL;
+ top->name = "Package Selection";
+ top->type = PLACE;
+ top->desc = fetch_desc(top->name);
+ top->data = NULL;
}
-
- for (tmp = top; tmp; tmp = tmp->next) {
- free(tmp->name);
- if (tmp->type == PACKAGE && tmp->data)
- index_entry_free((IndexEntryPtr)tmp->data);
- if (tmp->kids)
- index_node_free(tmp->kids, NULL);
+ if (plist) {
+ plist->next = plist->kids = NULL;
+ plist->name = "Package Targets";
+ plist->type = PLACE;
+ plist->desc = fetch_desc(plist->name);
+ plist->data = NULL;
}
}
-
+
void
index_print(PkgNodePtr top, int level)
{
@@ -398,7 +366,7 @@ index_search(PkgNodePtr top, char *str, PkgNodePtr *tp)
return p;
/* If tp, we're looking for both a package and a pointer to the place it's in */
- if (tp && strstr(p->name, str)) {
+ if (tp && !strcmp(p->name, str)) {
*tp = top;
return p;
}
@@ -511,14 +479,14 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
np->next = plist->kids;
plist->kids = np;
standout();
- mvprintw(23, 0, "Selected packages were added to selection list\n", kp->name);
+ mvprintw(24, 0, "Selected packages were added to selection list\n", kp->name);
standend();
refresh();
}
}
else if (sp) {
standout();
- mvprintw(23, 0, "Deleting unselected packages from selection list\n", kp->name);
+ mvprintw(24, 0, "Deleting unselected packages from selection list\n", kp->name);
standend();
refresh();
index_delete(sp);
@@ -567,33 +535,33 @@ index_extract(Device *dev, PkgNodePtr top, PkgNodePtr plist)
int status = RET_SUCCESS;
for (tmp = plist->kids; tmp; tmp = tmp->next)
- status = index_extract_one(dev, top, tmp);
+ status = index_extract_one(dev, top, tmp, FALSE);
return status;
}
static int
-index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who)
+index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended)
{
int status = RET_SUCCESS;
PkgNodePtr tmp2;
+ IndexEntryPtr id = who->data;
- if (((IndexEntryPtr)who->data)->deps) {
+ if (id && id->deps && strlen(id->deps)) {
char t[1024], *cp, *cp2;
- strcpy(t, ((IndexEntryPtr)who->data)->deps);
+ strcpy(t, id->deps);
cp = t;
- while (cp) {
+ while (cp && status == RET_SUCCESS) {
if ((cp2 = index(cp, ' ')) != NULL)
*cp2 = '\0';
- if (index_search(top, cp, &tmp2)) {
- status = index_extract_one(dev, top, tmp2);
+ if ((tmp2 = index_search(top, cp, NULL)) != NULL) {
+ status = index_extract_one(dev, top, tmp2, TRUE);
if (status != RET_SUCCESS) {
- msgDebug("Loading of dependant package %s failed\n", cp);
- break;
+ if (variable_get(VAR_NO_CONFIRM))
+ msgNotify("Loading of dependant package %s failed", cp);
+ else
+ msgConfirm("Loading of dependant package %s failed", cp);
}
- status = package_extract(dev, cp);
- if (status != RET_SUCCESS)
- break;
if (cp2)
cp = cp2 + 1;
else
@@ -603,6 +571,6 @@ index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who)
}
/* Done with the deps? Load the real m'coy */
if (status == RET_SUCCESS)
- status = package_extract(dev, who->name);
+ status = package_extract(dev, who->name, depended);
return status;
}
diff --git a/release/sysinstall/options.c b/release/sysinstall/options.c
index 9584881..9ea597d 100644
--- a/release/sysinstall/options.c
+++ b/release/sysinstall/options.c
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
- * $Id: options.c,v 1.27 1995/11/06 12:49:25 jkh Exp $
+ * $Id: options.c,v 1.28 1996/03/19 12:08:00 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -181,7 +181,6 @@ fire(Option opt)
else if (opt.type == OPT_IS_VAR) {
if (opt.data) {
(void)variable_get_value(opt.aux, opt.data);
- dialog_clear();
}
else if (variable_get(opt.aux))
variable_unset(opt.aux);
@@ -269,9 +268,8 @@ optionsEditor(char *str)
continue;
case ' ':
- dialog_clear();
+ clear();
fire(Options[currOpt]);
- dialog_clear();
clear();
continue;
diff --git a/release/sysinstall/package.c b/release/sysinstall/package.c
index 5e936c7..8e43f7a 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.28 1995/12/04 02:22:02 jkh Exp $
+ * $Id: package.c,v 1.29 1996/03/18 15:28:05 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -56,12 +56,12 @@ package_add(char *name)
{
if (!mediaVerify())
return RET_FAIL;
- return package_extract(mediaDevice, name);
+ return package_extract(mediaDevice, name, FALSE);
}
/* Extract a package based on a namespec and a media device */
int
-package_extract(Device *dev, char *name)
+package_extract(Device *dev, char *name, Boolean depended)
{
char path[511];
int fd, ret;
@@ -83,7 +83,8 @@ package_extract(Device *dev, char *name)
return RET_FAIL;
}
- ret = RET_FAIL;
+ /* Be initially optimistic */
+ ret = RET_SUCCESS;
/* Make a couple of paranoid locations for temp files to live if user specified none */
if (!variable_get("PKG_TMPDIR")) {
Mkdir("/usr/tmp", NULL);
@@ -93,12 +94,13 @@ package_extract(Device *dev, char *name)
}
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) {
int i, tot, pfd[2];
pid_t pid;
+ dialog_clear();
+ msgNotify("Adding %s%s\nfrom %s", path, depended ? " (as a dependency)" : "", dev->name);
pipe(pfd);
pid = fork();
if (!pid) {
@@ -113,7 +115,6 @@ package_extract(Device *dev, char *name)
else {
char buf[BUFSIZ];
- dialog_clear();
tot = 0;
while ((i = read(fd, buf, BUFSIZ)) > 0) {
write(pfd[1], buf, i);
@@ -124,7 +125,8 @@ package_extract(Device *dev, char *name)
}
close(fd);
close(pfd[1]);
- dialog_clear();
+ mvprintw(0, 0, "Package %s read successfully - waiting for pkg_add", name);
+ refresh();
i = waitpid(pid, &tot, 0);
if (i < 0 || WEXITSTATUS(tot)) {
msgNotify("Add of package %s aborted due to some error -\n"
@@ -144,6 +146,7 @@ package_extract(Device *dev, char *name)
msgConfirm("Unable to fetch package %s from selected media.\n"
"No package add will be done.", name);
}
+ ret = RET_FAIL;
}
return ret;
}
diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h
index 679d45c..01eb68b 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.45 1996/03/02 07:31:56 jkh Exp $
+ * $Id: sysinstall.h,v 1.46 1996/03/18 15:28:06 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -582,7 +582,7 @@ extern int optionsEditor(char *str);
/* package.c */
extern int package_add(char *name);
-extern int package_extract(Device *dev, char *name);
+extern int package_extract(Device *dev, char *name, Boolean depended);
/* system.c */
extern void systemInitialize(int argc, char **argv);
diff --git a/release/sysinstall/system.c b/release/sysinstall/system.c
index 26b6b74..3622f90 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.47 1996/03/02 07:31:56 jkh Exp $
+ * $Id: system.c,v 1.48 1996/03/18 15:28:08 jkh Exp $
*
* Jordan Hubbard
*
@@ -217,7 +217,7 @@ vsystem(char *fmt, ...)
else if (!pid) { /* Junior */
(void)sigsetmask(omask);
if (DebugFD != -1) {
- if (OnVTY && isDebug())
+ if (OnVTY && isDebug() && RunningAsInit)
msgInfo("Command output is on VTY2 - type ALT-F2 to see it");
dup2(DebugFD, 0);
dup2(DebugFD, 1);
@@ -244,7 +244,7 @@ vsystem(char *fmt, ...)
void
systemCreateHoloshell(void)
{
- if (OnVTY) {
+ if (OnVTY && RunningAsInit) {
if (!fork()) {
int i, fd;
struct termios foo;
diff --git a/release/sysinstall/termcap.c b/release/sysinstall/termcap.c
index 7256b53c..30efe0c 100644
--- a/release/sysinstall/termcap.c
+++ b/release/sysinstall/termcap.c
@@ -50,11 +50,13 @@ set_termcap(void)
else {
int i, on;
- DebugFD = open("/dev/ttyv1", O_WRONLY);
- on = 1;
- i = ioctl(DebugFD, TIOCCONS, (char *)&on);
- msgDebug("ioctl(%d, TIOCCONS, NULL) = %d (%s)\n", DebugFD, i, !i ? "success" : strerror(errno));
- OnVTY = TRUE;
+ if (getpid() == 1) {
+ DebugFD = open("/dev/ttyv1", O_WRONLY);
+ on = 1;
+ i = ioctl(DebugFD, TIOCCONS, (char *)&on);
+ msgDebug("ioctl(%d, TIOCCONS, NULL) = %d (%s)\n", DebugFD, i, !i ? "success" : strerror(errno));
+ OnVTY = TRUE;
+ }
if (ColorDisplay) {
if (!term) {
if (setenv("TERM", "cons25", 1) < 0)
diff --git a/usr.sbin/sade/config.c b/usr.sbin/sade/config.c
index ffc0025..13b8167 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.19 1996/03/18 15:27:44 jkh Exp $
+ * $Id: config.c,v 1.20 1996/03/19 11:51:36 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -408,7 +408,9 @@ configRoutedFlags(char *str)
int
configPackages(char *str)
{
- PkgNode top, plist;
+ static PkgNode top, plist;
+ static Boolean index_initted = FALSE;
+ PkgNodePtr tmp;
int fd;
if (!mediaVerify())
@@ -416,31 +418,34 @@ configPackages(char *str)
if (!mediaDevice->init(mediaDevice))
return RET_FAIL;
-
- msgNotify("Attempting to fetch packages/INDEX file from selected media.");
- fd = mediaDevice->get(mediaDevice, "packages/INDEX", TRUE);
- if (fd < 0) {
- dialog_clear();
- msgConfirm("Unable to get packages/INDEX file from selected media.\n"
- "This may be because the packages collection is not available at\n"
- "on the distribution media you've chosen (most likely an FTP site\n"
- "without the packages collection mirrored). Please verify media\n"
- "(or path to media) and try again. If your local site does not\n"
- "carry the packages collection, then we recommend either a CD\n"
- "distribution or the master distribution on ftp.freebsd.org.");
- return RET_FAIL;
- }
- msgNotify("Got INDEX successfully, now building packages menu..");
- index_init(&top, &plist);
- if (index_read(fd, &top)) {
- dialog_clear();
- msgConfirm("I/O or format error on packages/INDEX file.\n"
- "Please verify media (or path to media) and try again.");
+
+ if (!index_initted) {
+ msgNotify("Attempting to fetch packages/INDEX file from selected media.");
+ fd = mediaDevice->get(mediaDevice, "packages/INDEX", TRUE);
+ if (fd < 0) {
+ dialog_clear();
+ msgConfirm("Unable to get packages/INDEX file from selected media.\n"
+ "This may be because the packages collection is not available at\n"
+ "on the distribution media you've chosen (most likely an FTP site\n"
+ "without the packages collection mirrored). Please verify media\n"
+ "(or path to media) and try again. If your local site does not\n"
+ "carry the packages collection, then we recommend either a CD\n"
+ "distribution or the master distribution on ftp.freebsd.org.");
+ return RET_FAIL;
+ }
+ msgNotify("Got INDEX successfully, now building packages menu..");
+ index_init(&top, &plist);
+ if (index_read(fd, &top)) {
+ dialog_clear();
+ msgConfirm("I/O or format error on packages/INDEX file.\n"
+ "Please verify media (or path to media) and try again.");
+ mediaDevice->close(mediaDevice, fd);
+ return RET_FAIL;
+ }
mediaDevice->close(mediaDevice, fd);
- return RET_FAIL;
+ index_sort(&top);
+ index_initted = TRUE;
}
- mediaDevice->close(mediaDevice, fd);
- index_sort(&top);
while (1) {
int ret, pos, scroll;
@@ -465,7 +470,14 @@ configPackages(char *str)
break;
}
}
- index_node_free(&top, &plist);
+ tmp = &plist;
+ while (tmp) {
+ PkgNodePtr tmp2 = tmp->next;
+
+ safe_free(tmp);
+ tmp = tmp2;
+ }
+ index_init(NULL, &plist);
mediaDevice->shutdown(mediaDevice);
return RET_SUCCESS;
}
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index 679d45c..01eb68b 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.45 1996/03/02 07:31:56 jkh Exp $
+ * $Id: sysinstall.h,v 1.46 1996/03/18 15:28:06 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -582,7 +582,7 @@ extern int optionsEditor(char *str);
/* package.c */
extern int package_add(char *name);
-extern int package_extract(Device *dev, char *name);
+extern int package_extract(Device *dev, char *name, Boolean depended);
/* system.c */
extern void systemInitialize(int argc, char **argv);
diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c
index 26b6b74..3622f90 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.47 1996/03/02 07:31:56 jkh Exp $
+ * $Id: system.c,v 1.48 1996/03/18 15:28:08 jkh Exp $
*
* Jordan Hubbard
*
@@ -217,7 +217,7 @@ vsystem(char *fmt, ...)
else if (!pid) { /* Junior */
(void)sigsetmask(omask);
if (DebugFD != -1) {
- if (OnVTY && isDebug())
+ if (OnVTY && isDebug() && RunningAsInit)
msgInfo("Command output is on VTY2 - type ALT-F2 to see it");
dup2(DebugFD, 0);
dup2(DebugFD, 1);
@@ -244,7 +244,7 @@ vsystem(char *fmt, ...)
void
systemCreateHoloshell(void)
{
- if (OnVTY) {
+ if (OnVTY && RunningAsInit) {
if (!fork()) {
int i, fd;
struct termios foo;
diff --git a/usr.sbin/sade/termcap.c b/usr.sbin/sade/termcap.c
index 7256b53c..30efe0c 100644
--- a/usr.sbin/sade/termcap.c
+++ b/usr.sbin/sade/termcap.c
@@ -50,11 +50,13 @@ set_termcap(void)
else {
int i, on;
- DebugFD = open("/dev/ttyv1", O_WRONLY);
- on = 1;
- i = ioctl(DebugFD, TIOCCONS, (char *)&on);
- msgDebug("ioctl(%d, TIOCCONS, NULL) = %d (%s)\n", DebugFD, i, !i ? "success" : strerror(errno));
- OnVTY = TRUE;
+ if (getpid() == 1) {
+ DebugFD = open("/dev/ttyv1", O_WRONLY);
+ on = 1;
+ i = ioctl(DebugFD, TIOCCONS, (char *)&on);
+ msgDebug("ioctl(%d, TIOCCONS, NULL) = %d (%s)\n", DebugFD, i, !i ? "success" : strerror(errno));
+ OnVTY = TRUE;
+ }
if (ColorDisplay) {
if (!term) {
if (setenv("TERM", "cons25", 1) < 0)
diff --git a/usr.sbin/sysinstall/config.c b/usr.sbin/sysinstall/config.c
index ffc0025..13b8167 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.19 1996/03/18 15:27:44 jkh Exp $
+ * $Id: config.c,v 1.20 1996/03/19 11:51:36 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -408,7 +408,9 @@ configRoutedFlags(char *str)
int
configPackages(char *str)
{
- PkgNode top, plist;
+ static PkgNode top, plist;
+ static Boolean index_initted = FALSE;
+ PkgNodePtr tmp;
int fd;
if (!mediaVerify())
@@ -416,31 +418,34 @@ configPackages(char *str)
if (!mediaDevice->init(mediaDevice))
return RET_FAIL;
-
- msgNotify("Attempting to fetch packages/INDEX file from selected media.");
- fd = mediaDevice->get(mediaDevice, "packages/INDEX", TRUE);
- if (fd < 0) {
- dialog_clear();
- msgConfirm("Unable to get packages/INDEX file from selected media.\n"
- "This may be because the packages collection is not available at\n"
- "on the distribution media you've chosen (most likely an FTP site\n"
- "without the packages collection mirrored). Please verify media\n"
- "(or path to media) and try again. If your local site does not\n"
- "carry the packages collection, then we recommend either a CD\n"
- "distribution or the master distribution on ftp.freebsd.org.");
- return RET_FAIL;
- }
- msgNotify("Got INDEX successfully, now building packages menu..");
- index_init(&top, &plist);
- if (index_read(fd, &top)) {
- dialog_clear();
- msgConfirm("I/O or format error on packages/INDEX file.\n"
- "Please verify media (or path to media) and try again.");
+
+ if (!index_initted) {
+ msgNotify("Attempting to fetch packages/INDEX file from selected media.");
+ fd = mediaDevice->get(mediaDevice, "packages/INDEX", TRUE);
+ if (fd < 0) {
+ dialog_clear();
+ msgConfirm("Unable to get packages/INDEX file from selected media.\n"
+ "This may be because the packages collection is not available at\n"
+ "on the distribution media you've chosen (most likely an FTP site\n"
+ "without the packages collection mirrored). Please verify media\n"
+ "(or path to media) and try again. If your local site does not\n"
+ "carry the packages collection, then we recommend either a CD\n"
+ "distribution or the master distribution on ftp.freebsd.org.");
+ return RET_FAIL;
+ }
+ msgNotify("Got INDEX successfully, now building packages menu..");
+ index_init(&top, &plist);
+ if (index_read(fd, &top)) {
+ dialog_clear();
+ msgConfirm("I/O or format error on packages/INDEX file.\n"
+ "Please verify media (or path to media) and try again.");
+ mediaDevice->close(mediaDevice, fd);
+ return RET_FAIL;
+ }
mediaDevice->close(mediaDevice, fd);
- return RET_FAIL;
+ index_sort(&top);
+ index_initted = TRUE;
}
- mediaDevice->close(mediaDevice, fd);
- index_sort(&top);
while (1) {
int ret, pos, scroll;
@@ -465,7 +470,14 @@ configPackages(char *str)
break;
}
}
- index_node_free(&top, &plist);
+ tmp = &plist;
+ while (tmp) {
+ PkgNodePtr tmp2 = tmp->next;
+
+ safe_free(tmp);
+ tmp = tmp2;
+ }
+ index_init(NULL, &plist);
mediaDevice->shutdown(mediaDevice);
return RET_SUCCESS;
}
diff --git a/usr.sbin/sysinstall/index.c b/usr.sbin/sysinstall/index.c
index 5697735..ec86888 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.20 1995/11/12 20:47:12 jkh Exp $
+ * $Id: index.c,v 1.21 1996/03/18 15:27:51 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -53,7 +53,7 @@
#define MAX_MENU 13
#define _MAX_DESC 62
-static int index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who);
+static int index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended);
/* Smarter strdup */
inline char *
@@ -185,7 +185,6 @@ copy_to_sep(char *to, char *from, int sep)
tok = strchr(from, sep);
if (!tok) {
- fprintf(stderr, "missing '%c' token.\n", sep);
*to = '\0';
return 0;
}
@@ -272,53 +271,22 @@ index_read(int fd, PkgNodePtr papa)
void
index_init(PkgNodePtr top, PkgNodePtr plist)
{
- top->next = top->kids = NULL;
- top->name = "Package Selection";
- top->type = PLACE;
- top->desc = fetch_desc(top->name);
- top->data = NULL;
-
- plist->next = plist->kids = NULL;
- plist->name = "Package Targets";
- plist->type = PLACE;
- plist->desc = fetch_desc(plist->name);
- plist->data = NULL;
-}
-
-void
-index_entry_free(IndexEntryPtr top)
-{
- safe_free(top->name);
- safe_free(top->path);
- safe_free(top->prefix);
- safe_free(top->comment);
- safe_free(top->descrfile);
- safe_free(top->maintainer);
- free(top);
-}
-
-void
-index_node_free(PkgNodePtr top, PkgNodePtr plist)
-{
- PkgNodePtr tmp;
-
- tmp = plist;
- while (tmp) {
- PkgNodePtr tmp2 = tmp->next;
-
- safe_free(tmp);
- tmp = tmp2;
+ if (top) {
+ top->next = top->kids = NULL;
+ top->name = "Package Selection";
+ top->type = PLACE;
+ top->desc = fetch_desc(top->name);
+ top->data = NULL;
}
-
- for (tmp = top; tmp; tmp = tmp->next) {
- free(tmp->name);
- if (tmp->type == PACKAGE && tmp->data)
- index_entry_free((IndexEntryPtr)tmp->data);
- if (tmp->kids)
- index_node_free(tmp->kids, NULL);
+ if (plist) {
+ plist->next = plist->kids = NULL;
+ plist->name = "Package Targets";
+ plist->type = PLACE;
+ plist->desc = fetch_desc(plist->name);
+ plist->data = NULL;
}
}
-
+
void
index_print(PkgNodePtr top, int level)
{
@@ -398,7 +366,7 @@ index_search(PkgNodePtr top, char *str, PkgNodePtr *tp)
return p;
/* If tp, we're looking for both a package and a pointer to the place it's in */
- if (tp && strstr(p->name, str)) {
+ if (tp && !strcmp(p->name, str)) {
*tp = top;
return p;
}
@@ -511,14 +479,14 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
np->next = plist->kids;
plist->kids = np;
standout();
- mvprintw(23, 0, "Selected packages were added to selection list\n", kp->name);
+ mvprintw(24, 0, "Selected packages were added to selection list\n", kp->name);
standend();
refresh();
}
}
else if (sp) {
standout();
- mvprintw(23, 0, "Deleting unselected packages from selection list\n", kp->name);
+ mvprintw(24, 0, "Deleting unselected packages from selection list\n", kp->name);
standend();
refresh();
index_delete(sp);
@@ -567,33 +535,33 @@ index_extract(Device *dev, PkgNodePtr top, PkgNodePtr plist)
int status = RET_SUCCESS;
for (tmp = plist->kids; tmp; tmp = tmp->next)
- status = index_extract_one(dev, top, tmp);
+ status = index_extract_one(dev, top, tmp, FALSE);
return status;
}
static int
-index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who)
+index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended)
{
int status = RET_SUCCESS;
PkgNodePtr tmp2;
+ IndexEntryPtr id = who->data;
- if (((IndexEntryPtr)who->data)->deps) {
+ if (id && id->deps && strlen(id->deps)) {
char t[1024], *cp, *cp2;
- strcpy(t, ((IndexEntryPtr)who->data)->deps);
+ strcpy(t, id->deps);
cp = t;
- while (cp) {
+ while (cp && status == RET_SUCCESS) {
if ((cp2 = index(cp, ' ')) != NULL)
*cp2 = '\0';
- if (index_search(top, cp, &tmp2)) {
- status = index_extract_one(dev, top, tmp2);
+ if ((tmp2 = index_search(top, cp, NULL)) != NULL) {
+ status = index_extract_one(dev, top, tmp2, TRUE);
if (status != RET_SUCCESS) {
- msgDebug("Loading of dependant package %s failed\n", cp);
- break;
+ if (variable_get(VAR_NO_CONFIRM))
+ msgNotify("Loading of dependant package %s failed", cp);
+ else
+ msgConfirm("Loading of dependant package %s failed", cp);
}
- status = package_extract(dev, cp);
- if (status != RET_SUCCESS)
- break;
if (cp2)
cp = cp2 + 1;
else
@@ -603,6 +571,6 @@ index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who)
}
/* Done with the deps? Load the real m'coy */
if (status == RET_SUCCESS)
- status = package_extract(dev, who->name);
+ status = package_extract(dev, who->name, depended);
return status;
}
diff --git a/usr.sbin/sysinstall/options.c b/usr.sbin/sysinstall/options.c
index 9584881..9ea597d 100644
--- a/usr.sbin/sysinstall/options.c
+++ b/usr.sbin/sysinstall/options.c
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
- * $Id: options.c,v 1.27 1995/11/06 12:49:25 jkh Exp $
+ * $Id: options.c,v 1.28 1996/03/19 12:08:00 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -181,7 +181,6 @@ fire(Option opt)
else if (opt.type == OPT_IS_VAR) {
if (opt.data) {
(void)variable_get_value(opt.aux, opt.data);
- dialog_clear();
}
else if (variable_get(opt.aux))
variable_unset(opt.aux);
@@ -269,9 +268,8 @@ optionsEditor(char *str)
continue;
case ' ':
- dialog_clear();
+ clear();
fire(Options[currOpt]);
- dialog_clear();
clear();
continue;
diff --git a/usr.sbin/sysinstall/package.c b/usr.sbin/sysinstall/package.c
index 5e936c7..8e43f7a 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.28 1995/12/04 02:22:02 jkh Exp $
+ * $Id: package.c,v 1.29 1996/03/18 15:28:05 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -56,12 +56,12 @@ package_add(char *name)
{
if (!mediaVerify())
return RET_FAIL;
- return package_extract(mediaDevice, name);
+ return package_extract(mediaDevice, name, FALSE);
}
/* Extract a package based on a namespec and a media device */
int
-package_extract(Device *dev, char *name)
+package_extract(Device *dev, char *name, Boolean depended)
{
char path[511];
int fd, ret;
@@ -83,7 +83,8 @@ package_extract(Device *dev, char *name)
return RET_FAIL;
}
- ret = RET_FAIL;
+ /* Be initially optimistic */
+ ret = RET_SUCCESS;
/* Make a couple of paranoid locations for temp files to live if user specified none */
if (!variable_get("PKG_TMPDIR")) {
Mkdir("/usr/tmp", NULL);
@@ -93,12 +94,13 @@ package_extract(Device *dev, char *name)
}
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) {
int i, tot, pfd[2];
pid_t pid;
+ dialog_clear();
+ msgNotify("Adding %s%s\nfrom %s", path, depended ? " (as a dependency)" : "", dev->name);
pipe(pfd);
pid = fork();
if (!pid) {
@@ -113,7 +115,6 @@ package_extract(Device *dev, char *name)
else {
char buf[BUFSIZ];
- dialog_clear();
tot = 0;
while ((i = read(fd, buf, BUFSIZ)) > 0) {
write(pfd[1], buf, i);
@@ -124,7 +125,8 @@ package_extract(Device *dev, char *name)
}
close(fd);
close(pfd[1]);
- dialog_clear();
+ mvprintw(0, 0, "Package %s read successfully - waiting for pkg_add", name);
+ refresh();
i = waitpid(pid, &tot, 0);
if (i < 0 || WEXITSTATUS(tot)) {
msgNotify("Add of package %s aborted due to some error -\n"
@@ -144,6 +146,7 @@ package_extract(Device *dev, char *name)
msgConfirm("Unable to fetch package %s from selected media.\n"
"No package add will be done.", name);
}
+ ret = RET_FAIL;
}
return ret;
}
diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h
index 679d45c..01eb68b 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.45 1996/03/02 07:31:56 jkh Exp $
+ * $Id: sysinstall.h,v 1.46 1996/03/18 15:28:06 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -582,7 +582,7 @@ extern int optionsEditor(char *str);
/* package.c */
extern int package_add(char *name);
-extern int package_extract(Device *dev, char *name);
+extern int package_extract(Device *dev, char *name, Boolean depended);
/* system.c */
extern void systemInitialize(int argc, char **argv);
diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c
index 26b6b74..3622f90 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.47 1996/03/02 07:31:56 jkh Exp $
+ * $Id: system.c,v 1.48 1996/03/18 15:28:08 jkh Exp $
*
* Jordan Hubbard
*
@@ -217,7 +217,7 @@ vsystem(char *fmt, ...)
else if (!pid) { /* Junior */
(void)sigsetmask(omask);
if (DebugFD != -1) {
- if (OnVTY && isDebug())
+ if (OnVTY && isDebug() && RunningAsInit)
msgInfo("Command output is on VTY2 - type ALT-F2 to see it");
dup2(DebugFD, 0);
dup2(DebugFD, 1);
@@ -244,7 +244,7 @@ vsystem(char *fmt, ...)
void
systemCreateHoloshell(void)
{
- if (OnVTY) {
+ if (OnVTY && RunningAsInit) {
if (!fork()) {
int i, fd;
struct termios foo;
diff --git a/usr.sbin/sysinstall/termcap.c b/usr.sbin/sysinstall/termcap.c
index 7256b53c..30efe0c 100644
--- a/usr.sbin/sysinstall/termcap.c
+++ b/usr.sbin/sysinstall/termcap.c
@@ -50,11 +50,13 @@ set_termcap(void)
else {
int i, on;
- DebugFD = open("/dev/ttyv1", O_WRONLY);
- on = 1;
- i = ioctl(DebugFD, TIOCCONS, (char *)&on);
- msgDebug("ioctl(%d, TIOCCONS, NULL) = %d (%s)\n", DebugFD, i, !i ? "success" : strerror(errno));
- OnVTY = TRUE;
+ if (getpid() == 1) {
+ DebugFD = open("/dev/ttyv1", O_WRONLY);
+ on = 1;
+ i = ioctl(DebugFD, TIOCCONS, (char *)&on);
+ msgDebug("ioctl(%d, TIOCCONS, NULL) = %d (%s)\n", DebugFD, i, !i ? "success" : strerror(errno));
+ OnVTY = TRUE;
+ }
if (ColorDisplay) {
if (!term) {
if (setenv("TERM", "cons25", 1) < 0)
OpenPOWER on IntegriCloud