1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-09 09:40:42 +00:00

Style changes. Clear the screen before a lot of error dialogs so that they

don't bogusly restore the screen to the message that was the cause of the
abort.  That resulted in lots of weird flickering dialog boxes that appeared
to be displayed out of sequence.
This commit is contained in:
Jordan K. Hubbard 1995-10-22 17:18:36 +00:00
parent f668386c04
commit b462d27c89
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=11672
10 changed files with 168 additions and 65 deletions

View File

@ -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.2 1995/10/20 14:24:41 jkh Exp $
* $Id: doc.c,v 1.3 1995/10/22 01:32:42 jkh Exp $
*
* Jordan Hubbard
*
@ -29,6 +29,7 @@ docBrowser(char *junk)
/* Make sure we were started at a reasonable time */
if (!strcmp(variable_get(SYSTEM_STATE), "init")) {
dialog_clear();
msgConfirm("Sorry, it's not possible to invoke the browser until the system\n"
"is installed completely enough to support a copy of %s.", browser);
return RET_FAIL;
@ -38,7 +39,8 @@ docBrowser(char *junk)
return RET_FAIL;
/* First, make sure we have whatever browser we've chosen is here */
if (package_extract(mediaDevice, browser) != RET_SUCCESS) {
if (package_add(browser) != RET_SUCCESS) {
dialog_clear();
msgConfirm("Unable to install the %s HTML browser package. You may\n"
"wish to verify that your media is configured correctly and\n"
"try again.", browser);
@ -67,6 +69,7 @@ docShowDocument(char *str)
char *browser = variable_get(VAR_BROWSER_BINARY);
if (!file_executable(browser)) {
dialog_clear();
msgConfirm("Can't find the browser in %s! Please ensure that it's\n"
"properly set in the Options editor.", browser);
return RET_FAIL;

View File

@ -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.14 1995/10/21 14:06:44 jkh Exp $
* $Id: index.c,v 1.15 1995/10/22 01:32:44 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -456,6 +456,7 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
}
}
if (!n && plist) {
dialog_clear();
msgConfirm("The %s menu is empty.", top->name);
return RET_DONE;
}
@ -539,8 +540,9 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
pos = scroll = 0;
index_menu(menu, plist, &pos, &scroll);
}
else
else {
msgConfirm("Search string: %s yielded no hits.", cp);
}
}
}
else {
@ -557,13 +559,8 @@ index_extract(Device *dev, PkgNodePtr plist)
int status = RET_SUCCESS;
for (tmp = plist->kids; tmp; tmp = tmp->next) {
if (package_extract(dev, tmp->name) != RET_SUCCESS) {
if (variable_get(VAR_NO_CONFIRM))
msgNotify("Unable to locate package %s..", tmp->name);
else
msgConfirm("Unable to locate package %s..", tmp->name);
if (package_extract(dev, tmp->name) != RET_SUCCESS)
status = RET_FAIL;
}
}
return status;
}

View File

