+
+ if (rootdir) {
+ if (chdir(rootdir) == -1) {
+ perror("can not chdir to rootdir");
+ exit(EXIT_FAILURE);
+ }
+ if (geteuid() == 0) {
+ /* chroot is deprecated, and not in
+ * posix. need to use OS/kernel
+ * specific code.
+ */
+ fprintf(stderr, "support for chroot equivalent not supported on this OS\n");
+ } else {
+ fprintf(stderr, "unable to chroot as non root user\n");
+ }
+ } else {
+ if (chdir("/") == -1) {
+ perror("can not chdir to /");
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (!zpm_extract(&zpm, hash, script, 0700)) {
+ fprintf(stderr, "unable to extract script");
+ exit(EXIT_FAILURE);
+ }
+