[LEDE-DEV] [RFC 08/13] procd: remove code that has become unnecessary after sysupgrade changes
Matthias Schiffer
mschiffer at universe-factory.net
Sun Apr 23 17:06:57 PDT 2017
Signed-off-by: Matthias Schiffer <mschiffer at universe-factory.net>
Note: obviously, this patch should go into the procd repo when it is
actually applied; it is provided like this for now to allow easier testing
of the whole series.
---
...-that-has-become-unnecessary-after-sysupg.patch | 120 +++++++++++++++++++++
1 file changed, 120 insertions(+)
create mode 100644 package/system/procd/patches/0004-Remove-code-that-has-become-unnecessary-after-sysupg.patch
diff --git a/package/system/procd/patches/0004-Remove-code-that-has-become-unnecessary-after-sysupg.patch b/package/system/procd/patches/0004-Remove-code-that-has-become-unnecessary-after-sysupg.patch
new file mode 100644
index 0000000000..94cfa8e630
--- /dev/null
+++ b/package/system/procd/patches/0004-Remove-code-that-has-become-unnecessary-after-sysupg.patch
@@ -0,0 +1,120 @@
+From b776d938d6eeb0a6c005e1a6ea2fa2c0d18ba986 Mon Sep 17 00:00:00 2001
+Message-Id: <b776d938d6eeb0a6c005e1a6ea2fa2c0d18ba986.1492975837.git.mschiffer at universe-factory.net>
+In-Reply-To: <3462ccc0c91964ec92c1c61cde803a6504b2fb24.1492975837.git.mschiffer at universe-factory.net>
+References: <3462ccc0c91964ec92c1c61cde803a6504b2fb24.1492975837.git.mschiffer at universe-factory.net>
+From: Matthias Schiffer <mschiffer at universe-factory.net>
+Date: Sun, 23 Apr 2017 19:06:12 +0200
+Subject: [PATCH 4/4] Remove code that has become unnecessary after sysupgrade
+ changes
+
+Signed-off-by: Matthias Schiffer <mschiffer at universe-factory.net>
+---
+ 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.12.2
+
--
2.12.2
More information about the Lede-dev
mailing list