apk: new option --print-arch
Simply print the default arch and exit. This is so scripts don't need to parse the output of -V.cute-signatures
parent
a99bedba6f
commit
b06a43a465
10
src/apk.c
10
src/apk.c
|
@ -70,6 +70,7 @@ static struct apk_option generic_options[] = {
|
||||||
{ 0x111, "overlay-from-stdin", "Read list of overlay files from stdin" },
|
{ 0x111, "overlay-from-stdin", "Read list of overlay files from stdin" },
|
||||||
{ 0x112, "arch", "Use architecture with --root",
|
{ 0x112, "arch", "Use architecture with --root",
|
||||||
required_argument, "ARCH" },
|
required_argument, "ARCH" },
|
||||||
|
{ 0x114, "print-arch", "Print default arch and exit" },
|
||||||
#ifdef TEST_MODE
|
#ifdef TEST_MODE
|
||||||
{ 0x200, "test-repo", "Repository", required_argument, "REPO" },
|
{ 0x200, "test-repo", "Repository", required_argument, "REPO" },
|
||||||
{ 0x201, "test-instdb", "Installed db", required_argument, "INSTALLED" },
|
{ 0x201, "test-instdb", "Installed db", required_argument, "INSTALLED" },
|
||||||
|
@ -86,6 +87,12 @@ static int version(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int show_arch(void)
|
||||||
|
{
|
||||||
|
puts(APK_DEFAULT_ARCH);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int format_option(char *buf, size_t len, struct apk_option *o,
|
static int format_option(char *buf, size_t len, struct apk_option *o,
|
||||||
const char *separator)
|
const char *separator)
|
||||||
{
|
{
|
||||||
|
@ -418,6 +425,9 @@ int main(int argc, char **argv)
|
||||||
case 0x112:
|
case 0x112:
|
||||||
dbopts.arch = optarg;
|
dbopts.arch = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 0x114:
|
||||||
|
r = show_arch();
|
||||||
|
goto err;
|
||||||
#ifdef TEST_MODE
|
#ifdef TEST_MODE
|
||||||
case 0x200:
|
case 0x200:
|
||||||
*apk_string_array_add(&test_repos) = (char*) optarg;
|
*apk_string_array_add(&test_repos) = (char*) optarg;
|
||||||
|
|
Loading…
Reference in New Issue