From b79a0997abed90c0c59e83562ac7e9222ec98cd7 Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Tue, 9 Sep 1997 09:19:30 +0000 Subject: [PATCH] Be more cautious about leaving user with a workable kernel during the upgrade process. Submitted by: Mikael Karpberg --- release/sysinstall/installUpgrade.c | 9 +++++++-- usr.sbin/sysinstall/installUpgrade.c | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/release/sysinstall/installUpgrade.c b/release/sysinstall/installUpgrade.c index d997533f12f6..8a7558218c02 100644 --- a/release/sysinstall/installUpgrade.c +++ b/release/sysinstall/installUpgrade.c @@ -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.49 1997/05/09 07:44:19 jkh Exp $ + * $Id: installUpgrade.c,v 1.50 1997/09/08 11:09:09 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -295,6 +295,8 @@ installUpgrade(dialogMenuItem *self) "and start over from the beginning. Select Yes to reboot now")) systemShutdown(1); } + else /* Give us a working kernel in case we crash and reboot */ + system("cp /kernel.prev /kernel"); } } @@ -444,7 +446,10 @@ installUpgradeNonInteractive(dialogMenuItem *self) if (file_readable("/kernel")) { msgNotify("Moving old kernel to /kernel.prev"); - system("chflags noschg /kernel && mv /kernel /kernel.prev"); + if (!system("chflags noschg /kernel && mv /kernel /kernel.prev")) { + /* Give us a working kernel in case we crash and reboot */ + system("cp /kernel.prev /kernel"); + } } msgNotify("Beginning extraction of distributions.."); diff --git a/usr.sbin/sysinstall/installUpgrade.c b/usr.sbin/sysinstall/installUpgrade.c index d997533f12f6..8a7558218c02 100644 --- a/usr.sbin/sysinstall/installUpgrade.c +++ b/usr.sbin/sysinstall/installUpgrade.c @@ -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.49 1997/05/09 07:44:19 jkh Exp $ + * $Id: installUpgrade.c,v 1.50 1997/09/08 11:09:09 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -295,6 +295,8 @@ installUpgrade(dialogMenuItem *self) "and start over from the beginning. Select Yes to reboot now")) systemShutdown(1); } + else /* Give us a working kernel in case we crash and reboot */ + system("cp /kernel.prev /kernel"); } } @@ -444,7 +446,10 @@ installUpgradeNonInteractive(dialogMenuItem *self) if (file_readable("/kernel")) { msgNotify("Moving old kernel to /kernel.prev"); - system("chflags noschg /kernel && mv /kernel /kernel.prev"); + if (!system("chflags noschg /kernel && mv /kernel /kernel.prev")) { + /* Give us a working kernel in case we crash and reboot */ + system("cp /kernel.prev /kernel"); + } } msgNotify("Beginning extraction of distributions..");