fclose(sysupgrade);
- sysupgrade_exec_upgraded(prefix, path, command, NULL);
+ sysupgrade_exec_upgraded(prefix, path, NULL, command, NULL);
while (true)
sleep(1);
enum {
SYSUPGRADE_PATH,
SYSUPGRADE_FORCE,
+ SYSUPGRADE_BACKUP,
SYSUPGRADE_PREFIX,
SYSUPGRADE_COMMAND,
SYSUPGRADE_OPTIONS,
static const struct blobmsg_policy sysupgrade_policy[__SYSUPGRADE_MAX] = {
[SYSUPGRADE_PATH] = { .name = "path", .type = BLOBMSG_TYPE_STRING },
[SYSUPGRADE_FORCE] = { .name = "force", .type = BLOBMSG_TYPE_BOOL },
+ [SYSUPGRADE_BACKUP] = { .name = "backup", .type = BLOBMSG_TYPE_STRING },
[SYSUPGRADE_PREFIX] = { .name = "prefix", .type = BLOBMSG_TYPE_STRING },
[SYSUPGRADE_COMMAND] = { .name = "command", .type = BLOBMSG_TYPE_STRING },
[SYSUPGRADE_OPTIONS] = { .name = "options", .type = BLOBMSG_TYPE_TABLE },
sysupgrade_exec_upgraded(blobmsg_get_string(tb[SYSUPGRADE_PREFIX]),
blobmsg_get_string(tb[SYSUPGRADE_PATH]),
+ tb[SYSUPGRADE_BACKUP] ? blobmsg_get_string(tb[SYSUPGRADE_BACKUP]) : NULL,
tb[SYSUPGRADE_COMMAND] ? blobmsg_get_string(tb[SYSUPGRADE_COMMAND]) : NULL,
tb[SYSUPGRADE_OPTIONS]);
#include <libubox/blobmsg.h>
-void sysupgrade_exec_upgraded(const char *prefix, char *path, char *command,
+void sysupgrade_exec_upgraded(const char *prefix, char *path,
+ const char *backup, char *command,
struct blob_attr *options)
{
char *wdt_fd = watchdog_fd();
setenv("WDTFD", wdt_fd, 1);
}
- setenv("UPGRADE_BACKUP", "/tmp/sysupgrade.tgz", 1);
+ if (backup)
+ setenv("UPGRADE_BACKUP", backup, 1);
blobmsg_for_each_attr(option, options, rem) {
const char *prefix = "UPGRADE_OPT_";
struct blob_attr;
-void sysupgrade_exec_upgraded(const char *prefix, char *path, char *command,
+void sysupgrade_exec_upgraded(const char *prefix, char *path,
+ const char *backup, char *command,
struct blob_attr *options);