diff options
author | jkh <jkh@FreeBSD.org> | 1999-05-15 14:34:22 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1999-05-15 14:34:22 +0000 |
commit | 33daa8b33a51b3df7dd9eb1aed37b9f6717a0cbd (patch) | |
tree | 83a93f830dc3b460a0427a856def20a44eac460b /release/sysinstall | |
parent | f1c57e949bd50b178bb720ba816780275cda469e (diff) | |
download | FreeBSD-src-33daa8b33a51b3df7dd9eb1aed37b9f6717a0cbd.zip FreeBSD-src-33daa8b33a51b3df7dd9eb1aed37b9f6717a0cbd.tar.gz |
o Prevent alpha installs from grabbing x86 bits and vice-versa, at least
on CDs and FTP sites.
o Collapse some redundant code.
o Fix typo'd menu.
o Restrict searches properly to packages rather than categories.
o Small tweaks to signal handling.
All RELENG_3 candidates.
Diffstat (limited to 'release/sysinstall')
-rw-r--r-- | release/sysinstall/cdrom.c | 65 | ||||
-rw-r--r-- | release/sysinstall/config.c | 5 | ||||
-rw-r--r-- | release/sysinstall/index.c | 51 | ||||
-rw-r--r-- | release/sysinstall/menus.c | 4 | ||||
-rw-r--r-- | release/sysinstall/package.c | 19 | ||||
-rw-r--r-- | release/sysinstall/sysinstall.h | 5 |
6 files changed, 80 insertions, 69 deletions
diff --git a/release/sysinstall/cdrom.c b/release/sysinstall/cdrom.c index 0115202..decf297 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.44 1998/12/22 12:31:24 jkh Exp $ + * $Id: cdrom.c,v 1.45 1999/01/20 12:31:42 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -112,36 +112,57 @@ mediaInitCDROM(Device *dev) } } - if (readInfo && - (!(cd_attr = read_props(string_concat(mountpoint, "/cdrom.inf"))) || - !(cp = property_find(cd_attr, "CD_VERSION")) || (strcmp(cp, variable_get(VAR_RELNAME)) && strcmp("none", variable_get(VAR_RELNAME))))) { - if (!cp) { + if (readInfo) { + if (!(cd_attr = read_props(string_concat(mountpoint, "/cdrom.inf"))) + || !(cp = property_find(cd_attr, "CD_VERSION"))) { msgConfirm("Unable to find a %s/cdrom.inf file.\n" "Either this is not a FreeBSD CDROM, there is a problem with\n" "the CDROM driver or something is wrong with your hardware.\n" "Please fix this problem (check the console logs on VTY2) and\n" "try again.", mountpoint); } - else if (!bogusCDOK) { - msgConfirm("Warning: The version of the FreeBSD CD currently in the drive\n" - "(%s) does not match the version of the boot floppy\n" - "(%s).\n\n" - "If this is intentional, to avoid this message in the future\n" - "please visit the Options editor to set the boot floppy version\n" - "string to match that of the CD before selecting it as your\n" - "installation media.", cp, variable_get(VAR_RELNAME)); - - if (msgYesNo("Would you like to try and use this CDROM anyway?") != 0) { - unmount(mountpoint, MNT_FORCE); - cdromMounted = FALSE; - properties_free(cd_attr); - return FALSE; + else { + if (variable_cmp(VAR_RELNAME, cp) + && variable_cmp(VAR_RELNAME, "none") + && variable_cmp(VAR_RELNAME, "any") && !bogusCDOK) { + msgConfirm("Warning: The version of the FreeBSD CD currently in the drive\n" + "(%s) does not match the version of the boot floppy\n" + "(%s).\n\n" + "If this is intentional, to avoid this message in the future\n" + "please visit the Options editor to set the boot floppy version\n" + "string to match that of the CD before selecting it as your\n" + "installation media.", cp, variable_get(VAR_RELNAME)); + + if (msgYesNo("Would you like to try and use this CDROM anyway?") != 0) { + unmount(mountpoint, MNT_FORCE); + cdromMounted = FALSE; + properties_free(cd_attr); + return FALSE; + } + else + bogusCDOK = TRUE; + } + if ((cp = property_find(cd_attr, "CD_MACHINE_ARCH")) != NULL) { +#ifdef __alpha__ + if (strcmp(cp, "alpha")) { +#else + if (strcmp(cp, "x86")) { +#endif + msgConfirm("Fatal: The FreeBSD install CD currently in the drive\n" + "is for the %s architecture, not the machine you're using.\n\n" + + "Please use the correct installation CD for your machine type.", cp); + + unmount(mountpoint, MNT_FORCE); + cdromMounted = FALSE; + properties_free(cd_attr); + return FALSE; + } } - else - bogusCDOK = TRUE; } } - properties_free(cd_attr); + if (cd_attr) + properties_free(cd_attr); return TRUE; } diff --git a/release/sysinstall/config.c b/release/sysinstall/config.c index 0836bcf..52d63da 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.132 1999/05/12 09:22:47 jkh Exp $ + * $Id: config.c,v 1.133 1999/05/14 15:04:24 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -724,7 +724,8 @@ configPackages(dialogMenuItem *self) if (ret & DITEM_LEAVE_MENU) break; else if (DITEM_STATUS(ret) != DITEM_FAILURE) { - index_extract(mediaDevice, &Top, &Plist); + for (tmp = Plist.kids; tmp && tmp->name; tmp = tmp->next) + (void)index_extract(mediaDevice, &Top, tmp, FALSE); break; } } diff --git a/release/sysinstall/index.c b/release/sysinstall/index.c index 7eb3ab3..48f34f7 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.65 1999/05/12 09:02:34 jkh Exp $ + * $Id: index.c,v 1.66 1999/05/14 12:15:32 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -70,7 +70,7 @@ _strdup(char *ptr) static char *descrs[] = { "Package Selection", "To mark a package, move to it and press SPACE. If the package is\n" "already marked, it will be unmarked or deleted (if installed).\n" - "Items marked with a 'D' are dependencies which will be auto-loaded\n." + "Items marked with a `D' are dependencies which will be auto-loaded.\n" "To search for a package by name, press ESC. To select a category,\n" "press RETURN. NOTE: The All category selection creates a very large\n" "submenu! If you select it, please be patient while it comes up.", @@ -375,8 +375,7 @@ index_sort(PkgNodePtr top) } } - /* Now sub-sort everything n levels down */ - + /* Now sub-sort everything n levels down */ for (p = top->kids; p; p = p->next) { if (p->kids) index_sort(p); @@ -407,24 +406,22 @@ index_search(PkgNodePtr top, char *str, PkgNodePtr *tp) PkgNodePtr p, sp; for (p = top->kids; p && p->name; p = p->next) { - /* Subtract out the All category from searches */ - if (!strcmp(p->name, "All")) - continue; - - /* If tp == NULL, we're looking for an exact package match */ - if (!tp && !strcmp(p->name, str)) - return p; - - /* If tp, we're looking for both a package and a pointer to the place it's in */ - if (tp && !strncmp(p->name, str, strlen(str))) { - *tp = top; - return p; + if (p->type == PACKAGE) { + /* If tp == NULL, we're looking for an exact package match */ + if (!tp && !strcmp(p->name, str)) + return p; + + /* If tp, we're looking for both a package and a pointer to the place it's in */ + if (tp && !strncmp(p->name, str, strlen(str))) { + *tp = top; + return p; + } } - - /* The usual recursion-out-of-laziness ploy */ - if (p->kids) + else if (p->kids) { + /* The usual recursion-out-of-laziness ploy */ if ((sp = index_search(p, str, tp)) != NULL) return sp; + } } if (p && !p->name) p = NULL; @@ -621,19 +618,7 @@ recycle: } int -index_extract(Device *dev, PkgNodePtr top, PkgNodePtr plist) -{ - PkgNodePtr tmp; - int status = DITEM_SUCCESS; - - for (tmp = plist->kids; tmp && tmp->name; tmp = tmp->next) - if (DITEM_STATUS(index_extract_one(dev, top, tmp, FALSE)) != DITEM_SUCCESS) - status = DITEM_FAILURE; - return status | DITEM_RESTORE; -} - -int -index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended) +index_extract(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended) { int status = DITEM_SUCCESS; PkgNodePtr tmp2; @@ -648,7 +633,7 @@ index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended) if ((cp2 = index(cp, ' ')) != NULL) *cp2 = '\0'; if ((tmp2 = index_search(top, cp, NULL)) != NULL) { - status = index_extract_one(dev, top, tmp2, TRUE); + status = index_extract(dev, top, tmp2, TRUE); if (DITEM_STATUS(status) != DITEM_SUCCESS) { if (variable_get(VAR_NO_CONFIRM)) msgNotify("Loading of dependant package %s failed", cp); diff --git a/release/sysinstall/menus.c b/release/sysinstall/menus.c index 8b04dfa..25d679a 100644 --- a/release/sysinstall/menus.c +++ b/release/sysinstall/menus.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: menus.c,v 1.202 1999/05/12 22:06:00 jkh Exp $ + * $Id: menus.c,v 1.203 1999/05/14 07:15:05 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -1191,7 +1191,7 @@ DMenu MenuConfigure = { NULL, optionsEditor }, { "X XFree86", "Configure XFree86 Server", NULL, configXSetup }, - { "X Desktop", "Configure XFree86 Desktop", + { "D Desktop", "Configure XFree86 Desktop", NULL, configXDesktop }, { "H HTML Docs", "Go to the HTML documentation menu (post-install)", NULL, docBrowser }, diff --git a/release/sysinstall/package.c b/release/sysinstall/package.c index e66db28..3f73433 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.73 1999/05/14 14:29:50 jkh Exp $ + * $Id: package.c,v 1.74 1999/05/14 14:57:59 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -41,7 +41,7 @@ #include <sys/mount.h> #include <sys/stat.h> -static Boolean sigpipe_caught = FALSE; +static Boolean sigpipe_caught; static void catch_pipe(int sig) @@ -60,13 +60,18 @@ package_add(char *name) if (!mediaVerify()) return DITEM_FAILURE; + + if (!mediaDevice->init(mediaDevice)) + return DITEM_FAILURE; + i = index_initialize("packages/INDEX"); if (DITEM_STATUS(i) != DITEM_SUCCESS) return i; - tmp3 = !strpbrk(name, "-_") ? &tmp2 : NULL; + + tmp3 = strpbrk(name, "-_") ? NULL : &tmp2; tmp = index_search(&Top, name, tmp3); if (tmp) - return index_extract_one(mediaDevice, &Top, tmp, FALSE); + return index_extract(mediaDevice, &Top, tmp, FALSE); else { msgConfirm("Sorry, package %s was not found in the INDEX.", name); return DITEM_FAILURE | DITEM_RESTORE; @@ -152,7 +157,9 @@ package_extract(Device *dev, char *name, Boolean depended) int i = 0, tot, pfd[2]; pid_t pid; + sigpipe_caught = FALSE; signal(SIGPIPE, catch_pipe); + msgNotify("Adding %s%s\nfrom %s", path, depended ? " (as a dependency)" : "", dev->name); pipe(pfd); pid = fork(); @@ -165,8 +172,6 @@ package_extract(Device *dev, char *name, Boolean depended) i = execl("/usr/sbin/pkg_add", "/usr/sbin/pkg_add", "-v", "-", 0); else i = execl("/usr/sbin/pkg_add", "/usr/sbin/pkg_add", "-", 0); - if (isDebug()) - msgDebug("pkg_add returns %d status\n", i); } else { char buf[BUFSIZ]; @@ -227,7 +232,6 @@ package_extract(Device *dev, char *name, Boolean depended) sleep(1); restorescr(w); - sigpipe_caught = FALSE; } } else { @@ -240,5 +244,6 @@ package_extract(Device *dev, char *name, Boolean depended) "No package add will be done.", name); ret = DITEM_FAILURE | DITEM_RESTORE; } + signal(SIGPIPE, SIG_IGN); return ret; } diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h index 685eaa0..9c35d41 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.163 1999/05/07 11:02:58 jkh Exp $ + * $Id: sysinstall.h,v 1.164 1999/05/12 09:02:37 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -528,8 +528,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 top, PkgNodePtr plist); -int index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended); +int index_extract(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended); int index_initialize(char *path); PkgNodePtr index_search(PkgNodePtr top, char *str, PkgNodePtr *tp); |