diff options
author | Oliver Eikemeier <eik@FreeBSD.org> | 2004-06-29 19:06:42 +0000 |
---|---|---|
committer | Oliver Eikemeier <eik@FreeBSD.org> | 2004-06-29 19:06:42 +0000 |
commit | b9ba84598dd8244e0e1b884bffe0fb289ada9701 (patch) | |
tree | 1ab5b5afad8e17719ffc614e8b575ec26c5c8bd5 /usr.sbin/pkg_install/add/perform.c | |
parent | 3ed1dfa11d23c58dcb18253956cf17068669e2e0 (diff) |
- pkg_add spawns itself as argv[0] when installing dependent packages, to
enable the use as a port on older systems
- use absolute paths in all calls to external programs, to account for strange
PATH settings
- use INDEX or INDEX-5 depending on FreeBSD version, to enable the use on
FreeBSD 4.x as a port.
- conditionalize all 4.x/5.x differences on __FreeBSD_version, so that the
pkg_install tools can be kept in sync on 4.x and 5.x
- Bump PKG_INSTALL_VERSION
Reviewed by: portmgr (bento run)
MFC after: 4 weeks
Notes
Notes:
svn path=/head/; revision=131285
Diffstat (limited to 'usr.sbin/pkg_install/add/perform.c')
-rw-r--r-- | usr.sbin/pkg_install/add/perform.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/usr.sbin/pkg_install/add/perform.c b/usr.sbin/pkg_install/add/perform.c index 8af962c818c0..1399bd973429 100644 --- a/usr.sbin/pkg_install/add/perform.c +++ b/usr.sbin/pkg_install/add/perform.c @@ -167,7 +167,7 @@ pkg_do(char *pkg) if (!isdir(p->name) && !Fake) { if (Verbose) printf("Desired prefix of %s does not exist, creating..\n", p->name); - vsystem("mkdir -p %s", p->name); + vsystem("/bin/mkdir -p %s", p->name); if (chdir(p->name) == -1) { warn("unable to change directory to '%s'", p->name); goto bomb; @@ -302,7 +302,11 @@ pkg_do(char *pkg) ext = strrchr(pkg_fullname, '.'); if (ext == NULL) +#if defined(__FreeBSD_version) && __FreeBSD_version >= 500039 ext = ".tbz"; +#else + ext = ".tgz"; +#endif snprintf(path, FILENAME_MAX, "%s/%s%s", getenv("_TOP"), p->name, ext); if (fexists(path)) cp = path; @@ -311,7 +315,7 @@ pkg_do(char *pkg) if (cp) { if (Verbose) printf("Loading it from %s.\n", cp); - if (vsystem("pkg_add %s'%s'", Verbose ? "-v " : "", cp)) { + if (vsystem("%s %s'%s'", PkgAddCmd, Verbose ? "-v " : "", cp)) { warnx("autoload of dependency '%s' failed%s", cp, Force ? " (proceeding anyway)" : "!"); if (!Force) @@ -334,7 +338,7 @@ pkg_do(char *pkg) if (!Force) ++code; } - else if (vsystem("(pwd; cat +CONTENTS) | pkg_add %s-S", Verbose ? "-v " : "")) { + else if (vsystem("(pwd; /bin/cat +CONTENTS) | %s %s-S", PkgAddCmd, Verbose ? "-v " : "")) { warnx("pkg_add of dependency '%s' failed%s", p->name, Force ? " (proceeding anyway)" : "!"); if (!Force) @@ -365,7 +369,7 @@ pkg_do(char *pkg) /* Look for the requirements file */ if (fexists(REQUIRE_FNAME)) { - vsystem("chmod +x %s", REQUIRE_FNAME); /* be sure */ + vsystem("/bin/chmod +x %s", REQUIRE_FNAME); /* be sure */ if (Verbose) printf("Running requirements file first for %s..\n", Plist.name); if (!Fake && vsystem("./%s %s INSTALL", REQUIRE_FNAME, Plist.name)) { @@ -398,7 +402,7 @@ pkg_do(char *pkg) /* If we're really installing, and have an installation file, run it */ if (!NoInstall && fexists(pre_script)) { - vsystem("chmod +x %s", pre_script); /* make sure */ + vsystem("/bin/chmod +x %s", pre_script); /* make sure */ if (Verbose) printf("Running pre-install for %s..\n", Plist.name); if (!Fake && vsystem("./%s %s %s", pre_script, Plist.name, pre_arg)) { @@ -427,7 +431,7 @@ pkg_do(char *pkg) /* Run the installation script one last time? */ if (!NoInstall && fexists(post_script)) { - vsystem("chmod +x %s", post_script); /* make sure */ + vsystem("/bin/chmod +x %s", post_script); /* make sure */ if (Verbose) printf("Running post-install for %s..\n", Plist.name); if (!Fake && vsystem("./%s %s %s", post_script, Plist.name, post_arg)) { @@ -457,7 +461,7 @@ pkg_do(char *pkg) goto success; /* close enough for government work */ } /* Make sure pkg_info can read the entry */ - vsystem("chmod a+rx %s", LogDir); + vsystem("/bin/chmod a+rx %s", LogDir); move_file(".", DESC_FNAME, LogDir); move_file(".", COMMENT_FNAME, LogDir); if (fexists(INSTALL_FNAME)) |