Make upgrades actually work (thanks, Julian).

Many other bug fixes.
This commit is contained in:
Jordan K. Hubbard 1995-10-24 02:18:23 +00:00
parent c0fe8534e7
commit 6094230b54
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=11752
5 changed files with 107 additions and 103 deletions

View file

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next * This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite. * generation being essentially a complete rewrite.
* *
* $Id: installPreconfig.c,v 1.12 1995/10/22 21:38:12 jkh Exp $ * $Id: installPreconfig.c,v 1.13 1995/10/23 13:19:43 jkh Exp $
* *
* Copyright (c) 1995 * Copyright (c) 1995
* Jordan Hubbard. All rights reserved. * Jordan Hubbard. All rights reserved.
@ -168,7 +168,7 @@ installPreconfig(char *str)
dialog_clear(); dialog_clear();
if (msgYesNo("Unable to find the configuration file: %s\n" if (msgYesNo("Unable to find the configuration file: %s\n"
"Do you want to try again?", buf)) { "Do you want to try again?", buf)) {
unmount("/mnt2", 0); unmount("/mnt2", MNT_FORCE);
break; break;
} }
else else
@ -204,7 +204,7 @@ installPreconfig(char *str)
} }
else if (i == RET_FAIL) { else if (i == RET_FAIL) {
dialog_clear(); dialog_clear();
msgConfirm("Configuration file %s loaded with some errors.\n", buf); msgConfirm("Configuration file %s loaded with some errors.", buf);
} }
} }
close(fd); close(fd);

