system: support passing "options" to the "sysupgrade" ubus method
[project/procd.git] / system.c
index 8ed3f93af481a544b48e5173158f446360499ab6..738f32744f5b1e64ba168179bdc374d9cab9db5d 100644 (file)
--- a/system.c
+++ b/system.c
@@ -380,6 +380,7 @@ enum {
        SYSUPGRADE_PATH,
        SYSUPGRADE_PREFIX,
        SYSUPGRADE_COMMAND,
+       SYSUPGRADE_OPTIONS,
        __SYSUPGRADE_MAX
 };
 
@@ -387,6 +388,7 @@ static const struct blobmsg_policy sysupgrade_policy[__SYSUPGRADE_MAX] = {
        [SYSUPGRADE_PATH] = { .name = "path", .type = BLOBMSG_TYPE_STRING },
        [SYSUPGRADE_PREFIX] = { .name = "prefix", .type = BLOBMSG_TYPE_STRING },
        [SYSUPGRADE_COMMAND] = { .name = "command", .type = BLOBMSG_TYPE_STRING },
+       [SYSUPGRADE_OPTIONS] = { .name = "options", .type = BLOBMSG_TYPE_TABLE },
 };
 
 static int sysupgrade(struct ubus_context *ctx, struct ubus_object *obj,
@@ -404,7 +406,8 @@ static int sysupgrade(struct ubus_context *ctx, struct ubus_object *obj,
 
        sysupgrade_exec_upgraded(blobmsg_get_string(tb[SYSUPGRADE_PREFIX]),
                                 blobmsg_get_string(tb[SYSUPGRADE_PATH]),
-                                tb[SYSUPGRADE_COMMAND] ? blobmsg_get_string(tb[SYSUPGRADE_COMMAND]) : NULL);
+                                tb[SYSUPGRADE_COMMAND] ? blobmsg_get_string(tb[SYSUPGRADE_COMMAND]) : NULL,
+                                tb[SYSUPGRADE_OPTIONS]);
 
        /* sysupgrade_exec_upgraded() will never return unless something has gone wrong */
        return UBUS_STATUS_UNKNOWN_ERROR;