Add missing -c/-v options to bundle-add, bundle-remove, and search

These three subcommands should support the -c and -v options, since they
all query the version file and may download update content.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
This commit is contained in:
Patrick McCarty
2016-04-04 11:42:18 -07:00
parent 305756fd49
commit 577e323e29
3 changed files with 57 additions and 3 deletions
+19 -1
View File
@@ -45,6 +45,8 @@ static void print_help(const char *name)
printf("Help Options:\n");
printf(" -h, --help Show help options\n");
printf(" -u, --url=[URL] RFC-3986 encoded url for version string and content file downloads\n");
printf(" -c, --contenturl=[URL] RFC-3986 encoded url for content file downloads\n");
printf(" -v, --versionurl=[URL] RFC-3986 encoded url for version string download\n");
printf(" -P, --port=[port #] Port number to connect to at the url for version string and content file downloads\n");
printf(" -p, --path=[PATH...] Use [PATH...] as the path to verify (eg: a chroot or btrfs subvol\n");
printf(" -F, --format=[staging,1,2,etc.] the format suffix for version file downloads\n");
@@ -56,6 +58,8 @@ static void print_help(const char *name)
static const struct option prog_opts[] = {
{ "help", no_argument, 0, 'h' },
{ "url", required_argument, 0, 'u' },
{ "contenturl", required_argument, 0, 'c' },
{ "versionurl", required_argument, 0, 'v' },
{ "port", required_argument, 0, 'P' },
{ "list", no_argument, 0, 'l' },
{ "path", required_argument, 0, 'p' },
@@ -68,7 +72,7 @@ static bool parse_options(int argc, char **argv)
{
int opt;
while ((opt = getopt_long(argc, argv, "hxu:P:p:F:l", prog_opts, NULL)) != -1) {
while ((opt = getopt_long(argc, argv, "hxu:c:v:P:p:F:l", prog_opts, NULL)) != -1) {
switch (opt) {
case '?':
case 'h':
@@ -82,6 +86,20 @@ static bool parse_options(int argc, char **argv)
set_version_url(optarg);
set_content_url(optarg);
break;
case 'c':
if (!optarg) {
printf("Invalid --contenturl argument\n\n");
goto err;
}
set_content_url(optarg);
break;
case 'v':
if (!optarg) {
printf("Invalid --versionurl argument\n\n");
goto err;
}
set_version_url(optarg);
break;
case 'p': /* default empty path_prefix verifies the running OS */
if (!optarg) {
printf("Invalid --path argument\n\n");
+19 -1
View File
@@ -46,6 +46,8 @@ static void print_help(const char *name)
printf(" -h, --help Show help options\n");
printf(" -p, --path=[PATH...] Use [PATH...] as the path to verify (eg: a chroot or btrfs subvol\n");
printf(" -u, --url=[URL] RFC-3986 encoded url for version string and content file downloads\n");
printf(" -c, --contenturl=[URL] RFC-3986 encoded url for content file downloads\n");
printf(" -v, --versionurl=[URL] RFC-3986 encoded url for version string download\n");
printf(" -P, --port=[port #] Port number to connect to at the url for version string and content file downloads\n");
printf(" -x, --force Attempt to proceed even if non-critical errors found\n");
printf("\n");
@@ -55,6 +57,8 @@ static const struct option prog_opts[] = {
{ "help", no_argument, 0, 'h' },
{ "path", required_argument, 0, 'p' },
{ "url", required_argument, 0, 'u' },
{ "contenturl", required_argument, 0, 'c' },
{ "versionurl", required_argument, 0, 'v' },
{ "port", required_argument, 0, 'P' },
{ "force", no_argument, 0, 'x' },
{ 0, 0, 0, 0 }
@@ -64,7 +68,7 @@ static bool parse_options(int argc, char **argv)
{
int opt;
while ((opt = getopt_long(argc, argv, "hxp:u:P:", prog_opts, NULL)) != -1) {
while ((opt = getopt_long(argc, argv, "hxp:u:c:v:P:", prog_opts, NULL)) != -1) {
switch (opt) {
case '?':
case 'h':
@@ -88,6 +92,20 @@ static bool parse_options(int argc, char **argv)
set_version_url(optarg);
set_content_url(optarg);
break;
case 'c':
if (!optarg) {
printf("Invalid --contenturl argument\n\n");
goto err;
}
set_content_url(optarg);
break;
case 'v':
if (!optarg) {
printf("Invalid --versionurl argument\n\n");
goto err;
}
set_version_url(optarg);
break;
case 'P':
if (sscanf(optarg, "%ld", &update_server_port) != 1) {
printf("Invalid --port argument\n\n");
+19 -1
View File
@@ -65,6 +65,8 @@ static void print_help(const char *name)
printf(" -d, --display-files Output full file list, no search done\n");
printf(" -i, --init Download all manifests then return, no search done\n");
printf(" -u, --url=[URL] RFC-3986 encoded url for version string and content file downloads\n");
printf(" -c, --contenturl=[URL] RFC-3986 encoded url for content file downloads\n");
printf(" -v, --versionurl=[URL] RFC-3986 encoded url for version string download\n");
printf(" -P, --port=[port #] Port number to connect to at the url for version string and content file downloads\n");
printf(" -p, --path=[PATH...] Use [PATH...] as the path to verify (eg: a chroot or btrfs subvol\n");
printf(" -F, --format=[staging,1,2,etc.] the format suffix for version file downloads\n");
@@ -77,6 +79,8 @@ static void print_help(const char *name)
static const struct option prog_opts[] = {
{ "help", no_argument, 0, 'h' },
{ "url", required_argument, 0, 'u' },
{ "contenturl", required_argument, 0, 'c' },
{ "versionurl", required_argument, 0, 'v' },
{ "library", no_argument, 0, 'l' },
{ "binary", no_argument, 0, 'b' },
{ "scope", required_argument, 0, 's' },
@@ -92,7 +96,7 @@ static bool parse_options(int argc, char **argv)
{
int opt;
while ((opt = getopt_long(argc, argv, "hu:P:p:F:s:lbid", prog_opts, NULL)) != -1) {
while ((opt = getopt_long(argc, argv, "hu:c:v:P:p:F:s:lbid", prog_opts, NULL)) != -1) {
switch (opt) {
case '?':
case 'h':
@@ -106,6 +110,20 @@ static bool parse_options(int argc, char **argv)
set_version_url(optarg);
set_content_url(optarg);
break;
case 'c':
if (!optarg) {
printf("Invalid --contenturl argument\n\n");
goto err;
}
set_content_url(optarg);
break;
case 'v':
if (!optarg) {
printf("Invalid --versionurl argument\n\n");
goto err;
}
set_version_url(optarg);
break;
case 'P':
if (sscanf(optarg, "%ld", &update_server_port) != 1) {
printf("Invalid --port argument\n\n");