Browse Source

Remove code that has become unnecessary after sysupgrade changes

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Matthias Schiffer 7 years ago
parent
commit
5b1fb35427
4 changed files with 5 additions and 20 deletions
  1. 0 1
      procd.h
  2. 0 2
      service/instance.c
  3. 0 12
      system.c
  4. 5 5
      upgraded/upgraded.c

+ 0 - 1
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);

+ 0 - 2
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);

+ 0 - 12
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),
 };
 

+ 5 - 5
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);