From 5b1fb35427ba36d20c9f2a6b9403d1545b3abee6 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 23 Apr 2017 19:06:12 +0200 Subject: [PATCH] Remove code that has become unnecessary after sysupgrade changes Signed-off-by: Matthias Schiffer --- procd.h | 1 - service/instance.c | 2 -- system.c | 12 ------------ upgraded/upgraded.c | 10 +++++----- 4 files changed, 5 insertions(+), 20 deletions(-) diff --git a/procd.h b/procd.h index 88886a3..5aa3aea 100644 --- 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); diff --git a/service/instance.c b/service/instance.c index 677f8eb..e5c4830 100644 --- a/service/instance.c +++ b/service/instance.c @@ -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); diff --git a/system.c b/system.c index 69ba57e..dc509ff 100644 --- 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), }; diff --git a/upgraded/upgraded.c b/upgraded/upgraded.c index 303edb7..79ebd37 100644 --- a/upgraded/upgraded.c +++ b/upgraded/upgraded.c @@ -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); -- 2.25.1