X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fwgtpkg-installer.c;h=6738192c0ec3563f05a553c7c420c72687504c96;hb=c41158288f76b4809d01f3ec5028d8be609bb613;hp=b5da59fee5ab431fa20b5911c22179f662f67d9b;hpb=dacfe1eeef622d7db8824392db9b6be877ee6a8c;p=src%2Fapp-framework-main.git diff --git a/src/wgtpkg-installer.c b/src/wgtpkg-installer.c index b5da59f..6738192 100644 --- a/src/wgtpkg-installer.c +++ b/src/wgtpkg-installer.c @@ -1,5 +1,5 @@ /* - Copyright 2015 IoT.bzh + Copyright 2015, 2016, 2017 IoT.bzh author: José Bollo @@ -27,8 +27,11 @@ #include #include +#include + #include "verbose.h" -#include "wgtpkg.h" +#include "wgtpkg-permissions.h" +#include "wgtpkg-xmlsec.h" #include "wgt-info.h" #include "wgtpkg-install.h" @@ -36,6 +39,20 @@ static const char appname[] = "wgtpkg-installer"; static const char *root; static int force; +static void version() +{ + printf( + "\n" + " %s version="AFM_VERSION"\n" + "\n" + " Copyright (C) 2015, 2016, 2017 \"IoT.bzh\"\n" + " AFB comes with ABSOLUTELY NO WARRANTY.\n" + " Licence Apache 2\n" + "\n", + appname + ); +} + static void usage() { printf( @@ -46,6 +63,7 @@ static void usage() " -f force overwriting\n" " -q quiet\n" " -v verbose\n" + " -V version\n" "\n", appname ); @@ -57,13 +75,14 @@ static struct option options[] = { { "help", no_argument, NULL, 'h' }, { "quiet", no_argument, NULL, 'q' }, { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 } }; /* install the widgets of the list */ int main(int ac, char **av) { - int i; + int i, rc; struct wgt_info *ifo; LOGAUTH(appname); @@ -72,7 +91,7 @@ int main(int ac, char **av) force = 0; for (;;) { - i = getopt_long(ac, av, "hfqvp:", options, NULL); + i = getopt_long(ac, av, "hfqvVp:", options, NULL); if (i < 0) break; switch (i) { @@ -89,8 +108,15 @@ int main(int ac, char **av) case 'v': verbosity++; break; + case 'V': + version(); + return 0; case 'p': - grant_permission_list(optarg); + rc = grant_permission_list(optarg); + if (rc < 0) { + ERROR("Can't set granted permission list"); + exit(1); + } break; case ':': ERROR("missing argument value");