perform.c (195346) | perform.c (206043) |
---|---|
1/* 2 * FreeBSD install - a package for the installation and maintainance 3 * of non-core utilities. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 5 unchanged lines hidden (view full) --- 14 * Jordan K. Hubbard 15 * 18 July 1993 16 * 17 * This is the main body of the add module. 18 * 19 */ 20 21#include <sys/cdefs.h> | 1/* 2 * FreeBSD install - a package for the installation and maintainance 3 * of non-core utilities. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 5 unchanged lines hidden (view full) --- 14 * Jordan K. Hubbard 15 * 18 July 1993 16 * 17 * This is the main body of the add module. 18 * 19 */ 20 21#include <sys/cdefs.h> |
22__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/add/perform.c 195346 2009-07-05 06:14:59Z brian $"); | 22__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/add/perform.c 206043 2010-04-01 14:27:29Z flz $"); |
23 24#include <err.h> 25#include <paths.h> 26#include "lib.h" 27#include "add.h" 28 29#include <libgen.h> 30#include <signal.h> --- 42 unchanged lines hidden (view full) --- 73 int inPlace, conflictsfound, errcode; 74 /* support for separate pre/post install scripts */ 75 int new_m = 0; 76 char pre_script[FILENAME_MAX] = INSTALL_FNAME; 77 char post_script[FILENAME_MAX]; 78 char pre_arg[FILENAME_MAX], post_arg[FILENAME_MAX]; 79 char *conflict[2]; 80 char **matched; | 23 24#include <err.h> 25#include <paths.h> 26#include "lib.h" 27#include "add.h" 28 29#include <libgen.h> 30#include <signal.h> --- 42 unchanged lines hidden (view full) --- 73 int inPlace, conflictsfound, errcode; 74 /* support for separate pre/post install scripts */ 75 int new_m = 0; 76 char pre_script[FILENAME_MAX] = INSTALL_FNAME; 77 char post_script[FILENAME_MAX]; 78 char pre_arg[FILENAME_MAX], post_arg[FILENAME_MAX]; 79 char *conflict[2]; 80 char **matched; |
81 int fd; |
|
81 82 conflictsfound = 0; 83 code = 0; 84 zapLogDir = 0; 85 LogDir[0] = '\0'; 86 strcpy(playpen, FirstPen); 87 inPlace = 0; 88 --- 314 unchanged lines hidden (view full) --- 403 printf(" - already installed.\n"); 404 } 405 } /* if (!IgnoreDeps) */ 406 407 if (code != 0) 408 goto bomb; 409 410 /* Look for the requirements file */ | 82 83 conflictsfound = 0; 84 code = 0; 85 zapLogDir = 0; 86 LogDir[0] = '\0'; 87 strcpy(playpen, FirstPen); 88 inPlace = 0; 89 --- 314 unchanged lines hidden (view full) --- 404 printf(" - already installed.\n"); 405 } 406 } /* if (!IgnoreDeps) */ 407 408 if (code != 0) 409 goto bomb; 410 411 /* Look for the requirements file */ |
411 if (fexists(REQUIRE_FNAME)) { 412 vsystem("/bin/chmod +x %s", REQUIRE_FNAME); /* be sure */ | 412 if ((fd = open(REQUIRE_FNAME, O_RDWR)) != -1) { 413 fstat(fd, &sb); 414 fchmod(fd, sb.st_mode | S_IXALL); /* be sure, chmod a+x */ 415 close(fd); |
413 if (Verbose) 414 printf("Running requirements file first for %s..\n", Plist.name); 415 if (!Fake && vsystem("./%s %s INSTALL", REQUIRE_FNAME, Plist.name)) { 416 warnx("package %s fails requirements %s", pkg_fullname, 417 Force ? "installing anyway" : "- not installed"); 418 if (!Force) { 419 code = 1; 420 goto success; /* close enough for government work */ --- 15 unchanged lines hidden (view full) --- 436 if (fexists(INSTALL_FNAME)) { 437 sprintf(post_script, "%s", INSTALL_FNAME); 438 sprintf(pre_arg, "PRE-INSTALL"); 439 sprintf(post_arg, "POST-INSTALL"); 440 } 441 } 442 443 /* If we're really installing, and have an installation file, run it */ | 416 if (Verbose) 417 printf("Running requirements file first for %s..\n", Plist.name); 418 if (!Fake && vsystem("./%s %s INSTALL", REQUIRE_FNAME, Plist.name)) { 419 warnx("package %s fails requirements %s", pkg_fullname, 420 Force ? "installing anyway" : "- not installed"); 421 if (!Force) { 422 code = 1; 423 goto success; /* close enough for government work */ --- 15 unchanged lines hidden (view full) --- 439 if (fexists(INSTALL_FNAME)) { 440 sprintf(post_script, "%s", INSTALL_FNAME); 441 sprintf(pre_arg, "PRE-INSTALL"); 442 sprintf(post_arg, "POST-INSTALL"); 443 } 444 } 445 446 /* If we're really installing, and have an installation file, run it */ |
444 if (!NoInstall && fexists(pre_script)) { 445 vsystem("/bin/chmod +x %s", pre_script); /* make sure */ | 447 if (!NoInstall && (fd = open(pre_script, O_RDWR)) != -1) { 448 fstat(fd, &sb); 449 fchmod(fd, sb.st_mode | S_IXALL); /* be sure, chmod a+x */ 450 close(fd); |
446 if (Verbose) 447 printf("Running pre-install for %s..\n", Plist.name); 448 if (!Fake && vsystem("./%s %s %s", pre_script, Plist.name, pre_arg)) { 449 warnx("install script returned error status"); 450 unlink(pre_script); 451 code = 1; 452 goto success; /* nothing to uninstall yet */ 453 } --- 11 unchanged lines hidden (view full) --- 465 printf("mtree -U -f %s -d -e -p %s >%s\n", MTREE_FNAME, p ? p->name : "/", _PATH_DEVNULL); 466 if (!Fake) { 467 if (vsystem("/usr/sbin/mtree -U -f %s -d -e -p %s >%s", MTREE_FNAME, p ? p->name : "/", _PATH_DEVNULL)) 468 warnx("mtree returned a non-zero status - continuing"); 469 } 470 } 471 472 /* Run the installation script one last time? */ | 451 if (Verbose) 452 printf("Running pre-install for %s..\n", Plist.name); 453 if (!Fake && vsystem("./%s %s %s", pre_script, Plist.name, pre_arg)) { 454 warnx("install script returned error status"); 455 unlink(pre_script); 456 code = 1; 457 goto success; /* nothing to uninstall yet */ 458 } --- 11 unchanged lines hidden (view full) --- 470 printf("mtree -U -f %s -d -e -p %s >%s\n", MTREE_FNAME, p ? p->name : "/", _PATH_DEVNULL); 471 if (!Fake) { 472 if (vsystem("/usr/sbin/mtree -U -f %s -d -e -p %s >%s", MTREE_FNAME, p ? p->name : "/", _PATH_DEVNULL)) 473 warnx("mtree returned a non-zero status - continuing"); 474 } 475 } 476 477 /* Run the installation script one last time? */ |
473 if (!NoInstall && fexists(post_script)) { 474 vsystem("/bin/chmod +x %s", post_script); /* make sure */ | 478 if (!NoInstall && (fd = open(post_script, O_RDWR)) != -1) { 479 fstat(fd, &sb); 480 fchmod(fd, sb.st_mode | S_IXALL); /* be sure, chmod a+x */ 481 close(fd); |
475 if (Verbose) 476 printf("Running post-install for %s..\n", Plist.name); 477 if (!Fake && vsystem("./%s %s %s", post_script, Plist.name, post_arg)) { 478 warnx("install script returned error status"); 479 unlink(post_script); 480 code = 1; 481 goto fail; 482 } --- 15 unchanged lines hidden (view full) --- 498 if (make_hierarchy(LogDir)) { 499 warnx("can't record package into '%s', you're on your own!", 500 LogDir); 501 bzero(LogDir, FILENAME_MAX); 502 code = 1; 503 goto success; /* close enough for government work */ 504 } 505 /* Make sure pkg_info can read the entry */ | 482 if (Verbose) 483 printf("Running post-install for %s..\n", Plist.name); 484 if (!Fake && vsystem("./%s %s %s", post_script, Plist.name, post_arg)) { 485 warnx("install script returned error status"); 486 unlink(post_script); 487 code = 1; 488 goto fail; 489 } --- 15 unchanged lines hidden (view full) --- 505 if (make_hierarchy(LogDir)) { 506 warnx("can't record package into '%s', you're on your own!", 507 LogDir); 508 bzero(LogDir, FILENAME_MAX); 509 code = 1; 510 goto success; /* close enough for government work */ 511 } 512 /* Make sure pkg_info can read the entry */ |
506 vsystem("/bin/chmod a+rx %s", LogDir); | 513 fd = open(LogDir, O_RDWR); 514 fstat(fd, &sb); 515 fchmod(fd, sb.st_mode | S_IRALL | S_IXALL); /* be sure, chmod a+rx */ 516 close(fd); |
507 move_file(".", DESC_FNAME, LogDir); 508 move_file(".", COMMENT_FNAME, LogDir); 509 if (fexists(INSTALL_FNAME)) 510 move_file(".", INSTALL_FNAME, LogDir); 511 if (fexists(POST_INSTALL_FNAME)) 512 move_file(".", POST_INSTALL_FNAME, LogDir); 513 if (fexists(DEINSTALL_FNAME)) 514 move_file(".", DEINSTALL_FNAME, LogDir); --- 176 unchanged lines hidden --- | 517 move_file(".", DESC_FNAME, LogDir); 518 move_file(".", COMMENT_FNAME, LogDir); 519 if (fexists(INSTALL_FNAME)) 520 move_file(".", INSTALL_FNAME, LogDir); 521 if (fexists(POST_INSTALL_FNAME)) 522 move_file(".", POST_INSTALL_FNAME, LogDir); 523 if (fexists(DEINSTALL_FNAME)) 524 move_file(".", DEINSTALL_FNAME, LogDir); --- 176 unchanged lines hidden --- |