View file

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next * This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite. * generation being essentially a complete rewrite.
* *
* $Id: installUpgrade.c,v 1.7 1995/10/22 17:39:16 jkh Exp $ * $Id: installUpgrade.c,v 1.8 1995/10/23 13:19:45 jkh Exp $
* *
* Copyright (c) 1995 * Copyright (c) 1995
* Jordan Hubbard. All rights reserved. * Jordan Hubbard. All rights reserved.
@ -174,8 +174,7 @@ installUpgrade(char *str)
{ {
char *saved_etc = NULL; char *saved_etc = NULL;
Boolean extractingBin = TRUE; Boolean extractingBin = TRUE;
int waitstatus; struct termios foo;
pid_t child;
if (!RunningAsInit) { if (!RunningAsInit) {
dialog_clear(); dialog_clear();
@ -184,13 +183,19 @@ installUpgrade(char *str)
return RET_FAIL; return RET_FAIL;
} }
systemDisplayHelp("upgrade");
if (msgYesNo("Given all that scary stuff you just read, are you sure you want to\n"
"risk it all and proceed with this upgrade?"))
return RET_FAIL;
if (!Dists) { if (!Dists) {
dialog_clear(); dialog_clear();
msgConfirm("You haven't specified any distributions yet. The upgrade procedure\n" msgConfirm("You haven't specified any distributions yet. The upgrade procedure will\n"
"will only upgrade those portions of the system for which a distribution\n" "only upgrade those portions of the system for which a distribution has\n"
"has been selected. In the next screen, we'll go to the Distributions\n" "been selected. In the next screen, we'll go to the Distributions menu\n"
"menu to select those portions of 2.1 you wish to install on top of your\n" "to select those portions of 2.1 you wish to install on top of your 2.0.5\n"
"2.0.5 system."); "system.");
if (!dmenuOpenSimple(&MenuDistributions)) if (!dmenuOpenSimple(&MenuDistributions))
return RET_FAIL; return RET_FAIL;
} }
@ -210,11 +215,12 @@ installUpgrade(char *str)
if (!(Dists & DIST_BIN)) if (!(Dists & DIST_BIN))
extractingBin = FALSE; extractingBin = FALSE;
systemDisplayHelp("upgrade"); if (!mediaDevice) {
dialog_clear();
if (msgYesNo("Given all that scary stuff you just read, are you sure you want to\n" msgConfirm("Now you must specify an installation medium for the upgrade.");
"risk it all and proceed with this upgrade?")) if (!dmenuOpenSimple(&MenuMedia) || !mediaDevice)
return RET_FAIL; return RET_FAIL;
}
/* Note that we're now upgrading */ /* Note that we're now upgrading */
variable_set2(SYSTEM_STATE, "upgrade"); variable_set2(SYSTEM_STATE, "upgrade");
@ -227,7 +233,7 @@ installUpgrade(char *str)
"instance, you'll be using the label editor as little more than a fancy\n" "instance, you'll be using the label editor as little more than a fancy\n"
"screen-oriented filesystem mounting utility, so think of it that way.\n\n" "screen-oriented filesystem mounting utility, so think of it that way.\n\n"
"Once you're done in the label editor, press Q to return here for the next\n" "Once you're done in the label editor, press Q to return here for the next\n"
"step.\n"); "step.");
if (diskLabelEditor(NULL) == RET_FAIL) { if (diskLabelEditor(NULL) == RET_FAIL) {
dialog_clear(); dialog_clear();
@ -238,7 +244,7 @@ installUpgrade(char *str)
/* Don't write out MBR info */ /* Don't write out MBR info */
variable_set2(DISK_PARTITIONED, "written"); variable_set2(DISK_PARTITIONED, "written");
if (diskLabelCommit(NULL) == RET_FAIL) { if (diskLabelCommit("upgrade") == RET_FAIL) {
dialog_clear(); dialog_clear();
msgConfirm("Not all file systems were properly mounted. Upgrade operation\n" msgConfirm("Not all file systems were properly mounted. Upgrade operation\n"
"aborted."); "aborted.");
@ -273,21 +279,26 @@ installUpgrade(char *str)
} }
if (file_readable("/kernel")) { if (file_readable("/kernel")) {
msgNotify("Moving old kernel to /kernel.205"); msgNotify("Moving old kernel to /kernel.205");
if (system("chflags noschg /mnt/kernel && mv /mnt/kernel /mnt/kernel.205")) { if (system("chflags noschg /kernel && mv /kernel /kernel.205")) {
dialog_clear(); dialog_clear();
if (!msgYesNo("Hmmm! I couldn't move the old kernel over! Do you want to\n" if (!msgYesNo("Hmmm! I couldn't move the old kernel over! Do you want to\n"
"treat this as a big problem and abort the upgrade?")) "treat this as a big problem and abort the upgrade? Due to the\n"
return RET_FAIL; "way that this upgrade process works, you will have to reboot\n"
"and start over from the beginning. Select Yes to reboot now")) {
reboot(0);
}
} }
} }
} }
msgNotify("Beginning extraction of distributions.."); msgNotify("Beginning extraction of distributions..");
if (distExtractAll(NULL) == RET_FAIL) { if (distExtractAll("upgrade") == RET_FAIL) {
if (extractingBin && (Dists & DIST_BIN)) { if (extractingBin && (Dists & DIST_BIN)) {
dialog_clear(); dialog_clear();
msgConfirm("Hmmmm. We couldn't even extract the bin distribution. This upgrade\n" 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"); "should be considered a failure and started from the beginning, sorry!\n"
return RET_FAIL; "The system will reboot now.");
reboot(0);
} }
dialog_clear(); dialog_clear();
msgConfirm("The extraction process seems to have had some problems, but we got most\n" msgConfirm("The extraction process seems to have had some problems, but we got most\n"
@ -331,18 +342,18 @@ installUpgrade(char *str)
"Something went seriously wrong! It's quite possible that\n" "Something went seriously wrong! It's quite possible that\n"
"your former /etc is toast. I hope you didn't have any\n" "your former /etc is toast. I hope you didn't have any\n"
"important customizations you wanted to keep in there.. :(\n"); "important customizations you wanted to keep in there.. :(\n");
return RET_FAIL;
} }
else {
/* Now try to resurrect the /etc files */ /* Now try to resurrect the /etc files */
traverseHitlist(etc_files); traverseHitlist(etc_files);
}
dialog_clear(); dialog_clear();
msgConfirm("OK! At this stage, we've resurrected all the /etc files we could\n" 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" "(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" "yourself by hand) and we're going to drop you into a shell to do\n"
"the rest yourself (sorry about this!). Once the system looks good\n" "the rest yourself (sorry about this!). Once the system looks good\n"
"to you, exit the shell and reboot the system."); "to you, exit the shell to reboot the system.");
chdir("/"); chdir("/");
dialog_clear(); dialog_clear();
@ -350,27 +361,19 @@ installUpgrade(char *str)
end_dialog(); end_dialog();
DialogActive = FALSE; DialogActive = FALSE;
if (!(child = fork())) { signal(SIGTTOU, SIG_IGN);
struct termios foo; if (tcgetattr(0, &foo) != -1) {
foo.c_cc[VERASE] = '\010';
signal(SIGTTOU, SIG_IGN); if (tcsetattr(0, TCSANOW, &foo) == -1)
if (tcgetattr(0, &foo) != -1) { msgDebug("Unable to set the erase character.\n");
foo.c_cc[VERASE] = '\010';
if (tcsetattr(0, TCSANOW, &foo) == -1)
msgDebug("Unable to set the erase character.\n");
}
else
msgDebug("Unable to get the terminal attributes!\n");
printf("Well, good luck! When you're done, type exit to return.\n");
execlp("sh", "-sh", 0);
msgDebug("Was unable to execute sh for post-upgrade shell!\n");
exit(1);
} }
else else
(void)waitpid(child, &waitstatus, 0); msgDebug("Unable to get the terminal attributes!\n");
DialogActive = TRUE; printf("Well, good luck! When you're done, please type \"reboot\" to reboot\n"
clear(); "the new system.\n");
dialog_clear(); execlp("sh", "-sh", 0);
dialog_update(); msgDebug("Was unable to execute sh for post-upgrade shell!\n");
return RET_SUCCESS; exit(1);
/* NOTREACHED */
return 0;
} }