@ -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.3 1995/10/20 14:24:49 jkh Exp $
* $Id: installFinal.c,v 1.5 1995/10/20 21:57:14 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard & Coranth Gryphon. All rights reserved.
@ -56,6 +56,7 @@
int
installApache(void)
{
dialog_clear();
msgConfirm("UNDER CONSTRUCTION\n\n"
"This installation option is not yet implemented. It will\n"
"hopefully be in the final release.");
@ -114,6 +115,7 @@ installFinal(char *unused)
if (vsystem("adduser -uid %d -home %s -shell date -dotdir no -batch %s %s \"%s\" ",
FTP_UID, tbuf, FTP_NAME, FTP_GROUP, FTP_COMMENT)) {
dialog_clear();
msgConfirm("Unable to create FTP user! Anonymous FTP setup failed.");
i = RET_FAIL;
}
@ -124,6 +126,7 @@ installFinal(char *unused)
}
}
else {
dialog_clear();
msgConfirm("Invalid Directory. Anonymous FTP will not be set up.");
}
}
@ -204,10 +207,12 @@ installFinal(char *unused)
fprintf(fptr, "read only = yes\n\n");
}
else {
dialog_clear();
msgConfirm("Invalid Share Name.");
}
}
else {
dialog_clear();
msgConfirm("Directory does not exist.");
}
} /* end if (tptr) */
@ -218,6 +223,7 @@ installFinal(char *unused)
vsystem("mv -f /tmp/smb.conf %s", SMB_CONF);
}
else {
dialog_clear();
msgConfirm("Unable to open temporary smb.conf file.\nSamba must be configured by hand.");
}
}
@ -230,6 +236,7 @@ installFinal(char *unused)
/* If we're an NFS server, we need an exports file */
if (variable_get("nfs_server") && !file_readable("/etc/exports")) {
dialog_clear();
msgConfirm("You have chosen to be an NFS server but have not yet configured\n"
"the /etc/exports file. You must configure this information before\n"
"other hosts will be able to mount file systems from your machine.\n"

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: installPreconfig.c,v 1.6 1995/10/22 10:25:20 jkh Exp $
* $Id: installPreconfig.c,v 1.8 1995/10/22 12:04:07 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -173,8 +173,10 @@ installPreconfig(char *str)
Attribs *cattr = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS);
int i, j;
if (attr_parse(cattr, fd) == RET_FAIL)
if (attr_parse(cattr, fd) == RET_FAIL) {
dialog_clear();
msgConfirm("Cannot parse configuration file %s! Please verify your media.", cfg_file);
}
else {
i = RET_SUCCESS;
for (j = 0; cattr[j].name[0]; j++) {
@ -190,11 +192,15 @@ installPreconfig(char *str)
else
variable_set2(cattr[j].name, cattr[j].value);
}
if (i == RET_SUCCESS)
if (i == RET_SUCCESS) {
dialog_clear();
msgConfirm("Configuration file %s loaded successfully!\n"
"Some parameters may now have new default values.", buf);
else if (i == RET_FAIL)
}
else if (i == RET_FAIL) {
dialog_clear();
msgConfirm("Configuration file %s loaded with some errors.\n", buf);
}
}
close(fd);
safe_free(cattr);

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: installUpgrade.c,v 1.2 1995/10/19 18:37:46 jkh Exp $
* $Id: installUpgrade.c,v 1.5 1995/10/20 14:24:52 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -63,6 +63,7 @@ typedef struct _hitList {
static void
doByHand(HitList *h)
{
dialog_clear();
msgConfirm("/etc/%s is one of those files that this upgrade procedure just isn't\n"
"smart enough to deal with right now. You'll need to merge the old and\n"
"new versions by hand when the option to do so is later presented.", h->name);
@ -142,9 +143,11 @@ traverseHitlist(HitList *h)
{
while (h->name) {
if (!file_readable(h->name)) {
if (!h->optional)
if (!h->optional) {
dialog_clear();
msgConfirm("Unable to find an old /etc/%s file! That is decidedly non-standard and\n"
"your upgraded system may function a little strangely as a result.");
}
}
else {
if (h->action == JUST_COPY) {
@ -154,8 +157,10 @@ traverseHitlist(HitList *h)
/* Copy the old one into its place */
msgNotify("Resurrecting %s..", h->name);
/* Do this with tar so that symlinks and such are preserved */
if (vsystem("tar cf - %s | tar xpf - -C /etc", h->name))
if (vsystem("tar cf - %s | tar xpf - -C /etc", h->name)) {
dialog_clear();
msgConfirm("Unable to resurrect your old /etc/%s! Hmmmm.", h->name);
}
}
else /* call handler */
h->handler(h);
@ -173,12 +178,14 @@ installUpgrade(char *str)
pid_t child;
if (!RunningAsInit) {
dialog_clear();
msgConfirm("You can only perform this procedure when booted off the installation\n"
"floppy.");
return RET_FAIL;
}
if (!Dists) {
dialog_clear();
msgConfirm("You haven't specified any distributions yet. The upgrade procedure\n"
"will only upgrade those portions of the system for which a distribution\n"
"has been selected. In the next screen, we'll go to the Distributions\n"
@ -211,6 +218,7 @@ installUpgrade(char *str)
/* Note that we're now upgrading */
variable_set2(SYSTEM_STATE, "upgrade");
dialog_clear();
msgConfirm("OK. First, we're going to go to the disk label editor. In this editor\n"
"you will be expected to *Mount* any partitions you're interested in\n"
"upgrading. Don't set the Newfs flag to Y on anything in the label editor\n"
@ -221,6 +229,7 @@ installUpgrade(char *str)
"step.\n");
if (diskLabelEditor(NULL) == RET_FAIL) {
dialog_clear();
msgConfirm("The disk label editor failed to work properly! Upgrade operation\n"
"aborted.");
return RET_FAIL;
@ -229,6 +238,7 @@ installUpgrade(char *str)
/* Don't write out MBR info */
variable_set2(DISK_PARTITIONED, "written");
if (diskLabelCommit(NULL) == RET_FAIL) {
dialog_clear();
msgConfirm("Not all file systems were properly mounted. Upgrade operation\n"
"aborted.");
variable_unset(DISK_PARTITIONED);
@ -236,6 +246,7 @@ installUpgrade(char *str)
}
if (chroot("/mnt") == RET_FAIL) {
dialog_clear();
msgConfirm("Unable to chroot to /mnt - something is wrong with the\n"
"root partition or the way it's mounted if this doesn't work.");
variable_unset(DISK_PARTITIONED);
@ -269,10 +280,12 @@ installUpgrade(char *str)
msgNotify("Beginning extraction of distributions..");
if (distExtractAll(NULL) == RET_FAIL) {
if (extractingBin && (Dists & DIST_BIN)) {
dialog_clear();
msgConfirm("Hmmmm. We couldn't even extract the bin distribution. This upgrade\n"
"should be considered a failure and started from the beginning, sorry!\n");
return RET_FAIL;
}
dialog_clear();
msgConfirm("The extraction process seems to have had some problems, but we got most\n"
"of the essentials. We'll treat this as a warning since it may have been\n"
"only non-essential distributions which failed to load.");
@ -283,27 +296,33 @@ installUpgrade(char *str)
"/dev entries and such that a 2.1 system expects to see. I'll also perform a\n"
"few \"fixup\" operations to repair the effects of splatting a bin distribution\n"
"on top of an existing system..");
if (installFixup("upgrade") == RET_FAIL)
if (installFixup("upgrade") == RET_FAIL) {
dialog_clear();
msgConfirm("Hmmmmm. The fixups don't seem to have been very happy.\n"
"You may wish to examine the system a little more closely when\n"
"it comes time to merge your /etc customizations back.");
}
}
if (extractingBin)
configSysconfig();
if (installFinal("upgrade") == RET_FAIL)
if (installFinal("upgrade") == RET_FAIL) {
dialog_clear();
msgConfirm("Some of the final configuration stuff evidently failed, but\n"
"the first stage of the upgrade should otherwise be considered\n"
"a success!\n\n"
"Next comes stage 2, where we attempt to resurrect your /etc\n"
"directory!");
else
}
else {
dialog_clear();
msgConfirm("First stage of upgrade completed successfully!\n\n"
"Next comes stage 2, where we attempt to resurrect your /etc\n"
"directory!");
}
if (chdir(saved_etc)) {
dialog_clear();
msgConfirm("Unable to go to your saved /etc directory in %s?! Argh!\n"
"Something went seriously wrong! It's quite possible that\n"
"your former /etc is toast. I hope you didn't have any\n"
@ -314,6 +333,7 @@ installUpgrade(char *str)
/* Now try to resurrect the /etc files */
traverseHitlist(etc_files);
dialog_clear();
msgConfirm("OK! At this stage, we've resurrected all the /etc files we could\n"
"(and you may have been warned about some that you'll have to merge\n"
"yourself, by hand) and we're going to drop you into a shell to do\n"

View File

@ -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.9 1995/10/22 01:32:58 jkh Exp $
* $Id: package.c,v 1.11 1995/10/22 12:04:11 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -71,32 +71,36 @@ package_extract(Device *dev, char *name)
int i, fd, ret;
/* Check to make sure it's not already there */
if (!vsystem("pkg_info -e %s", name))
if (!vsystem("pkg_info -e %s", name)) {
msgDebug("package %s marked as already installed - return SUCCESS.\n");
return RET_SUCCESS;
}
if (!dev->init(dev)) {
msgConfirm("Unable to initialize media type for package add.");
dialog_clear();
msgConfirm("Unable to initialize media type for package extract.");
return RET_FAIL;
}
ret = RET_FAIL;
sprintf(path, "packages/All/%s%s", name, strstr(name, ".tgz") ? "" : ".tgz");
msgDebug("pkg_extract: Attempting to fetch %s\n", path);
msgNotify("pkg_extract: Attempting to fetch %s from %s", path, dev->name);
fd = dev->get(dev, path, TRUE);
if (fd >= 0) {
pid_t tpid;
msgNotify("Fetching %s from %s", path, dev->name);
pen[0] = '\0';
if ((where = make_playpen(pen, 0)) != NULL) {
if (isDebug())
msgDebug("Working in temporary directory %s, will return to %s\n", pen, where);
tpid = fork();
if (!tpid) {
dup2(fd, 0);
i = vsystem("tar %s-xzf -", !strcmp(variable_get(VAR_CPIO_VERBOSITY), "high") ? "-v " : "");
if (isDebug())
msgDebug("tar command returns %d status\n", i);
dup2(fd, 0); close(fd);
dup2(DebugFD, 1);
dup2(DebugFD, 2);
i = vsystem("tar %s-xpzf -", !strcmp(variable_get(VAR_CPIO_VERBOSITY), "high") ? "-v " : "");
if (i)
msgDebug("tar command returns %d status (errno: %d)\n", i, errno);
exit(i);
}
else {
@ -104,9 +108,11 @@ package_extract(Device *dev, char *name)
tpid = waitpid(tpid, &pstat, 0);
if (vsystem("(pwd; cat +CONTENTS) | pkg_add %s-S",
!strcmp(variable_get(VAR_CPIO_VERBOSITY), "high") ? "-v " : ""))
!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.", path);
}
else
ret = RET_SUCCESS;
close(fd);
@ -117,16 +123,28 @@ package_extract(Device *dev, char *name)
if (isDebug())
msgDebug("Nuked pen: %s\n", pen);
}
else
else {
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;
}
dev->close(dev, fd);
if (dev->type == DEVICE_TYPE_TAPE)
unlink(path);
}
else
else {
msgDebug("pkg_extract: get operation returned %d\n", fd);
if (variable_get(VAR_NO_CONFIRM))
msgNotify("Unable to fetch package %s from selected media.\n"
"No package add will be done.");
else {
dialog_clear();
msgConfirm("Unable to fetch package %s from selected media.\n"
"No package add will be done.");
}
}
return ret;
}
@ -158,6 +176,7 @@ find_play_pen(char *pen, size_t sz)
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"
@ -180,10 +199,12 @@ make_playpen(char *pen, size_t 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;
}
@ -193,6 +214,7 @@ make_playpen(char *pen, size_t sz)
}
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"
@ -200,10 +222,13 @@ make_playpen(char *pen, size_t sz)
return NULL;
}
if (!getcwd(Previous, FILENAME_MAX)) {
dialog_clear();
msgConfirm("getcwd");
return NULL;
}
if (chdir(pen) == RET_FAIL)
if (chdir(pen) == RET_FAIL) {
dialog_clear();
msgConfirm("Can't chdir to '%s'.", pen);
}
return Previous;
}

View File

@ -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.2 1995/10/20 14:24:41 jkh Exp $
* $Id: doc.c,v 1.3 1995/10/22 01:32:42 jkh Exp $
*
* Jordan Hubbard
*
@ -29,6 +29,7 @@ docBrowser(char *junk)
/* Make sure we were started at a reasonable time */
if (!strcmp(variable_get(SYSTEM_STATE), "init")) {
dialog_clear();
msgConfirm("Sorry, it's not possible to invoke the browser until the system\n"
"is installed completely enough to support a copy of %s.", browser);
return RET_FAIL;
@ -38,7 +39,8 @@ docBrowser(char *junk)
return RET_FAIL;
/* First, make sure we have whatever browser we've chosen is here */
if (package_extract(mediaDevice, browser) != RET_SUCCESS) {
if (package_add(browser) != RET_SUCCESS) {
dialog_clear();
msgConfirm("Unable to install the %s HTML browser package. You may\n"
"wish to verify that your media is configured correctly and\n"
"try again.", browser);
@ -67,6 +69,7 @@ docShowDocument(char *str)
char *browser = variable_get(VAR_BROWSER_BINARY);
if (!file_executable(browser)) {
dialog_clear();
msgConfirm("Can't find the browser in %s! Please ensure that it's\n"
"properly set in the Options editor.", browser);
return RET_FAIL;

View File

@ -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.14 1995/10/21 14:06:44 jkh Exp $
* $Id: index.c,v 1.15 1995/10/22 01:32:44 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -456,6 +456,7 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
}
}
if (!n && plist) {
dialog_clear();
msgConfirm("The %s menu is empty.", top->name);
return RET_DONE;
}
@ -539,8 +540,9 @@ index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll)
pos = scroll = 0;
index_menu(menu, plist, &pos, &scroll);
}
else
else {
msgConfirm("Search string: %s yielded no hits.", cp);
}
}
}
else {
@ -557,13 +559,8 @@ index_extract(Device *dev, PkgNodePtr plist)
int status = RET_SUCCESS;
for (tmp = plist->kids; tmp; tmp = tmp->next) {
if (package_extract(dev, tmp->name) != RET_SUCCESS) {
if (variable_get(VAR_NO_CONFIRM))
msgNotify("Unable to locate package %s..", tmp->name);
else
msgConfirm("Unable to locate package %s..", tmp->name);
if (package_extract(dev, tmp->name) != RET_SUCCESS)
status = RET_FAIL;
}
}
return status;
}

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: installUpgrade.c,v 1.2 1995/10/19 18:37:46 jkh Exp $
* $Id: installUpgrade.c,v 1.5 1995/10/20 14:24:52 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -63,6 +63,7 @@ typedef struct _hitList {
static void
doByHand(HitList *h)
{
dialog_clear();
msgConfirm("/etc/%s is one of those files that this upgrade procedure just isn't\n"
"smart enough to deal with right now. You'll need to merge the old and\n"
"new versions by hand when the option to do so is later presented.", h->name);
@ -142,9 +143,11 @@ traverseHitlist(HitList *h)
{
while (h->name) {
if (!file_readable(h->name)) {
if (!h->optional)
if (!h->optional) {
dialog_clear();
msgConfirm("Unable to find an old /etc/%s file! That is decidedly non-standard and\n"
"your upgraded system may function a little strangely as a result.");
}
}
else {
if (h->action == JUST_COPY) {
@ -154,8 +157,10 @@ traverseHitlist(HitList *h)
/* Copy the old one into its place */
msgNotify("Resurrecting %s..", h->name);
/* Do this with tar so that symlinks and such are preserved */
if (vsystem("tar cf - %s | tar xpf - -C /etc", h->name))
if (vsystem("tar cf - %s | tar xpf - -C /etc", h->name)) {
dialog_clear();
msgConfirm("Unable to resurrect your old /etc/%s! Hmmmm.", h->name);
}
}
else /* call handler */
h->handler(h);
@ -173,12 +178,14 @@ installUpgrade(char *str)
pid_t child;
if (!RunningAsInit) {
dialog_clear();
msgConfirm("You can only perform this procedure when booted off the installation\n"
"floppy.");
return RET_FAIL;
}
if (!Dists) {
dialog_clear();
msgConfirm("You haven't specified any distributions yet. The upgrade procedure\n"
"will only upgrade those portions of the system for which a distribution\n"
"has been selected. In the next screen, we'll go to the Distributions\n"
@ -211,6 +218,7 @@ installUpgrade(char *str)
/* Note that we're now upgrading */
variable_set2(SYSTEM_STATE, "upgrade");
dialog_clear();
msgConfirm("OK. First, we're going to go to the disk label editor. In this editor\n"
"you will be expected to *Mount* any partitions you're interested in\n"
"upgrading. Don't set the Newfs flag to Y on anything in the label editor\n"
@ -221,6 +229,7 @@ installUpgrade(char *str)
"step.\n");
if (diskLabelEditor(NULL) == RET_FAIL) {
dialog_clear();
msgConfirm("The disk label editor failed to work properly! Upgrade operation\n"
"aborted.");
return RET_FAIL;
@ -229,6 +238,7 @@ installUpgrade(char *str)
/* Don't write out MBR info */
variable_set2(DISK_PARTITIONED, "written");
if (diskLabelCommit(NULL) == RET_FAIL) {
dialog_clear();
msgConfirm("Not all file systems were properly mounted. Upgrade operation\n"
"aborted.");
variable_unset(DISK_PARTITIONED);
@ -236,6 +246,7 @@ installUpgrade(char *str)
}
if (chroot("/mnt") == RET_FAIL) {
dialog_clear();
msgConfirm("Unable to chroot to /mnt - something is wrong with the\n"
"root partition or the way it's mounted if this doesn't work.");
variable_unset(DISK_PARTITIONED);
@ -269,10 +280,12 @@ installUpgrade(char *str)
msgNotify("Beginning extraction of distributions..");
if (distExtractAll(NULL) == RET_FAIL) {
if (extractingBin && (Dists & DIST_BIN)) {
dialog_clear();
msgConfirm("Hmmmm. We couldn't even extract the bin distribution. This upgrade\n"
"should be considered a failure and started from the beginning, sorry!\n");
return RET_FAIL;
}
dialog_clear();
msgConfirm("The extraction process seems to have had some problems, but we got most\n"
"of the essentials. We'll treat this as a warning since it may have been\n"
"only non-essential distributions which failed to load.");
@ -283,27 +296,33 @@ installUpgrade(char *str)
"/dev entries and such that a 2.1 system expects to see. I'll also perform a\n"
"few \"fixup\" operations to repair the effects of splatting a bin distribution\n"
"on top of an existing system..");
if (installFixup("upgrade") == RET_FAIL)
if (installFixup("upgrade") == RET_FAIL) {
dialog_clear();
msgConfirm("Hmmmmm. The fixups don't seem to have been very happy.\n"
"You may wish to examine the system a little more closely when\n"
"it comes time to merge your /etc customizations back.");
}
}
if (extractingBin)
configSysconfig();
if (installFinal("upgrade") == RET_FAIL)
if (installFinal("upgrade") == RET_FAIL) {
dialog_clear();
msgConfirm("Some of the final configuration stuff evidently failed, but\n"
"the first stage of the upgrade should otherwise be considered\n"
"a success!\n\n"
"Next comes stage 2, where we attempt to resurrect your /etc\n"
"directory!");
else
}
else {
dialog_clear();
msgConfirm("First stage of upgrade completed successfully!\n\n"
"Next comes stage 2, where we attempt to resurrect your /etc\n"
"directory!");
}
if (chdir(saved_etc)) {
dialog_clear();
msgConfirm("Unable to go to your saved /etc directory in %s?! Argh!\n"
"Something went seriously wrong! It's quite possible that\n"
"your former /etc is toast. I hope you didn't have any\n"
@ -314,6 +333,7 @@ installUpgrade(char *str)
/* Now try to resurrect the /etc files */
traverseHitlist(etc_files);
dialog_clear();
msgConfirm("OK! At this stage, we've resurrected all the /etc files we could\n"
"(and you may have been warned about some that you'll have to merge\n"
"yourself, by hand) and we're going to drop you into a shell to do\n"

View File

@ -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.9 1995/10/22 01:32:58 jkh Exp $
* $Id: package.c,v 1.11 1995/10/22 12:04:11 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -71,32 +71,36 @@ package_extract(Device *dev, char *name)
int i, fd, ret;
/* Check to make sure it's not already there */
if (!vsystem("pkg_info -e %s", name))
if (!vsystem("pkg_info -e %s", name)) {
msgDebug("package %s marked as already installed - return SUCCESS.\n");
return RET_SUCCESS;
}
if (!dev->init(dev)) {
msgConfirm("Unable to initialize media type for package add.");
dialog_clear();
msgConfirm("Unable to initialize media type for package extract.");
return RET_FAIL;
}
ret = RET_FAIL;
sprintf(path, "packages/All/%s%s", name, strstr(name, ".tgz") ? "" : ".tgz");
msgDebug("pkg_extract: Attempting to fetch %s\n", path);
msgNotify("pkg_extract: Attempting to fetch %s from %s", path, dev->name);
fd = dev->get(dev, path, TRUE);
if (fd >= 0) {
pid_t tpid;
msgNotify("Fetching %s from %s", path, dev->name);
pen[0] = '\0';
if ((where = make_playpen(pen, 0)) != NULL) {
if (isDebug())
msgDebug("Working in temporary directory %s, will return to %s\n", pen, where);
tpid = fork();
if (!tpid) {
dup2(fd, 0);
i = vsystem("tar %s-xzf -", !strcmp(variable_get(VAR_CPIO_VERBOSITY), "high") ? "-v " : "");
if (isDebug())
msgDebug("tar command returns %d status\n", i);
dup2(fd, 0); close(fd);
dup2(DebugFD, 1);
dup2(DebugFD, 2);
i = vsystem("tar %s-xpzf -", !strcmp(variable_get(VAR_CPIO_VERBOSITY), "high") ? "-v " : "");
if (i)
msgDebug("tar command returns %d status (errno: %d)\n", i, errno);
exit(i);
}
else {
@ -104,9 +108,11 @@ package_extract(Device *dev, char *name)
tpid = waitpid(tpid, &pstat, 0);
if (vsystem("(pwd; cat +CONTENTS) | pkg_add %s-S",
!strcmp(variable_get(VAR_CPIO_VERBOSITY), "high") ? "-v " : ""))
!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.", path);
}
else
ret = RET_SUCCESS;
close(fd);
@ -117,16 +123,28 @@ package_extract(Device *dev, char *name)
if (isDebug())
msgDebug("Nuked pen: %s\n", pen);
}
else
else {
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;
}
dev->close(dev, fd);
if (dev->type == DEVICE_TYPE_TAPE)
unlink(path);
}
else
else {
msgDebug("pkg_extract: get operation returned %d\n", fd);
if (variable_get(VAR_NO_CONFIRM))
msgNotify("Unable to fetch package %s from selected media.\n"
"No package add will be done.");
else {
dialog_clear();
msgConfirm("Unable to fetch package %s from selected media.\n"
"No package add will be done.");
}
}
return ret;
}
@ -158,6 +176,7 @@ find_play_pen(char *pen, size_t sz)
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"
@ -180,10 +199,12 @@ make_playpen(char *pen, size_t 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;
}
@ -193,6 +214,7 @@ make_playpen(char *pen, size_t sz)
}
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"
@ -200,10 +222,13 @@ make_playpen(char *pen, size_t sz)
return NULL;
}
if (!getcwd(Previous, FILENAME_MAX)) {
dialog_clear();
msgConfirm("getcwd");
return NULL;
}
if (chdir(pen) == RET_FAIL)
if (chdir(pen) == RET_FAIL) {
dialog_clear();
msgConfirm("Can't chdir to '%s'.", pen);
}
return Previous;
}