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);
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)
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)
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),
};
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) {
}
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);