]> git.ozlabs.org Git - petitboot/blobdiff - lib/system/system.c
ui/ncurses: Spawn shell in exit handler
[petitboot] / lib / system / system.c
index 6e80b24ec1eaac9176629af6799f292546c668a1..b1121a17a4df6e59ccc9f66541845ed14c49ecb0 100644 (file)
@@ -28,13 +28,24 @@ const struct pb_system_apps pb_system_apps = {
        .wget           = HOST_PROG_WGET,
        .ip             = HOST_PROG_IP,
        .udhcpc         = HOST_PROG_UDHCPC,
+       .vgscan         = HOST_PROG_VGSCAN,
+       .vgchange       = HOST_PROG_VGCHANGE,
+       .pb_plugin      = HOST_PROG_PB_PLUGIN,
+       .pb_exec        = HOST_PROG_PB_EXEC,
+       .sh             = HOST_PROG_SH,
 };
 
+#ifndef TFTP_TYPE
+#define TFTP_TYPE TFTP_TYPE_UNKNOWN
+#endif
+
+enum tftp_type tftp_type = TFTP_TYPE;
+
 int pb_mkdir_recursive(const char *dir)
 {
        struct stat statbuf;
+       int rc, mode = 0755;
        char *str, *sep;
-       int mode = 0755;
 
        if (!*dir)
                return 0;
@@ -51,6 +62,8 @@ int pb_mkdir_recursive(const char *dir)
        str = talloc_strdup(NULL, dir);
        sep = strchr(*str == '/' ? str + 1 : str, '/');
 
+       rc = 0;
+
        while (1) {
 
                /* terminate the path at sep */
@@ -59,7 +72,8 @@ int pb_mkdir_recursive(const char *dir)
 
                if (mkdir(str, mode) && errno != EEXIST) {
                        pb_log("mkdir(%s): %s\n", str, strerror(errno));
-                       return -1;
+                       rc = -1;
+                       break;
                }
 
                if (!sep)
@@ -72,7 +86,7 @@ int pb_mkdir_recursive(const char *dir)
 
        talloc_free(str);
 
-       return 0;
+       return rc;
 }
 
 int pb_rmdir_recursive(const char *base, const char *dir)
@@ -85,12 +99,12 @@ int pb_rmdir_recursive(const char *base, const char *dir)
 
        cur = talloc_strdup(NULL, dir);
 
-       while (strcmp(base, dir)) {
+       while (strcmp(base, cur)) {
 
-               rmdir(dir);
+               rmdir(cur);
 
                /* null-terminate at the last slash */
-               pos = strrchr(dir, '/');
+               pos = strrchr(cur, '/');
                if (!pos)
                        break;