Remove code that has become unnecessary after sysupgrade changes
authorMatthias Schiffer <mschiffer@universe-factory.net>
Sun, 23 Apr 2017 17:06:12 +0000 (19:06 +0200)
committerMatthias Schiffer <mschiffer@universe-factory.net>
Mon, 29 May 2017 19:43:55 +0000 (21:43 +0200)
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
procd.h
service/instance.c
system.c
upgraded/upgraded.c

diff --git a/procd.h b/procd.h
index 88886a3..5aa3aea 100644 (file)
--- a/procd.h
+++ b/procd.h
@@ -27,7 +27,6 @@
 #define __init __attribute__((constructor))
 
 extern char *ubus_socket;
-extern int upgrade_running;
 
 void procd_connect_ubus(void);
 void procd_reconnect_ubus(int reconnect);
index 677f8eb..e5c4830 100644 (file)
@@ -525,8 +525,6 @@ instance_exit(struct uloop_process *p, int ret)
        runtime = tp.tv_sec - in->start.tv_sec;
 
        DEBUG(2, "Instance %s::%s exit with error code %d after %ld seconds\n", in->srv->name, in->name, ret, runtime);
-       if (upgrade_running)
-               return;
 
        uloop_timeout_cancel(&in->timeout);
        service_event("instance.stop", in->srv->name, in->name);
index 69ba57e..dc509ff 100644 (file)
--- a/system.c
+++ b/system.c
@@ -34,8 +34,6 @@ static struct blob_buf b;
 static int notify;
 static struct ubus_context *_ctx;
 
-int upgrade_running = 0;
-
 static int system_board(struct ubus_context *ctx, struct ubus_object *obj,
                  struct ubus_request_data *req, const char *method,
                  struct blob_attr *msg)
@@ -235,14 +233,6 @@ static int system_info(struct ubus_context *ctx, struct ubus_object *obj,
        return UBUS_STATUS_OK;
 }
 
-static int system_upgrade(struct ubus_context *ctx, struct ubus_object *obj,
-                       struct ubus_request_data *req, const char *method,
-                       struct blob_attr *msg)
-{
-       upgrade_running = 1;
-       return 0;
-}
-
 static int system_reboot(struct ubus_context *ctx, struct ubus_object *obj,
                         struct ubus_request_data *req, const char *method,
                         struct blob_attr *msg)
@@ -413,11 +403,9 @@ procd_subscribe_cb(struct ubus_context *ctx, struct ubus_object *obj)
 static const struct ubus_method system_methods[] = {
        UBUS_METHOD_NOARG("board", system_board),
        UBUS_METHOD_NOARG("info",  system_info),
-       UBUS_METHOD_NOARG("upgrade", system_upgrade),
        UBUS_METHOD_NOARG("reboot", system_reboot),
        UBUS_METHOD("watchdog", watchdog_set, watchdog_policy),
        UBUS_METHOD("signal", proc_signal, signal_policy),
-       UBUS_METHOD("nandupgrade", sysupgrade, sysupgrade_policy),
        UBUS_METHOD("sysupgrade", sysupgrade, sysupgrade_policy),
 };
 
index 303edb7..79ebd37 100644 (file)
@@ -41,10 +41,10 @@ static void upgrade_proc_cb(struct uloop_process *proc, int ret)
 
 static void sysupgrade(char *path, char *command)
 {
-       char *args[] = { "/sbin/sysupgrade", "nand", NULL, NULL, NULL };
+       char *args[] = { "/lib/upgrade/stage2", NULL, NULL, NULL };
 
-       args[2] = path;
-       args[3] = command;
+       args[1] = path;
+       args[2] = command;
        upgrade_proc.cb = upgrade_proc_cb;
        upgrade_proc.pid = fork();
        if (!upgrade_proc.pid) {
@@ -81,14 +81,14 @@ int main(int argc, char **argv)
        }
        close(fd);
 
-       if (argc != 2 && argc != 3) {
+       if (argc != 3) {
                fprintf(stderr, "sysupgrade stage 2 failed, invalid command line\n");
                return -1;
        }
 
        uloop_init();
        watchdog_init(0);
-       sysupgrade(argv[1], (argc == 3) ? argv[2] : NULL);
+       sysupgrade(argv[1], argv[2]);
        uloop_run();
 
        reboot(RB_AUTOBOOT);