installUpgrade.c (50479) | installUpgrade.c (54587) |
---|---|
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 50479 1999-08-28 01:35:59Z peter $ | 7 * $FreeBSD: head/usr.sbin/sysinstall/installUpgrade.c 54587 1999-12-14 04:25:29Z jkh $ |
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 --- 141 unchanged lines hidden (view full) --- 157 Boolean extractingBin = TRUE; 158 159 if (variable_get(VAR_NONINTERACTIVE)) 160 return installUpgradeNonInteractive(self); 161 162 variable_set2(SYSTEM_STATE, "upgrade", 0); 163 systemDisplayHelp("UPGRADE"); 164 | 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 --- 141 unchanged lines hidden (view full) --- 157 Boolean extractingBin = TRUE; 158 159 if (variable_get(VAR_NONINTERACTIVE)) 160 return installUpgradeNonInteractive(self); 161 162 variable_set2(SYSTEM_STATE, "upgrade", 0); 163 systemDisplayHelp("UPGRADE"); 164 |
165 dialog_clear_norefresh(); | |
166 if (msgYesNo("Given all that scary stuff you just read, are you sure you want to\n" 167 "risk it all and proceed with this upgrade?") != 0) | 165 if (msgYesNo("Given all that scary stuff you just read, are you sure you want to\n" 166 "risk it all and proceed with this upgrade?") != 0) |
168 return DITEM_FAILURE | DITEM_RESTORE; | 167 return DITEM_FAILURE; |
169 170 if (!Dists) { 171 msgConfirm("First, you must select some distribution components. The upgrade procedure\n" 172 "will only upgrade the distributions you select in the next set of menus."); 173 if (!dmenuOpenSimple(&MenuDistributions, FALSE) || !Dists) | 168 169 if (!Dists) { 170 msgConfirm("First, you must select some distribution components. The upgrade procedure\n" 171 "will only upgrade the distributions you select in the next set of menus."); 172 if (!dmenuOpenSimple(&MenuDistributions, FALSE) || !Dists) |
174 return DITEM_FAILURE | DITEM_RESTORE; 175 dialog_clear_norefresh(); | 173 return DITEM_FAILURE; |
176 } 177 else if (!(Dists & DIST_BIN)) { /* No bin selected? Not much of an upgrade.. */ 178 if (msgYesNo("You didn't select the bin distribution as one of the distributons to load.\n" 179 "This one is pretty vital to a successful upgrade. Are you SURE you don't\n" 180 "want to select the bin distribution? Chose No to bring up the Distributions\n" 181 "menu again.") != 0) { 182 if (!dmenuOpenSimple(&MenuDistributions, FALSE)) | 174 } 175 else if (!(Dists & DIST_BIN)) { /* No bin selected? Not much of an upgrade.. */ 176 if (msgYesNo("You didn't select the bin distribution as one of the distributons to load.\n" 177 "This one is pretty vital to a successful upgrade. Are you SURE you don't\n" 178 "want to select the bin distribution? Chose No to bring up the Distributions\n" 179 "menu again.") != 0) { 180 if (!dmenuOpenSimple(&MenuDistributions, FALSE)) |
183 return DITEM_FAILURE | DITEM_RESTORE; 184 dialog_clear_norefresh(); | 181 return DITEM_FAILURE; |
185 } 186 } 187 188 /* Still?! OK! They must know what they're doing.. */ 189 if (!(Dists & DIST_BIN)) 190 extractingBin = FALSE; 191 192 if (RunningAsInit) { --- 23 unchanged lines hidden (view full) --- 216 "instance, you'll be using the label editor as little more than a fancy\n" 217 "screen-oriented partition mounting tool.\n\n" 218 "Once you're done in the label editor, press Q to return here for the next\n" 219 "step."); 220 221 if (DITEM_STATUS(diskLabelEditor(self)) == DITEM_FAILURE) { 222 msgConfirm("The disk label editor returned an error status. Upgrade operation\n" 223 "aborted."); | 182 } 183 } 184 185 /* Still?! OK! They must know what they're doing.. */ 186 if (!(Dists & DIST_BIN)) 187 extractingBin = FALSE; 188 189 if (RunningAsInit) { --- 23 unchanged lines hidden (view full) --- 213 "instance, you'll be using the label editor as little more than a fancy\n" 214 "screen-oriented partition mounting tool.\n\n" 215 "Once you're done in the label editor, press Q to return here for the next\n" 216 "step."); 217 218 if (DITEM_STATUS(diskLabelEditor(self)) == DITEM_FAILURE) { 219 msgConfirm("The disk label editor returned an error status. Upgrade operation\n" 220 "aborted."); |
224 return DITEM_FAILURE | DITEM_RESTORE; | 221 return DITEM_FAILURE; |
225 } 226 227 /* Don't write out MBR info */ 228 variable_set2(DISK_PARTITIONED, "written", 0); 229 if (DITEM_STATUS(diskLabelCommit(self)) == DITEM_FAILURE) { 230 msgConfirm("Not all file systems were properly mounted. Upgrade operation\n" 231 "aborted."); 232 variable_unset(DISK_PARTITIONED); | 222 } 223 224 /* Don't write out MBR info */ 225 variable_set2(DISK_PARTITIONED, "written", 0); 226 if (DITEM_STATUS(diskLabelCommit(self)) == DITEM_FAILURE) { 227 msgConfirm("Not all file systems were properly mounted. Upgrade operation\n" 228 "aborted."); 229 variable_unset(DISK_PARTITIONED); |
233 return DITEM_FAILURE | DITEM_RESTORE; | 230 return DITEM_FAILURE; |
234 } 235 236 msgNotify("Updating /stand on root filesystem"); 237 (void)vsystem("find -x /stand | cpio %s -pdum /mnt", cpioVerbosity()); 238 239 if (DITEM_STATUS(chroot("/mnt")) == DITEM_FAILURE) { 240 msgConfirm("Unable to chroot to /mnt - something is wrong with the\n" 241 "root partition or the way it's mounted if this doesn't work."); 242 variable_unset(DISK_PARTITIONED); | 231 } 232 233 msgNotify("Updating /stand on root filesystem"); 234 (void)vsystem("find -x /stand | cpio %s -pdum /mnt", cpioVerbosity()); 235 236 if (DITEM_STATUS(chroot("/mnt")) == DITEM_FAILURE) { 237 msgConfirm("Unable to chroot to /mnt - something is wrong with the\n" 238 "root partition or the way it's mounted if this doesn't work."); 239 variable_unset(DISK_PARTITIONED); |
243 return DITEM_FAILURE | DITEM_RESTORE; | 240 return DITEM_FAILURE; |
244 } 245 chdir("/"); 246 installEnvironment(); 247 systemCreateHoloshell(); 248 } 249 250 saved_etc[0] = '\0'; 251 --- 22 unchanged lines hidden (view full) --- 274 } 275 } 276 277 if (saved_etc[0]) { 278 msgNotify("Preserving /etc directory.."); 279 if (vsystem("tar -cBpf - -C /etc . | tar --unlink -xBpf - -C %s", saved_etc)) 280 if (msgYesNo("Unable to backup your /etc into %s.\n" 281 "Do you want to continue anyway?", saved_etc) != 0) | 241 } 242 chdir("/"); 243 installEnvironment(); 244 systemCreateHoloshell(); 245 } 246 247 saved_etc[0] = '\0'; 248 --- 22 unchanged lines hidden (view full) --- 271 } 272 } 273 274 if (saved_etc[0]) { 275 msgNotify("Preserving /etc directory.."); 276 if (vsystem("tar -cBpf - -C /etc . | tar --unlink -xBpf - -C %s", saved_etc)) 277 if (msgYesNo("Unable to backup your /etc into %s.\n" 278 "Do you want to continue anyway?", saved_etc) != 0) |
282 return DITEM_FAILURE | DITEM_RESTORE; | 279 return DITEM_FAILURE; |
283 msgNotify("Preserving /root directory.."); 284 vsystem("tar -cBpf - -C / root | tar --unlink -xBpf - -C %s", saved_etc); 285 } 286 287 msgNotify("chflags'ing old binaries - please wait."); 288 (void)vsystem("chflags -R noschg /bin /sbin /usr/sbin /usr/bin /usr/lib /kernel*"); 289 290 if (file_readable("/kernel")) { --- 9 unchanged lines hidden (view full) --- 300 msgConfirm("NOTICE: Your old kernel is in /kernel.prev should this upgrade\n" 301 "fail for any reason and you need to boot your old kernel"); 302 } 303 } 304 305media: 306 /* We do this very late, but we unfortunately need to back up /etc first */ 307 if (!mediaVerify()) | 280 msgNotify("Preserving /root directory.."); 281 vsystem("tar -cBpf - -C / root | tar --unlink -xBpf - -C %s", saved_etc); 282 } 283 284 msgNotify("chflags'ing old binaries - please wait."); 285 (void)vsystem("chflags -R noschg /bin /sbin /usr/sbin /usr/bin /usr/lib /kernel*"); 286 287 if (file_readable("/kernel")) { --- 9 unchanged lines hidden (view full) --- 297 msgConfirm("NOTICE: Your old kernel is in /kernel.prev should this upgrade\n" 298 "fail for any reason and you need to boot your old kernel"); 299 } 300 } 301 302media: 303 /* We do this very late, but we unfortunately need to back up /etc first */ 304 if (!mediaVerify()) |
308 return DITEM_FAILURE | DITEM_RESTORE; | 305 return DITEM_FAILURE; |
309 310 if (!mediaDevice->init(mediaDevice)) { 311 if (!msgYesNo("Couldn't initialize the media. Would you like\n" 312 "to adjust your media selection and try again?")) { 313 mediaDevice = NULL; 314 goto media; 315 } 316 else --- 90 unchanged lines hidden (view full) --- 407 "instance, you'll be using the label editor as little more than a fancy\n" 408 "screen-oriented partition mounting tool.\n\n" 409 "Once you're done in the label editor, press Q to return here for the next\n" 410 "step."); 411 412 if (DITEM_STATUS(diskLabelEditor(self)) == DITEM_FAILURE) { 413 msgConfirm("The disk label editor returned an error status. Upgrade operation\n" 414 "aborted."); | 306 307 if (!mediaDevice->init(mediaDevice)) { 308 if (!msgYesNo("Couldn't initialize the media. Would you like\n" 309 "to adjust your media selection and try again?")) { 310 mediaDevice = NULL; 311 goto media; 312 } 313 else --- 90 unchanged lines hidden (view full) --- 404 "instance, you'll be using the label editor as little more than a fancy\n" 405 "screen-oriented partition mounting tool.\n\n" 406 "Once you're done in the label editor, press Q to return here for the next\n" 407 "step."); 408 409 if (DITEM_STATUS(diskLabelEditor(self)) == DITEM_FAILURE) { 410 msgConfirm("The disk label editor returned an error status. Upgrade operation\n" 411 "aborted."); |
415 return DITEM_FAILURE | DITEM_RESTORE; | 412 return DITEM_FAILURE; |
416 } 417 418 /* Don't write out MBR info */ 419 variable_set2(DISK_PARTITIONED, "written", 0); 420 if (DITEM_STATUS(diskLabelCommit(self)) == DITEM_FAILURE) { 421 msgConfirm("Not all file systems were properly mounted. Upgrade operation\n" 422 "aborted."); 423 variable_unset(DISK_PARTITIONED); | 413 } 414 415 /* Don't write out MBR info */ 416 variable_set2(DISK_PARTITIONED, "written", 0); 417 if (DITEM_STATUS(diskLabelCommit(self)) == DITEM_FAILURE) { 418 msgConfirm("Not all file systems were properly mounted. Upgrade operation\n" 419 "aborted."); 420 variable_unset(DISK_PARTITIONED); |
424 return DITEM_FAILURE | DITEM_RESTORE; | 421 return DITEM_FAILURE; |
425 } 426 427 if (extractingBin) { 428 msgNotify("chflags'ing old binaries - please wait."); 429 (void)vsystem("chflags -R noschg /mnt/"); 430 } 431 msgNotify("Updating /stand on root filesystem"); 432 (void)vsystem("find -x /stand | cpio %s -pdum /mnt", cpioVerbosity()); 433 434 if (DITEM_STATUS(chroot("/mnt")) == DITEM_FAILURE) { 435 msgConfirm("Unable to chroot to /mnt - something is wrong with the\n" 436 "root partition or the way it's mounted if this doesn't work."); 437 variable_unset(DISK_PARTITIONED); | 422 } 423 424 if (extractingBin) { 425 msgNotify("chflags'ing old binaries - please wait."); 426 (void)vsystem("chflags -R noschg /mnt/"); 427 } 428 msgNotify("Updating /stand on root filesystem"); 429 (void)vsystem("find -x /stand | cpio %s -pdum /mnt", cpioVerbosity()); 430 431 if (DITEM_STATUS(chroot("/mnt")) == DITEM_FAILURE) { 432 msgConfirm("Unable to chroot to /mnt - something is wrong with the\n" 433 "root partition or the way it's mounted if this doesn't work."); 434 variable_unset(DISK_PARTITIONED); |
438 return DITEM_FAILURE | DITEM_RESTORE; | 435 return DITEM_FAILURE; |
439 } 440 chdir("/"); 441 systemCreateHoloshell(); 442 } 443 444 if (!mediaVerify() || !mediaDevice->init(mediaDevice)) { 445 msgNotify("Upgrade: Couldn't initialize media."); | 436 } 437 chdir("/"); 438 systemCreateHoloshell(); 439 } 440 441 if (!mediaVerify() || !mediaDevice->init(mediaDevice)) { 442 msgNotify("Upgrade: Couldn't initialize media."); |
446 return DITEM_FAILURE | DITEM_RESTORE; | 443 return DITEM_FAILURE; |
447 } 448 449 saved_etc = "/usr/tmp/etc"; 450 Mkdir(saved_etc); 451 msgNotify("Preserving /etc directory.."); 452 if (vsystem("tar -cpBf - -C /etc . | tar -xpBf - -C %s", saved_etc)) { 453 msgNotify("Unable to backup your /etc into %s.", saved_etc); | 444 } 445 446 saved_etc = "/usr/tmp/etc"; 447 Mkdir(saved_etc); 448 msgNotify("Preserving /etc directory.."); 449 if (vsystem("tar -cpBf - -C /etc . | tar -xpBf - -C %s", saved_etc)) { 450 msgNotify("Unable to backup your /etc into %s.", saved_etc); |
454 return DITEM_FAILURE | DITEM_RESTORE; | 451 return DITEM_FAILURE; |
455 } 456 457 if (file_readable("/kernel")) { 458 msgNotify("Moving old kernel to /kernel.prev"); 459 if (!system("chflags noschg /kernel && mv /kernel /kernel.prev")) { 460 /* Give us a working kernel in case we crash and reboot */ 461 system("cp /kernel.prev /kernel"); 462 } --- 20 unchanged lines hidden (view full) --- 483 dialog_clear(); 484 systemShutdown(1); 485 } 486 } 487 488 msgNotify("First stage of upgrade completed successfully."); 489 if (vsystem("tar -cpBf - -C %s . | tar --unlink -xpBf - -C /etc", saved_etc)) { 490 msgNotify("Unable to resurrect your old /etc!"); | 452 } 453 454 if (file_readable("/kernel")) { 455 msgNotify("Moving old kernel to /kernel.prev"); 456 if (!system("chflags noschg /kernel && mv /kernel /kernel.prev")) { 457 /* Give us a working kernel in case we crash and reboot */ 458 system("cp /kernel.prev /kernel"); 459 } --- 20 unchanged lines hidden (view full) --- 480 dialog_clear(); 481 systemShutdown(1); 482 } 483 } 484 485 msgNotify("First stage of upgrade completed successfully."); 486 if (vsystem("tar -cpBf - -C %s . | tar --unlink -xpBf - -C /etc", saved_etc)) { 487 msgNotify("Unable to resurrect your old /etc!"); |
491 return DITEM_FAILURE | DITEM_RESTORE; | 488 return DITEM_FAILURE; |
492 } 493 return DITEM_SUCCESS | DITEM_REDRAW; 494} | 489 } 490 return DITEM_SUCCESS | DITEM_REDRAW; 491} |