install.c (8636) | install.c (8640) |
---|---|
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 * $Id: install.c,v 1.31 1995/05/19 21:30:33 jkh Exp $ | 7 * $Id: install.c,v 1.32 1995/05/20 00:13:10 jkh Exp $ |
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 --- 109 unchanged lines hidden (view full) --- 125 if (ret) 126 msgConfirm("Bad144 init on %s returned status of %d!", c1->name, ret); 127 ret = vsystem("bad144 -v -s /dev/r%s", c1->name); 128 if (ret) 129 msgConfirm("Bad144 scan on %s returned status of %d!", c1->name, ret); 130 } 131 } 132 } | 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 --- 109 unchanged lines hidden (view full) --- 125 if (ret) 126 msgConfirm("Bad144 init on %s returned status of %d!", c1->name, ret); 127 ret = vsystem("bad144 -v -s /dev/r%s", c1->name); 128 if (ret) 129 msgConfirm("Bad144 scan on %s returned status of %d!", c1->name, ret); 130 } 131 } 132 } |
133 make_filesystems(); 134 copy_self(); 135 cpio_extract(); |
|
133 alreadyDone = TRUE; 134} 135 | 136 alreadyDone = TRUE; 137} 138 |
139static void 140installFinal(void) 141{ 142 static Boolean alreadyDone = FALSE; 143 144 if (alreadyDone) 145 return; 146 install_configuration_files(); 147 do_final_setup(); 148 alreadyDone = TRUE; 149} 150 |
|
136int 137installCommit(char *str) 138{ 139 installInitial(); | 151int 152installCommit(char *str) 153{ 154 installInitial(); |
140 make_filesystems(); 141 copy_self(); 142 cpio_extract(); | |
143 distExtractAll(); | 155 distExtractAll(); |
144 install_configuration_files(); 145 do_final_setup(); 146 return 1; | 156 installFinal(); 157 return 0; |
147} 148 149/* Go newfs and/or mount all the filesystems we've been asked to */ 150static void 151make_filesystems(void) 152{ 153 int i; 154 Disk *disk; --- 103 unchanged lines hidden (view full) --- 258} 259 260static void 261cpio_extract(void) 262{ 263 int i, j, zpid, cpid, pfd[2]; 264 extern int wait(int *status); 265 | 158} 159 160/* Go newfs and/or mount all the filesystems we've been asked to */ 161static void 162make_filesystems(void) 163{ 164 int i; 165 Disk *disk; --- 103 unchanged lines hidden (view full) --- 269} 270 271static void 272cpio_extract(void) 273{ 274 int i, j, zpid, cpid, pfd[2]; 275 extern int wait(int *status); 276 |
266 while (CpioFD == -1) { 267 msgConfirm("Please Insert CPIO floppy in floppy drive 0"); 268 CpioFD = open("/dev/rfd0", O_RDONLY); 269 } 270 msgNotify("Extracting contents of CPIO floppy..."); 271 pipe(pfd); 272 zpid = fork(); 273 if (!zpid) { 274 close(0); dup(CpioFD); close(CpioFD); 275 close(1); dup(pfd[1]); close(pfd[1]); 276 close(pfd[0]); 277 i = execl("/stand/gunzip", "/stand/gunzip", 0); 278 msgDebug("/stand/gunzip command returns %d status\n", i); 279 exit(i); 280 } 281 cpid = fork(); 282 if (!cpid) { 283 close(0); dup(pfd[0]); close(pfd[0]); 284 close(CpioFD); 285 close(pfd[1]); 286 if (DebugFD != -1) { 287 dup2(DebugFD, 1); 288 dup2(DebugFD, 2); | 277 tryagain: 278 j = fork(); 279 if (!j) { 280 while (CpioFD == -1) { 281 msgConfirm("Please Insert CPIO floppy in floppy drive 0"); 282 CpioFD = open("/dev/rfd0", O_RDONLY); |
289 } | 283 } |
290 else { | 284 chroot("/mnt"); chdir("/"); 285 msgNotify("Extracting contents of CPIO floppy..."); 286 pipe(pfd); 287 zpid = fork(); 288 if (!zpid) { 289 dup2(CpioFD, 0); close(CpioFD); 290 dup2(pfd[1], 1); close(pfd[1]); 291 close(pfd[0]); 292 i = execl("/stand/gunzip", "/stand/gunzip", 0); 293 msgDebug("/stand/gunzip command returns %d status\n", i); 294 exit(i); 295 } 296 cpid = fork(); 297 if (!cpid) { 298 dup2(pfd[0], 0); close(pfd[0]); 299 close(CpioFD); 300 close(pfd[1]); 301 if (DebugFD != -1) { 302 dup2(DebugFD, 1); 303 dup2(DebugFD, 2); 304 } 305 else { |
291 close(1); open("/dev/null", O_WRONLY); 292 dup2(1, 2); | 306 close(1); open("/dev/null", O_WRONLY); 307 dup2(1, 2); |
308 } 309 i = execl("/stand/cpio", "/stand/cpio", "-iduvm", 0); 310 msgDebug("/stand/cpio command returns %d status\n", i); 311 exit(i); |
|
293 } | 312 } |
294 chdir("/mnt"); 295 i = execl("/stand/cpio", "/stand/cpio", "-iduvm", 0); 296 msgDebug("/stand/cpio command returns %d status\n", i); 297 exit(i); | 313 close(pfd[0]); 314 close(pfd[1]); 315 close(CpioFD); 316 317 i = waitpid(zpid, &j, 0); 318 if (i < 0 || j) { 319 msgConfirm("gunzip returned status of %d, error was: %s (%d)! Help!", j, strerror(errno), errno); 320 exit(1); 321 } 322 i = waitpid(cpid, &j); 323 if (i < 0 || j) { 324 msgConfirm("cpio returned status of %d, error was: %s (%d)! Help!", j, strerror(errno), errno); 325 exit(2); 326 } 327 exit(0); |
298 } | 328 } |
299 close(pfd[0]); 300 close(pfd[1]); 301 close(CpioFD); 302 i = wait(&j); 303 if (i < 0 || j) 304 msgFatal("Pid %d, status %d, cpio=%d, gunzip=%d.\nerror:%s", 305 i, j, cpid, zpid, strerror(errno)); 306 i = wait(&j); 307 if (i < 0 || j) 308 msgFatal("Pid %d, status %d, cpio=%d, gunzip=%d.\nerror:%s", 309 i, j, cpid, zpid, strerror(errno)); | 329 else 330 i = wait(&j); 331 if (i < 0 || j || access("/mnt/OK", R_OK) == -1) { 332 msgConfirm("CPIO floppy did not extract properly! Please verify\n\that your media is correct and try again"); 333 goto tryagain; 334 } 335 unlink("/mnt/OK"); |
310} 311 312static void 313install_configuration_files(void) 314{ 315} 316 317static void 318do_final_setup(void) 319{ 320} | 336} 337 338static void 339install_configuration_files(void) 340{ 341} 342 343static void 344do_final_setup(void) 345{ 346} |