mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-23 18:14:56 +01:00
Some general fixes for the package menu (still need to fix the "more than 10
items checked bug though). Now allow user to specify a PKG_TMPDIR. If not selected, we try to make one.
This commit is contained in:
parent
42e9339d38
commit
593ecf888e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=12129
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: doc.c,v 1.8 1995/10/27 03:59:31 jkh Exp $
|
||||
* $Id: doc.c,v 1.9 1995/11/04 08:47:22 jkh Exp $
|
||||
*
|
||||
* Jordan Hubbard
|
||||
*
|
||||
@ -23,7 +23,7 @@ docBrowser(char *junk)
|
||||
{
|
||||
char *browser = variable_get(VAR_BROWSER_PACKAGE);
|
||||
|
||||
if (!strstr(variable_get(SYSTEM_STATE), "install")) {
|
||||
if (RunningAsInit && !strstr(variable_get(SYSTEM_STATE), "install")) {
|
||||
msgConfirm("This option may only be used after the system is installed, sorry!");
|
||||
return RET_FAIL;
|
||||
}
|
||||
|
@ -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.15 1995/10/22 01:32:44 jkh Exp $
|
||||
* $Id: index.c,v 1.17 1995/10/22 17:39:10 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -270,11 +270,13 @@ index_init(PkgNodePtr top, PkgNodePtr plist)
|
||||
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
|
||||
@ -439,7 +441,6 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
|
||||
char result[127];
|
||||
Boolean hasPackages;
|
||||
|
||||
curr = max = 0;
|
||||
hasPackages = FALSE;
|
||||
nitems = NULL;
|
||||
|
||||
@ -464,6 +465,7 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
|
||||
dialog_clear();
|
||||
while (1) {
|
||||
n = 0;
|
||||
curr = max = 0;
|
||||
kp = top->kids;
|
||||
if (!hasPackages && kp && kp->name && plist) {
|
||||
nitems = item_add_pair(nitems, "UP", "<RETURN TO PREVIOUS MENU>", &curr, &max);
|
||||
@ -491,18 +493,17 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
|
||||
else /* It's a categories menu */
|
||||
rval = dialog_menu(top->name, top->desc, -1, -1, n > MAX_MENU ? MAX_MENU : n, n,
|
||||
(unsigned char **)nitems, result, pos, scroll);
|
||||
items_free(nitems, &curr, &max);
|
||||
if (!rval && plist && strcmp(result, "UP")) {
|
||||
for (kp = top->kids; kp; kp = kp->next) {
|
||||
if (kp->type == PACKAGE) {
|
||||
sp = index_search(plist, kp->name, NULL);
|
||||
if (is_selected_in(kp->name, result)) {
|
||||
if (!sp) {
|
||||
PkgNodePtr n = (PkgNodePtr)safe_malloc(sizeof(PkgNode));
|
||||
PkgNodePtr np = (PkgNodePtr)safe_malloc(sizeof(PkgNode));
|
||||
|
||||
*n = *kp;
|
||||
n->next = plist->kids;
|
||||
plist->kids = n;
|
||||
*np = *kp;
|
||||
np->next = plist->kids;
|
||||
plist->kids = np;
|
||||
standout();
|
||||
mvprintw(23, 0, "Selected packages were added to selection list\n", kp->name);
|
||||
standend();
|
||||
@ -547,6 +548,7 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
|
||||
}
|
||||
else {
|
||||
dialog_clear();
|
||||
items_free(nitems, &curr, &max);
|
||||
return rval ? RET_FAIL : RET_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -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.25 1995/10/26 08:56:06 jkh Exp $
|
||||
* $Id: options.c,v 1.26 1995/11/03 12:02:44 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -52,7 +52,7 @@ varCheck(Option opt)
|
||||
if (opt.aux)
|
||||
cp = variable_get((char *)opt.aux);
|
||||
if (!cp)
|
||||
return "NO";
|
||||
return "<not set>";
|
||||
return cp;
|
||||
}
|
||||
|
||||
@ -105,6 +105,7 @@ mediaCheck(Option opt)
|
||||
#define BPKG_PROMPT "Please specify the name of the HTML browser package:"
|
||||
#define BBIN_PROMPT "Please specify a full pathname to the HTML browser binary:"
|
||||
#define RETRY_PROMPT "Please specify the number of times to retry an FTP request:"
|
||||
#define PKG_PROMPT "Please specify a temporary directory with lots of free space:"
|
||||
|
||||
static Option Options[] = {
|
||||
{ "NFS Secure", "NFS server talks only on a secure port",
|
||||
@ -133,6 +134,8 @@ static Option Options[] = {
|
||||
OPT_IS_VAR, BBIN_PROMPT, VAR_BROWSER_BINARY, varCheck },
|
||||
{ "Media Type", "The current installation media type.",
|
||||
OPT_IS_FUNC, mediaGetType, VAR_MEDIA_TYPE, mediaCheck },
|
||||
{ "Package Temp", "The directory where package temporary files should go",
|
||||
OPT_IS_VAR, PKG_PROMPT, "PKG_TMPDIR", varCheck },
|
||||
{ "Use Defaults", "Reset all values to startup defaults",
|
||||
OPT_IS_FUNC, installVarDefaults, 0, resetLogo },
|
||||
{ NULL },
|
||||
|
@ -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.21 1995/10/27 02:12:58 jkh Exp $
|
||||
* $Id: package.c,v 1.22 1995/10/27 03:07:14 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -83,6 +83,12 @@ package_extract(Device *dev, char *name)
|
||||
}
|
||||
|
||||
ret = RET_FAIL;
|
||||
/* Make a couple of paranoid locations for temp files to live if user specified none */
|
||||
if (!variable_get("PKG_TMPDIR")) {
|
||||
Mkdir("/usr/tmp", NULL);
|
||||
Mkdir("/var/tmp", NULL);
|
||||
}
|
||||
|
||||
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);
|
||||
@ -94,8 +100,11 @@ package_extract(Device *dev, char *name)
|
||||
if (vsystem("(pwd; cat +CONTENTS) | pkg_add %s-S",
|
||||
!strcmp(variable_get(VAR_CPIO_VERBOSITY), "high") ? "-v " : "")) {
|
||||
dialog_clear();
|
||||
msgConfirm("An error occurred while trying to pkg_add %s.\n"
|
||||
"Please check debugging screen for possible further details.", name);
|
||||
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);
|
||||
@ -104,18 +113,24 @@ package_extract(Device *dev, char *name)
|
||||
}
|
||||
else {
|
||||
dialog_clear();
|
||||
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.\n"
|
||||
"You may wish to look into this and try again.", name);
|
||||
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.\n"
|
||||
"You may wish to look into this and try again.", name);
|
||||
else
|
||||
msgNotify("The package specified (%s) has no CONTENTS file. Skipping.", name);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ret = RET_FAIL;
|
||||
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);
|
||||
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);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: doc.c,v 1.8 1995/10/27 03:59:31 jkh Exp $
|
||||
* $Id: doc.c,v 1.9 1995/11/04 08:47:22 jkh Exp $
|
||||
*
|
||||
* Jordan Hubbard
|
||||
*
|
||||
@ -23,7 +23,7 @@ docBrowser(char *junk)
|
||||
{
|
||||
char *browser = variable_get(VAR_BROWSER_PACKAGE);
|
||||
|
||||
if (!strstr(variable_get(SYSTEM_STATE), "install")) {
|
||||
if (RunningAsInit && !strstr(variable_get(SYSTEM_STATE), "install")) {
|
||||
msgConfirm("This option may only be used after the system is installed, sorry!");
|
||||
return RET_FAIL;
|
||||
}
|
||||
|
@ -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.15 1995/10/22 01:32:44 jkh Exp $
|
||||
* $Id: index.c,v 1.17 1995/10/22 17:39:10 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -270,11 +270,13 @@ index_init(PkgNodePtr top, PkgNodePtr plist)
|
||||
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
|
||||
@ -439,7 +441,6 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
|
||||
char result[127];
|
||||
Boolean hasPackages;
|
||||
|
||||
curr = max = 0;
|
||||
hasPackages = FALSE;
|
||||
nitems = NULL;
|
||||
|
||||
@ -464,6 +465,7 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
|
||||
dialog_clear();
|
||||
while (1) {
|
||||
n = 0;
|
||||
curr = max = 0;
|
||||
kp = top->kids;
|
||||
if (!hasPackages && kp && kp->name && plist) {
|
||||
nitems = item_add_pair(nitems, "UP", "<RETURN TO PREVIOUS MENU>", &curr, &max);
|
||||
@ -491,18 +493,17 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
|
||||
else /* It's a categories menu */
|
||||
rval = dialog_menu(top->name, top->desc, -1, -1, n > MAX_MENU ? MAX_MENU : n, n,
|
||||
(unsigned char **)nitems, result, pos, scroll);
|
||||
items_free(nitems, &curr, &max);
|
||||
if (!rval && plist && strcmp(result, "UP")) {
|
||||
for (kp = top->kids; kp; kp = kp->next) {
|
||||
if (kp->type == PACKAGE) {
|
||||
sp = index_search(plist, kp->name, NULL);
|
||||
if (is_selected_in(kp->name, result)) {
|
||||
if (!sp) {
|
||||
PkgNodePtr n = (PkgNodePtr)safe_malloc(sizeof(PkgNode));
|
||||
PkgNodePtr np = (PkgNodePtr)safe_malloc(sizeof(PkgNode));
|
||||
|
||||
*n = *kp;
|
||||
n->next = plist->kids;
|
||||
plist->kids = n;
|
||||
*np = *kp;
|
||||
np->next = plist->kids;
|
||||
plist->kids = np;
|
||||
standout();
|
||||
mvprintw(23, 0, "Selected packages were added to selection list\n", kp->name);
|
||||
standend();
|
||||
@ -547,6 +548,7 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
|
||||
}
|
||||
else {
|
||||
dialog_clear();
|
||||
items_free(nitems, &curr, &max);
|
||||
return rval ? RET_FAIL : RET_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -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.25 1995/10/26 08:56:06 jkh Exp $
|
||||
* $Id: options.c,v 1.26 1995/11/03 12:02:44 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -52,7 +52,7 @@ varCheck(Option opt)
|
||||
if (opt.aux)
|
||||
cp = variable_get((char *)opt.aux);
|
||||
if (!cp)
|
||||
return "NO";
|
||||
return "<not set>";
|
||||
return cp;
|
||||
}
|
||||
|
||||
@ -105,6 +105,7 @@ mediaCheck(Option opt)
|
||||
#define BPKG_PROMPT "Please specify the name of the HTML browser package:"
|
||||
#define BBIN_PROMPT "Please specify a full pathname to the HTML browser binary:"
|
||||
#define RETRY_PROMPT "Please specify the number of times to retry an FTP request:"
|
||||
#define PKG_PROMPT "Please specify a temporary directory with lots of free space:"
|
||||
|
||||
static Option Options[] = {
|
||||
{ "NFS Secure", "NFS server talks only on a secure port",
|
||||
@ -133,6 +134,8 @@ static Option Options[] = {
|
||||
OPT_IS_VAR, BBIN_PROMPT, VAR_BROWSER_BINARY, varCheck },
|
||||
{ "Media Type", "The current installation media type.",
|
||||
OPT_IS_FUNC, mediaGetType, VAR_MEDIA_TYPE, mediaCheck },
|
||||
{ "Package Temp", "The directory where package temporary files should go",
|
||||
OPT_IS_VAR, PKG_PROMPT, "PKG_TMPDIR", varCheck },
|
||||
{ "Use Defaults", "Reset all values to startup defaults",
|
||||
OPT_IS_FUNC, installVarDefaults, 0, resetLogo },
|
||||
{ NULL },
|
||||
|
@ -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.21 1995/10/27 02:12:58 jkh Exp $
|
||||
* $Id: package.c,v 1.22 1995/10/27 03:07:14 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -83,6 +83,12 @@ package_extract(Device *dev, char *name)
|
||||
}
|
||||
|
||||
ret = RET_FAIL;
|
||||
/* Make a couple of paranoid locations for temp files to live if user specified none */
|
||||
if (!variable_get("PKG_TMPDIR")) {
|
||||
Mkdir("/usr/tmp", NULL);
|
||||
Mkdir("/var/tmp", NULL);
|
||||
}
|
||||
|
||||
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);
|
||||
@ -94,8 +100,11 @@ package_extract(Device *dev, char *name)
|
||||
if (vsystem("(pwd; cat +CONTENTS) | pkg_add %s-S",
|
||||
!strcmp(variable_get(VAR_CPIO_VERBOSITY), "high") ? "-v " : "")) {
|
||||
dialog_clear();
|
||||
msgConfirm("An error occurred while trying to pkg_add %s.\n"
|
||||
"Please check debugging screen for possible further details.", name);
|
||||
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);
|
||||
@ -104,18 +113,24 @@ package_extract(Device *dev, char *name)
|
||||
}
|
||||
else {
|
||||
dialog_clear();
|
||||
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.\n"
|
||||
"You may wish to look into this and try again.", name);
|
||||
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.\n"
|
||||
"You may wish to look into this and try again.", name);
|
||||
else
|
||||
msgNotify("The package specified (%s) has no CONTENTS file. Skipping.", name);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ret = RET_FAIL;
|
||||
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);
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user