summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysinstall
diff options
context:
space:
mode:
authorceri <ceri@FreeBSD.org>2007-01-01 17:25:51 +0000
committerceri <ceri@FreeBSD.org>2007-01-01 17:25:51 +0000
commit84c2458fe24e7eef9fd24a6eb00513050c2cdf44 (patch)
tree4d3333d2ba3267e660c26fd377a98c16350351db /usr.sbin/sysinstall
parent64068416e200845e9b1e6ecfaa56281332064f76 (diff)
downloadFreeBSD-src-84c2458fe24e7eef9fd24a6eb00513050c2cdf44.zip
FreeBSD-src-84c2458fe24e7eef9fd24a6eb00513050c2cdf44.tar.gz
During an upgrade, if /boot/kernel.prev exists then the backup of
/boot/kernel can fail. Try to remove /boot/kernel.prev and cope the best we can if that fails. PR: bin/106376 Submitted by: Nobuyuki Koganemaru Approved by: ru MFC after: 2 weeks
Diffstat (limited to 'usr.sbin/sysinstall')
-rw-r--r--usr.sbin/sysinstall/installUpgrade.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/usr.sbin/sysinstall/installUpgrade.c b/usr.sbin/sysinstall/installUpgrade.c
index d70aab7..1d98b1e 100644
--- a/usr.sbin/sysinstall/installUpgrade.c
+++ b/usr.sbin/sysinstall/installUpgrade.c
@@ -300,6 +300,15 @@ installUpgrade(dialogMenuItem *self)
(void)vsystem("chflags -R noschg /bin /sbin /lib /libexec /usr/bin /usr/sbin /usr/lib /usr/libexec /var/empty /boot/kernel*");
if (directory_exists("/boot/kernel")) {
+ if (directory_exists("/boot/kernel.prev")) {
+ msgNotify("Removing /boot/kernel.prev");
+ if (system("rm -fr /boot/kernel.prev")) {
+ msgConfirm("NOTICE: I'm trying to back up /boot/kernel to\n"
+ "/boot/kernel.prev, but /boot/kernel.prev exists and I\n"
+ "can't remove it. This means that the backup will, in\n"
+ "all probability, fail.");
+ }
+ }
msgNotify("Moving old kernel to /boot/kernel.prev");
if (system("mv /boot/kernel /boot/kernel.prev")) {
if (!msgYesNo("Hmmm! I couldn't move the old kernel over! Do you want to\n"
@@ -472,6 +481,15 @@ installUpgradeNonInteractive(dialogMenuItem *self)
* crash and reboot.
*/
if (directory_exists("/boot/kernel")) {
+ if (directory_exists("/boot/kernel.prev")) {
+ msgNotify("Removing /boot/kernel.prev");
+ if (system("rm -fr /boot/kernel.prev")) {
+ msgConfirm("NOTICE: I'm trying to back up /boot/kernel to\n"
+ "/boot/kernel.prev, but /boot/kernel.prev exists and I\n"
+ "can't remove it. This means that the backup will, in\n"
+ "all probability, fail.");
+ }
+ }
msgNotify("Copying old kernel to /boot/kernel.prev");
vsystem("cp -Rp /boot/kernel /boot/kernel.prev");
}
OpenPOWER on IntegriCloud