X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=zpm-runscript.c;fp=zpm-runscript.c;h=06d0c701bde537cd86aef6513c58cd3803301a1b;hb=b1e87f6766c86bb68072a3d01752a96ad1134542;hp=b0b0e29d276b99fbed8015222de863397f754fa0;hpb=475ad7d35c0461a28dcdb37191296a4fdeb596fb;p=zpackage diff --git a/zpm-runscript.c b/zpm-runscript.c index b0b0e29..06d0c70 100644 --- a/zpm-runscript.c +++ b/zpm-runscript.c @@ -148,7 +148,6 @@ int main(int ac, char **av){ 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 ? */ @@ -159,6 +158,7 @@ int main(int ac, char **av){ if (argn + 1 <= ac) { args[2] = av[argn+1]; } + if (rootdir) { if (chdir(rootdir) == -1) { perror("can not chdir to rootdir"); @@ -179,6 +179,12 @@ int main(int ac, char **av){ 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);