pkgid = zpm_findpkg(&zpm, pkgstr);
if (pkgid) {
if (zpm_script_hash(&zpm, pkgid, phase, hash)) {
- rv = zpm_extract(&zpm, hash, script, 0700);
/* perhaps also pass in the phase name? or ENV? */
/* TODO sanitize environment ? */
if (argn + 1 <= ac) {
args[2] = av[argn+1];
}
+
if (rootdir) {
if (chdir(rootdir) == -1) {
perror("can not chdir to rootdir");
exit(EXIT_FAILURE);
}
}
+
+ if (!zpm_extract(&zpm, hash, script, 0700)) {
+ fprintf(stderr, "unable to extract script");
+ exit(EXIT_FAILURE);
+ }
+
rv = run(script, args, output, &status);
if (rv) {
// cat(output);