installUpgrade.c (93595) | installUpgrade.c (95327) |
---|---|
1/* 2 * The new sysinstall program. 3 * 4 * This is probably the last program in the `sysinstall' line - the next 5 * generation being essentially a complete rewrite. 6 * | 1/* 2 * The new sysinstall program. 3 * 4 * This is probably the last program in the `sysinstall' line - the next 5 * generation being essentially a complete rewrite. 6 * |
7 * $FreeBSD: head/usr.sbin/sysinstall/installUpgrade.c 93595 2002-04-01 21:35:24Z obrien $ | 7 * $FreeBSD: head/usr.sbin/sysinstall/installUpgrade.c 95327 2002-04-23 22:16:41Z obrien $ |
8 * 9 * Copyright (c) 1995 10 * Jordan Hubbard. All rights reserved. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright --- 159 unchanged lines hidden (view full) --- 175 return DITEM_FAILURE; 176 177 if (!Dists) { 178 msgConfirm("First, you must select some distribution components. The upgrade procedure\n" 179 "will only upgrade the distributions you select in the next set of menus."); 180 if (!dmenuOpenSimple(&MenuDistributions, FALSE) || !Dists) 181 return DITEM_FAILURE; 182 } | 8 * 9 * Copyright (c) 1995 10 * Jordan Hubbard. All rights reserved. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright --- 159 unchanged lines hidden (view full) --- 175 return DITEM_FAILURE; 176 177 if (!Dists) { 178 msgConfirm("First, you must select some distribution components. The upgrade procedure\n" 179 "will only upgrade the distributions you select in the next set of menus."); 180 if (!dmenuOpenSimple(&MenuDistributions, FALSE) || !Dists) 181 return DITEM_FAILURE; 182 } |
183 else if (!(Dists & DIST_BIN)) { /* No bin selected? Not much of an upgrade.. */ 184 if (msgYesNo("You didn't select the bin distribution as one of the distributons to load.\n" | 183 else if (!(Dists & DIST_BASE)) { /* No base selected? Not much of an upgrade.. */ 184 if (msgYesNo("You didn't select the base distribution as one of the distributons to load.\n" |
185 "This one is pretty vital to a successful upgrade. Are you SURE you don't\n" | 185 "This one is pretty vital to a successful upgrade. Are you SURE you don't\n" |
186 "want to select the bin distribution? Chose No to bring up the Distributions\n" | 186 "want to select the base distribution? Chose No to bring up the Distributions\n" |
187 "menu again.") != 0) { 188 if (!dmenuOpenSimple(&MenuDistributions, FALSE)) 189 return DITEM_FAILURE; 190 } 191 } 192 193 /* Still?! OK! They must know what they're doing.. */ | 187 "menu again.") != 0) { 188 if (!dmenuOpenSimple(&MenuDistributions, FALSE)) 189 return DITEM_FAILURE; 190 } 191 } 192 193 /* Still?! OK! They must know what they're doing.. */ |
194 if (!(Dists & DIST_BIN)) | 194 if (!(Dists & DIST_BASE)) |
195 extractingBin = FALSE; 196 197 if (RunningAsInit) { 198 Device **devs; 199 int i, cnt; 200 char *cp; 201 202 cp = variable_get(VAR_DISK); --- 117 unchanged lines hidden (view full) --- 320 goto media; 321 } 322 else 323 return DITEM_FAILURE | DITEM_REDRAW | DITEM_RESTORE; 324 } 325 326 msgNotify("Beginning extraction of distributions.."); 327 if (DITEM_STATUS(distExtractAll(self)) == DITEM_FAILURE) { | 195 extractingBin = FALSE; 196 197 if (RunningAsInit) { 198 Device **devs; 199 int i, cnt; 200 char *cp; 201 202 cp = variable_get(VAR_DISK); --- 117 unchanged lines hidden (view full) --- 320 goto media; 321 } 322 else 323 return DITEM_FAILURE | DITEM_REDRAW | DITEM_RESTORE; 324 } 325 326 msgNotify("Beginning extraction of distributions.."); 327 if (DITEM_STATUS(distExtractAll(self)) == DITEM_FAILURE) { |
328 msgConfirm("Hmmmm. We couldn't even extract the bin distribution. This upgrade\n" | 328 msgConfirm("Hmmmm. We couldn't even extract the base distribution. This upgrade\n" |
329 "should be considered a failure and started from the beginning, sorry!\n" 330 "The system will reboot now."); 331 dialog_clear(); 332 systemShutdown(1); 333 } 334 else if (Dists) { | 329 "should be considered a failure and started from the beginning, sorry!\n" 330 "The system will reboot now."); 331 dialog_clear(); 332 systemShutdown(1); 333 } 334 else if (Dists) { |
335 if (!extractingBin || !(Dists & DIST_BIN)) { | 335 if (!extractingBin || !(Dists & DIST_BASE)) { |
336 msgNotify("The extraction process seems to have had some problems, but we got most\n" 337 "of the essentials. We'll treat this as a warning since it may have been\n" 338 "only non-essential distributions which failed to load."); 339 } 340 else { | 336 msgNotify("The extraction process seems to have had some problems, but we got most\n" 337 "of the essentials. We'll treat this as a warning since it may have been\n" 338 "only non-essential distributions which failed to load."); 339 } 340 else { |
341 msgConfirm("Hmmmm. We couldn't even extract the bin distribution. This upgrade\n" | 341 msgConfirm("Hmmmm. We couldn't even extract the base distribution. This upgrade\n" |
342 "should be considered a failure and started from the beginning, sorry!\n" 343 "The system will reboot now."); 344 dialog_clear(); 345 systemShutdown(1); 346 } 347 } 348 349 if (extractingBin) --- 29 unchanged lines hidden (view full) --- 379installUpgradeNonInteractive(dialogMenuItem *self) 380{ 381 char *saved_etc; 382 Boolean extractingBin = TRUE; 383 384 variable_set2(SYSTEM_STATE, "upgrade", 0); 385 386 /* Make sure at least BIN is selected */ | 342 "should be considered a failure and started from the beginning, sorry!\n" 343 "The system will reboot now."); 344 dialog_clear(); 345 systemShutdown(1); 346 } 347 } 348 349 if (extractingBin) --- 29 unchanged lines hidden (view full) --- 379installUpgradeNonInteractive(dialogMenuItem *self) 380{ 381 char *saved_etc; 382 Boolean extractingBin = TRUE; 383 384 variable_set2(SYSTEM_STATE, "upgrade", 0); 385 386 /* Make sure at least BIN is selected */ |
387 Dists |= DIST_BIN; | 387 Dists |= DIST_BASE; |
388 389 if (RunningAsInit) { 390 Device **devs; 391 int i, cnt; 392 char *cp; 393 394 cp = variable_get(VAR_DISK); 395 devs = deviceFind(cp, DEVICE_TYPE_DISK); --- 69 unchanged lines hidden (view full) --- 465 if (!system("chflags noschg /kernel && mv /kernel /kernel.prev")) { 466 /* Give us a working kernel in case we crash and reboot */ 467 system("cp /kernel.prev /kernel"); 468 } 469 } 470 471 msgNotify("Beginning extraction of distributions.."); 472 if (DITEM_STATUS(distExtractAll(self)) == DITEM_FAILURE) { | 388 389 if (RunningAsInit) { 390 Device **devs; 391 int i, cnt; 392 char *cp; 393 394 cp = variable_get(VAR_DISK); 395 devs = deviceFind(cp, DEVICE_TYPE_DISK); --- 69 unchanged lines hidden (view full) --- 465 if (!system("chflags noschg /kernel && mv /kernel /kernel.prev")) { 466 /* Give us a working kernel in case we crash and reboot */ 467 system("cp /kernel.prev /kernel"); 468 } 469 } 470 471 msgNotify("Beginning extraction of distributions.."); 472 if (DITEM_STATUS(distExtractAll(self)) == DITEM_FAILURE) { |
473 msgConfirm("Hmmmm. We couldn't even extract the bin distribution. This upgrade\n" | 473 msgConfirm("Hmmmm. We couldn't even extract the base distribution. This upgrade\n" |
474 "should be considered a failure and started from the beginning, sorry!\n" 475 "The system will reboot now."); 476 dialog_clear(); 477 systemShutdown(1); 478 } 479 else if (Dists) { | 474 "should be considered a failure and started from the beginning, sorry!\n" 475 "The system will reboot now."); 476 dialog_clear(); 477 systemShutdown(1); 478 } 479 else if (Dists) { |
480 if (!(Dists & DIST_BIN)) { | 480 if (!(Dists & DIST_BASE)) { |
481 msgNotify("The extraction process seems to have had some problems, but we got most\n" 482 "of the essentials. We'll treat this as a warning since it may have been\n" 483 "only non-essential distributions which failed to upgrade."); 484 } 485 else { | 481 msgNotify("The extraction process seems to have had some problems, but we got most\n" 482 "of the essentials. We'll treat this as a warning since it may have been\n" 483 "only non-essential distributions which failed to upgrade."); 484 } 485 else { |
486 msgConfirm("Hmmmm. We couldn't even extract the bin distribution. This upgrade\n" | 486 msgConfirm("Hmmmm. We couldn't even extract the base distribution. This upgrade\n" |
487 "should be considered a failure and started from the beginning, sorry!\n" 488 "The system will reboot now."); 489 dialog_clear(); 490 systemShutdown(1); 491 } 492 } 493 494 msgNotify("First stage of upgrade completed successfully."); 495 if (vsystem("tar -cpBf - -C %s . | tar --unlink -xpBf - -C /etc", saved_etc)) { 496 msgNotify("Unable to resurrect your old /etc!"); 497 return DITEM_FAILURE; 498 } 499 return DITEM_SUCCESS | DITEM_REDRAW; 500} | 487 "should be considered a failure and started from the beginning, sorry!\n" 488 "The system will reboot now."); 489 dialog_clear(); 490 systemShutdown(1); 491 } 492 } 493 494 msgNotify("First stage of upgrade completed successfully."); 495 if (vsystem("tar -cpBf - -C %s . | tar --unlink -xpBf - -C /etc", saved_etc)) { 496 msgNotify("Unable to resurrect your old /etc!"); 497 return DITEM_FAILURE; 498 } 499 return DITEM_SUCCESS | DITEM_REDRAW; 500} |