perform.c (39068) | perform.c (41866) |
---|---|
1#ifndef lint 2static const char rcsid[] = | 1#ifndef lint 2static const char rcsid[] = |
3 "$Id: perform.c,v 1.52 1998/09/08 03:02:45 jkh Exp $"; | 3 "$Id: perform.c,v 1.53 1998/09/11 07:26:54 jkh Exp $"; |
4#endif 5 6/* 7 * FreeBSD install - a package for the installation and maintainance 8 * of non-core utilities. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions --- 55 unchanged lines hidden (view full) --- 67 char playpen[FILENAME_MAX]; 68 char extract_contents[FILENAME_MAX]; 69 char *where_to, *tmp, *extract; 70 FILE *cfile; 71 int code; 72 PackingList p; 73 struct stat sb; 74 int inPlace; | 4#endif 5 6/* 7 * FreeBSD install - a package for the installation and maintainance 8 * of non-core utilities. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions --- 55 unchanged lines hidden (view full) --- 67 char playpen[FILENAME_MAX]; 68 char extract_contents[FILENAME_MAX]; 69 char *where_to, *tmp, *extract; 70 FILE *cfile; 71 int code; 72 PackingList p; 73 struct stat sb; 74 int inPlace; |
75 /* support for separate pre/post install scripts */ 76 int new_m = 0; 77 char pre_script[FILENAME_MAX] = INSTALL_FNAME; 78 char post_script[FILENAME_MAX]; 79 char pre_arg[FILENAME_MAX], post_arg[FILENAME_MAX]; |
|
75 76 code = 0; 77 zapLogDir = 0; 78 LogDir[0] = '\0'; 79 strcpy(playpen, FirstPen); 80 inPlace = 0; 81 82 /* Are we coming in for a second pass, everything already extracted? */ --- 230 unchanged lines hidden (view full) --- 313 Force ? "installing anyway" : "- not installed"); 314 if (!Force) { 315 code = 1; 316 goto success; /* close enough for government work */ 317 } 318 } 319 } 320 | 80 81 code = 0; 82 zapLogDir = 0; 83 LogDir[0] = '\0'; 84 strcpy(playpen, FirstPen); 85 inPlace = 0; 86 87 /* Are we coming in for a second pass, everything already extracted? */ --- 230 unchanged lines hidden (view full) --- 318 Force ? "installing anyway" : "- not installed"); 319 if (!Force) { 320 code = 1; 321 goto success; /* close enough for government work */ 322 } 323 } 324 } 325 |
326 /* Test whether to use the old method of passing tokens to installation 327 * scripts, and set appropriate variables.. 328 */ 329 330 if (fexists(POST_INSTALL_FNAME)) { 331 new_m = 1; 332 sprintf(post_script, "%s", POST_INSTALL_FNAME); 333 sprintf(pre_arg, ""); 334 sprintf(post_arg, ""); 335 } else { 336 if (fexists(INSTALL_FNAME)) { 337 sprintf(post_script, "%s", INSTALL_FNAME); 338 sprintf(pre_arg, "PRE-INSTALL"); 339 sprintf(post_arg, "POST-INSTALL"); 340 } 341 } 342 |
|
321 /* If we're really installing, and have an installation file, run it */ | 343 /* If we're really installing, and have an installation file, run it */ |
322 if (!NoInstall && fexists(INSTALL_FNAME)) { 323 vsystem("chmod +x %s", INSTALL_FNAME); /* make sure */ | 344 if (!NoInstall && fexists(pre_script)) { 345 vsystem("chmod +x %s", pre_script); /* make sure */ |
324 if (Verbose) | 346 if (Verbose) |
325 printf("Running install with PRE-INSTALL for %s..\n", PkgName); 326 if (!Fake && vsystem("./%s %s PRE-INSTALL", INSTALL_FNAME, PkgName)) { | 347 printf("Running pre-install for %s..\n", PkgName); 348 if (!Fake && vsystem("./%s %s %s", pre_script, PkgName, pre_arg)) { |
327 warnx("install script returned error status"); | 349 warnx("install script returned error status"); |
328 unlink(INSTALL_FNAME); | 350 unlink(pre_script); |
329 code = 1; 330 goto success; /* nothing to uninstall yet */ 331 } | 351 code = 1; 352 goto success; /* nothing to uninstall yet */ 353 } |
354 if (new_m) unlink(pre_script); |
|
332 } 333 334 /* Now finally extract the entire show if we're not going direct */ 335 if (!inPlace && !Fake) 336 extract_plist(".", &Plist); 337 338 if (!Fake && fexists(MTREE_FNAME)) { 339 if (Verbose) --- 4 unchanged lines hidden (view full) --- 344 if (!Fake) { 345 if (vsystem("/usr/sbin/mtree -U -f %s -d -e -p %s", MTREE_FNAME, p ? p->name : "/")) 346 warnx("mtree returned a non-zero status - continuing"); 347 } 348 unlink(MTREE_FNAME); 349 } 350 351 /* Run the installation script one last time? */ | 355 } 356 357 /* Now finally extract the entire show if we're not going direct */ 358 if (!inPlace && !Fake) 359 extract_plist(".", &Plist); 360 361 if (!Fake && fexists(MTREE_FNAME)) { 362 if (Verbose) --- 4 unchanged lines hidden (view full) --- 367 if (!Fake) { 368 if (vsystem("/usr/sbin/mtree -U -f %s -d -e -p %s", MTREE_FNAME, p ? p->name : "/")) 369 warnx("mtree returned a non-zero status - continuing"); 370 } 371 unlink(MTREE_FNAME); 372 } 373 374 /* Run the installation script one last time? */ |
352 if (!NoInstall && fexists(INSTALL_FNAME)) { | 375 if (!NoInstall && fexists(post_script)) { 376 vsystem("chmod +x %s", post_script); /* make sure */ |
353 if (Verbose) | 377 if (Verbose) |
354 printf("Running install with POST-INSTALL for %s..\n", PkgName); 355 if (!Fake && vsystem("./%s %s POST-INSTALL", INSTALL_FNAME, PkgName)) { | 378 printf("Running post-install for %s..\n", PkgName); 379 if (!Fake && vsystem("./%s %s %s", post_script, PkgName, post_arg)) { |
356 warnx("install script returned error status"); | 380 warnx("install script returned error status"); |
357 unlink(INSTALL_FNAME); | 381 unlink(post_script); |
358 code = 1; 359 goto fail; 360 } | 382 code = 1; 383 goto fail; 384 } |
361 unlink(INSTALL_FNAME); | 385 unlink(post_script); |
362 } 363 364 /* Time to record the deed? */ 365 if (!NoRecord && !Fake) { 366 char contents[FILENAME_MAX]; 367 FILE *cfile; 368 369 umask(022); --- 14 unchanged lines hidden (view full) --- 384 bzero(LogDir, FILENAME_MAX); 385 code = 1; 386 goto success; /* close enough for government work */ 387 } 388 /* Make sure pkg_info can read the entry */ 389 vsystem("chmod a+rx %s", LogDir); 390 if (fexists(DEINSTALL_FNAME)) 391 move_file(".", DEINSTALL_FNAME, LogDir); | 386 } 387 388 /* Time to record the deed? */ 389 if (!NoRecord && !Fake) { 390 char contents[FILENAME_MAX]; 391 FILE *cfile; 392 393 umask(022); --- 14 unchanged lines hidden (view full) --- 408 bzero(LogDir, FILENAME_MAX); 409 code = 1; 410 goto success; /* close enough for government work */ 411 } 412 /* Make sure pkg_info can read the entry */ 413 vsystem("chmod a+rx %s", LogDir); 414 if (fexists(DEINSTALL_FNAME)) 415 move_file(".", DEINSTALL_FNAME, LogDir); |
416 if (fexists(POST_DEINSTALL_FNAME)) 417 move_file(".", POST_DEINSTALL_FNAME, LogDir); |
|
392 if (fexists(REQUIRE_FNAME)) 393 move_file(".", REQUIRE_FNAME, LogDir); 394 sprintf(contents, "%s/%s", LogDir, CONTENTS_FNAME); 395 cfile = fopen(contents, "w"); 396 if (!cfile) { 397 warnx("can't open new contents file '%s'! can't register pkg", 398 contents); 399 goto success; /* can't log, but still keep pkg */ --- 98 unchanged lines hidden --- | 418 if (fexists(REQUIRE_FNAME)) 419 move_file(".", REQUIRE_FNAME, LogDir); 420 sprintf(contents, "%s/%s", LogDir, CONTENTS_FNAME); 421 cfile = fopen(contents, "w"); 422 if (!cfile) { 423 warnx("can't open new contents file '%s'! can't register pkg", 424 contents); 425 goto success; /* can't log, but still keep pkg */ --- 98 unchanged lines hidden --- |