View file

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next * This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite. * generation being essentially a complete rewrite.
* *
* $Id: package.c,v 1.16 1995/10/22 23:20:45 jkh Exp $ * $Id: package.c,v 1.17 1995/10/23 13:19:49 jkh Exp $
* *
* Copyright (c) 1995 * Copyright (c) 1995
* Jordan Hubbard. All rights reserved. * Jordan Hubbard. All rights reserved.
@ -109,7 +109,6 @@ package_extract(Device *dev, char *name)
"file itself is corrupted.\n" "file itself is corrupted.\n"
"You may wish to look into this and try again.", name); "You may wish to look into this and try again.", name);
} }
dev->close(dev, fd);
} }
else { else {
ret = RET_FAIL; ret = RET_FAIL;

View file

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next * This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite. * generation being essentially a complete rewrite.
* *
* $Id: installUpgrade.c,v 1.7 1995/10/22 17:39:16 jkh Exp $ * $Id: installUpgrade.c,v 1.8 1995/10/23 13:19:45 jkh Exp $
* *
* Copyright (c) 1995 * Copyright (c) 1995
* Jordan Hubbard. All rights reserved. * Jordan Hubbard. All rights reserved.
@ -174,8 +174,7 @@ installUpgrade(char *str)
{ {
char *saved_etc = NULL; char *saved_etc = NULL;
Boolean extractingBin = TRUE; Boolean extractingBin = TRUE;
int waitstatus; struct termios foo;
pid_t child;
if (!RunningAsInit) { if (!RunningAsInit) {
dialog_clear(); dialog_clear();
@ -184,13 +183,19 @@ installUpgrade(char *str)
return RET_FAIL; return RET_FAIL;
} }
systemDisplayHelp("upgrade");
if (msgYesNo("Given all that scary stuff you just read, are you sure you want to\n"
"risk it all and proceed with this upgrade?"))
return RET_FAIL;
if (!Dists) { if (!Dists) {
dialog_clear(); dialog_clear();
msgConfirm("You haven't specified any distributions yet. The upgrade procedure\n" msgConfirm("You haven't specified any distributions yet. The upgrade procedure will\n"
"will only upgrade those portions of the system for which a distribution\n" "only upgrade those portions of the system for which a distribution has\n"
"has been selected. In the next screen, we'll go to the Distributions\n" "been selected. In the next screen, we'll go to the Distributions menu\n"
"menu to select those portions of 2.1 you wish to install on top of your\n" "to select those portions of 2.1 you wish to install on top of your 2.0.5\n"
"2.0.5 system."); "system.");
if (!dmenuOpenSimple(&MenuDistributions)) if (!dmenuOpenSimple(&MenuDistributions))
return RET_FAIL; return RET_FAIL;
} }
@ -210,11 +215,12 @@ installUpgrade(char *str)
if (!(Dists & DIST_BIN)) if (!(Dists & DIST_BIN))
extractingBin = FALSE; extractingBin = FALSE;
systemDisplayHelp("upgrade"); if (!mediaDevice) {
dialog_clear();
if (msgYesNo("Given all that scary stuff you just read, are you sure you want to\n" msgConfirm("Now you must specify an installation medium for the upgrade.");
"risk it all and proceed with this upgrade?")) if (!dmenuOpenSimple(&MenuMedia) || !mediaDevice)
return RET_FAIL; return RET_FAIL;
}
/* Note that we're now upgrading */ /* Note that we're now upgrading */
variable_set2(SYSTEM_STATE, "upgrade"); variable_set2(SYSTEM_STATE, "upgrade");
@ -227,7 +233,7 @@ installUpgrade(char *str)
"instance, you'll be using the label editor as little more than a fancy\n" "instance, you'll be using the label editor as little more than a fancy\n"
"screen-oriented filesystem mounting utility, so think of it that way.\n\n" "screen-oriented filesystem mounting utility, so think of it that way.\n\n"
"Once you're done in the label editor, press Q to return here for the next\n" "Once you're done in the label editor, press Q to return here for the next\n"
"step.\n"); "step.");
if (diskLabelEditor(NULL) == RET_FAIL) { if (diskLabelEditor(NULL) == RET_FAIL) {
dialog_clear(); dialog_clear();
@ -238,7 +244,7 @@ installUpgrade(char *str)
/* Don't write out MBR info */ /* Don't write out MBR info */
variable_set2(DISK_PARTITIONED, "written"); variable_set2(DISK_PARTITIONED, "written");
if (diskLabelCommit(NULL) == RET_FAIL) { if (diskLabelCommit("upgrade") == RET_FAIL) {
dialog_clear(); dialog_clear();
msgConfirm("Not all file systems were properly mounted. Upgrade operation\n" msgConfirm("Not all file systems were properly mounted. Upgrade operation\n"
"aborted."); "aborted.");
@ -273,21 +279,26 @@ installUpgrade(char *str)
} }
if (file_readable("/kernel")) { if (file_readable("/kernel")) {
msgNotify("Moving old kernel to /kernel.205"); msgNotify("Moving old kernel to /kernel.205");
if (system("chflags noschg /mnt/kernel && mv /mnt/kernel /mnt/kernel.205")) { if (system("chflags noschg /kernel && mv /kernel /kernel.205")) {
dialog_clear(); dialog_clear();
if (!msgYesNo("Hmmm! I couldn't move the old kernel over! Do you want to\n" if (!msgYesNo("Hmmm! I couldn't move the old kernel over! Do you want to\n"
"treat this as a big problem and abort the upgrade?")) "treat this as a big problem and abort the upgrade? Due to the\n"
return RET_FAIL; "way that this upgrade process works, you will have to reboot\n"
"and start over from the beginning. Select Yes to reboot now")) {
reboot(0);
}
} }
} }
} }
msgNotify("Beginning extraction of distributions.."); msgNotify("Beginning extraction of distributions..");
if (distExtractAll(NULL) == RET_FAIL) { if (distExtractAll("upgrade") == RET_FAIL) {
if (extractingBin && (Dists & DIST_BIN)) { if (extractingBin && (Dists & DIST_BIN)) {
dialog_clear(); dialog_clear();
msgConfirm("Hmmmm. We couldn't even extract the bin distribution. This upgrade\n" 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"); "should be considered a failure and started from the beginning, sorry!\n"
return RET_FAIL; "The system will reboot now.");
reboot(0);
} }
dialog_clear(); dialog_clear();
msgConfirm("The extraction process seems to have had some problems, but we got most\n" msgConfirm("The extraction process seems to have had some problems, but we got most\n"
@ -331,18 +342,18 @@ installUpgrade(char *str)
"Something went seriously wrong! It's quite possible that\n" "Something went seriously wrong! It's quite possible that\n"
"your former /etc is toast. I hope you didn't have any\n" "your former /etc is toast. I hope you didn't have any\n"
"important customizations you wanted to keep in there.. :(\n"); "important customizations you wanted to keep in there.. :(\n");
return RET_FAIL;
} }
else {
/* Now try to resurrect the /etc files */ /* Now try to resurrect the /etc files */
traverseHitlist(etc_files); traverseHitlist(etc_files);
}
dialog_clear(); dialog_clear();
msgConfirm("OK! At this stage, we've resurrected all the /etc files we could\n" 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" "(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" "yourself by hand) and we're going to drop you into a shell to do\n"
"the rest yourself (sorry about this!). Once the system looks good\n" "the rest yourself (sorry about this!). Once the system looks good\n"
"to you, exit the shell and reboot the system."); "to you, exit the shell to reboot the system.");
chdir("/"); chdir("/");
dialog_clear(); dialog_clear();
@ -350,27 +361,19 @@ installUpgrade(char *str)
end_dialog(); end_dialog();
DialogActive = FALSE; DialogActive = FALSE;
if (!(child = fork())) { signal(SIGTTOU, SIG_IGN);
struct termios foo; if (tcgetattr(0, &foo) != -1) {
foo.c_cc[VERASE] = '\010';
signal(SIGTTOU, SIG_IGN); if (tcsetattr(0, TCSANOW, &foo) == -1)
if (tcgetattr(0, &foo) != -1) { msgDebug("Unable to set the erase character.\n");
foo.c_cc[VERASE] = '\010';
if (tcsetattr(0, TCSANOW, &foo) == -1)
msgDebug("Unable to set the erase character.\n");
}
else
msgDebug("Unable to get the terminal attributes!\n");
printf("Well, good luck! When you're done, type exit to return.\n");
execlp("sh", "-sh", 0);
msgDebug("Was unable to execute sh for post-upgrade shell!\n");
exit(1);
} }
else else
(void)waitpid(child, &waitstatus, 0); msgDebug("Unable to get the terminal attributes!\n");
DialogActive = TRUE; printf("Well, good luck! When you're done, please type \"reboot\" to reboot\n"
clear(); "the new system.\n");
dialog_clear(); execlp("sh", "-sh", 0);
dialog_update(); msgDebug("Was unable to execute sh for post-upgrade shell!\n");
return RET_SUCCESS; exit(1);
/* NOTREACHED */
return 0;
} }

View file

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next * This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite. * generation being essentially a complete rewrite.
* *
* $Id: package.c,v 1.16 1995/10/22 23:20:45 jkh Exp $ * $Id: package.c,v 1.17 1995/10/23 13:19:49 jkh Exp $
* *
* Copyright (c) 1995 * Copyright (c) 1995
* Jordan Hubbard. All rights reserved. * Jordan Hubbard. All rights reserved.
@ -109,7 +109,6 @@ package_extract(Device *dev, char *name)
"file itself is corrupted.\n" "file itself is corrupted.\n"
"You may wish to look into this and try again.", name); "You may wish to look into this and try again.", name);
} }
dev->close(dev, fd);
} }
else { else {
ret = RET_FAIL; ret = RET_FAIL;