mirror of
https://github.com/clearlinux/swupd-server.git
synced 2026-08-19 04:57:43 +00:00
Require the -F option for swupd_create_update
To decrease chances of specifying an incorrect format number, since the default is a hardcoded value "3", always require the user to pass the -F option to swupd_create_update. In the future, it would be nice to read the default value from a config file, with the -F option overriding the value. Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
// SWUPD_NUM_PACKS is also "PREV_CHECK" in releas tool swupd_bb.py (change both)
|
||||
#define SWUPD_NUM_PACKS 4
|
||||
#define SWUPD_NUM_MANIFEST_DELTAS 25
|
||||
#define SWUPD_DEFAULT_FORMAT 3
|
||||
|
||||
#define SWUPD_SERVER_STATE_DIR "/var/lib/update"
|
||||
|
||||
|
||||
+2
-1
@@ -79,7 +79,8 @@ bool set_state_dir(char *dir)
|
||||
bool init_globals(void)
|
||||
{
|
||||
if (format == -1) {
|
||||
format = SWUPD_DEFAULT_FORMAT;
|
||||
printf("Error: Missing format parameter. Please specify a format with -F.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!init_state_globals()) {
|
||||
|
||||
+2
-2
@@ -69,7 +69,7 @@ static void print_help(const char *name)
|
||||
printf("Application Options:\n");
|
||||
printf(" -o, --osversion The OS version for which to create an update\n");
|
||||
printf(" -m, --minversion Optional minimum file version to write into manifests per file\n");
|
||||
printf(" -F, --format Optional format string [ default:=%d ]\n", SWUPD_DEFAULT_FORMAT);
|
||||
printf(" -F, --format Format number for the update\n");
|
||||
printf(" -g, --getformat Print current format string and exit\n");
|
||||
printf(" -S, --statedir Optional directory to use for state [ default:=%s ]\n", SWUPD_SERVER_STATE_DIR);
|
||||
printf(" -s, --signcontent Enables cryptographic signing of update content\n");
|
||||
@@ -118,7 +118,7 @@ static bool parse_options(int argc, char **argv)
|
||||
break;
|
||||
case 'g':
|
||||
if (format == -1) {
|
||||
printf("%d\n", SWUPD_DEFAULT_FORMAT);
|
||||
printf("No format specified\n");
|
||||
} else {
|
||||
printf("%llu\n", format);
|
||||
free_globals();
|
||||
|
||||
Reference in New Issue
Block a user