#endif
fprintf(stdout, " -f\t\tuse force\n");
fprintf(stdout, " -h\t\toutput help\n");
+ fprintf(stdout, " -n\t\tdry-run (don't download or upgrade)\n");
fprintf(stdout, " -r\t\tcheck only for release upgrades\n");
fprintf(stdout, " -F <fstype>\toverride filesystem type\n");
fprintf(stdout, " -y\t\tdon't wait for user confirmation\n");
struct blob_attr *tbr[__REPLY_MAX];
struct blob_attr *tb[__TARGET_MAX] = {}; /* make sure tb is NULL initialized even if blobmsg_parse isn't called */
struct stat imgstat;
- int check_only = 0;
- int retry_delay = 0;
- int upg_check = 0;
+ bool check_only = false;
+ bool retry_delay = false;
+ bool upg_check = false;
+ bool dry_run = false;
int revcmp;
int addargs;
unsigned char argc = 1;
}
if (!strncmp(argv[argc], "-c", 3))
- check_only = 1;
+ check_only = true;
if (!strncmp(argv[argc], "-f", 3))
force = true;
addargs = 1;
}
+ if (!strncmp(argv[argc], "-n", 3))
+ dry_run = true;
+
if (!strncmp(argv[argc], "-r", 3))
release_only = true;
}
use_get = true;
} else if (retry_delay) {
- fputc('\n', stderr);
retry_delay = 0;
}
blobmsg_get_string(tb[TARGET_BINDIR]),
image_name);
- fprintf(stderr, "Downloading image from %s\n", url);
+ if (dry_run) {
+ fprintf(stderr, "\nImage available at %s\n", url);
+ rc = 0;
+ goto freebranches;
+ }
+
+ fprintf(stderr, "\nDownloading image from %s\n", url);
rc = server_request(url, NULL, NULL);
if (rc)
goto freebranches;
fputc('\n', stderr);
}
- /* ToDo */
freeboard:
if (rootfs_type)
free(rootfs_type);