aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--src/afm-system-daemon.c21
-rw-r--r--src/afm-user-daemon.c21
-rw-r--r--src/wgtpkg-info.c21
-rw-r--r--src/wgtpkg-installer.c21
-rw-r--r--src/wgtpkg-pack.c21
-rw-r--r--src/wgtpkg-sign.c19
7 files changed, 119 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 56ac31d..f8dbdf8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,7 +26,7 @@ include(CTest)
set(PROJECT_NAME "AFM Main")
set(PROJECT_PRETTY_NAME "Application Framework Main")
set(PROJECT_DESCRIPTION "Secured Application framework for Automotive Grade Linux")
-set(PROJECT_VERSION "1.0")
+set(PROJECT_VERSION "4.1")
set(PROJECT_URL "https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/app-framework-main.git;a=summary")
set(USE_LIBZIP ON CACHE BOOL "should try to use libzip?")
@@ -65,6 +65,7 @@ add_definitions(
-DFWK_UNIT_CONF="${afm_confdir}/afm-unit.conf"
-DFWK_USER_APP_DIR_LABEL="${afm_user_appdir_label}"
-DSYSTEMD_UNITS_ROOT="${systemd_units_root}"
+ -DAFM_VERSION="${PROJECT_VERSION}"
)
add_subdirectory(src)
diff --git a/src/afm-system-daemon.c b/src/afm-system-daemon.c
index e0557f4..097913a 100644
--- a/src/afm-system-daemon.c
+++ b/src/afm-system-daemon.c
@@ -39,6 +39,20 @@
static const char appname[] = "afm-system-daemon";
static const char *rootdir = NULL;
+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(
@@ -48,6 +62,7 @@ static void usage()
" -d run as a daemon\n"
" -q quiet\n"
" -v verbose\n"
+ " -V version\n"
"\n",
appname
);
@@ -59,6 +74,7 @@ static struct option options[] = {
{ "quiet", no_argument, NULL, 'q' },
{ "verbose", no_argument, NULL, 'v' },
{ "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, 'V' },
{ NULL, 0, NULL, 0 }
};
@@ -186,11 +202,14 @@ int main(int ac, char **av)
LOGAUTH(appname);
/* interpretation of arguments */
- while ((i = getopt_long(ac, av, "hdqvr:", options, NULL)) >= 0) {
+ while ((i = getopt_long(ac, av, "hdqvVr:", options, NULL)) >= 0) {
switch (i) {
case 'h':
usage();
return 0;
+ case 'V':
+ version();
+ return 0;
case 'q':
if (verbosity)
verbosity--;
diff --git a/src/afm-user-daemon.c b/src/afm-user-daemon.c
index a705381..11a46de 100644
--- a/src/afm-user-daemon.c
+++ b/src/afm-user-daemon.c
@@ -46,6 +46,18 @@
static const char appname[] = "afm-user-daemon";
/*
+ * string for printing version
+ */
+static const char versionstr[] =
+ "\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";
+
+/*
* string for printing usage
*/
static const char usagestr[] =
@@ -64,19 +76,20 @@ static const char usagestr[] =
" -s addr address of system D-Bus to use\n"
" -q quiet\n"
" -v verbose\n"
+ " -V version\n"
"\n";
/*
* Option definition for getopt_long
*/
#ifdef LEGACY_MODE_WITHOUT_SYSTEMD
-static const char options_s[] = "hdqvr:a:m:";
+static const char options_s[] = "hdqvVr:a:m:";
static struct option options_l[] = {
{ "root", required_argument, NULL, 'r' },
{ "application", required_argument, NULL, 'a' },
{ "mode", required_argument, NULL, 'm' },
#else
-static const char options_s[] = "hdqv";
+static const char options_s[] = "hdqvV";
static struct option options_l[] = {
#endif
{ "user-dbus", required_argument, NULL, 'u' },
@@ -85,6 +98,7 @@ static struct option options_l[] = {
{ "quiet", no_argument, NULL, 'q' },
{ "verbose", no_argument, NULL, 'v' },
{ "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, 'V' },
{ NULL, 0, NULL, 0 }
};
@@ -579,6 +593,9 @@ int main(int ac, char **av)
case 'h':
printf(usagestr, appname);
return 0;
+ case 'V':
+ printf(versionstr, appname);
+ return 0;
case 'q':
if (verbosity)
verbosity--;
diff --git a/src/wgtpkg-info.c b/src/wgtpkg-info.c
index f5d1b42..3a6b860 100644
--- a/src/wgtpkg-info.c
+++ b/src/wgtpkg-info.c
@@ -39,6 +39,20 @@ static const char appname[] = "wgtpkg-info";
static void show(const char *wgtfile);
+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 +60,7 @@ static void usage()
"\n"
" -q quiet\n"
" -v verbose\n"
+ " -V version\n"
"\n",
appname
);
@@ -55,6 +70,7 @@ 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 }
};
@@ -69,7 +85,7 @@ int main(int ac, char **av)
xmlsec_init();
for (;;) {
- i = getopt_long(ac, av, "hqv", options, NULL);
+ i = getopt_long(ac, av, "hqvV", options, NULL);
if (i < 0)
break;
switch (i) {
@@ -83,6 +99,9 @@ int main(int ac, char **av)
case 'v':
verbosity++;
break;
+ case 'V':
+ version();
+ return 0;
case ':':
ERROR("missing argument value");
return 1;
diff --git a/src/wgtpkg-installer.c b/src/wgtpkg-installer.c
index 855e28d..6738192 100644
--- a/src/wgtpkg-installer.c
+++ b/src/wgtpkg-installer.c
@@ -39,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(
@@ -49,6 +63,7 @@ static void usage()
" -f force overwriting\n"
" -q quiet\n"
" -v verbose\n"
+ " -V version\n"
"\n",
appname
);
@@ -60,6 +75,7 @@ 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 }
};
@@ -75,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) {
@@ -92,6 +108,9 @@ int main(int ac, char **av)
case 'v':
verbosity++;
break;
+ case 'V':
+ version();
+ return 0;
case 'p':
rc = grant_permission_list(optarg);
if (rc < 0) {
diff --git a/src/wgtpkg-pack.c b/src/wgtpkg-pack.c
index d49680d..0f5f70c 100644
--- a/src/wgtpkg-pack.c
+++ b/src/wgtpkg-pack.c
@@ -34,6 +34,20 @@
const char appname[] = "wgtpkg-pack";
+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(
@@ -43,6 +57,7 @@ static void usage()
" -f force overwriting\n"
" -q quiet\n"
" -v verbose\n"
+ " -V version\n"
"\n",
appname
);
@@ -54,6 +69,7 @@ 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 }
};
@@ -69,7 +85,7 @@ int main(int ac, char **av)
force = 0;
wgtfile = directory = NULL;
for (;;) {
- i = getopt_long(ac, av, "qvhfo:", options, NULL);
+ i = getopt_long(ac, av, "qvVhfo:", options, NULL);
if (i < 0)
break;
switch (i) {
@@ -89,6 +105,9 @@ int main(int ac, char **av)
case 'h':
usage();
return 0;
+ case 'V':
+ version();
+ return 0;
case ':':
ERROR("missing argument");
return 1;
diff --git a/src/wgtpkg-sign.c b/src/wgtpkg-sign.c
index 68f3d5c..2a97a62 100644
--- a/src/wgtpkg-sign.c
+++ b/src/wgtpkg-sign.c
@@ -60,6 +60,20 @@ static unsigned int get_number(const char *value)
return (unsigned int)val;
}
+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(
@@ -72,6 +86,7 @@ static void usage()
" -f force overwriting\n"
" -q quiet\n"
" -v verbose\n"
+ " -V version\n"
"\n",
appname
);
@@ -86,6 +101,7 @@ 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 }
};
@@ -103,7 +119,7 @@ int main(int ac, char **av)
number = UINT_MAX;
keyfile = directory = NULL;
for (;;) {
- i = getopt_long(ac, av, "hfqvak:c:d:", options, NULL);
+ i = getopt_long(ac, av, "hfqvVak:c:d:", options, NULL);
if (i < 0)
break;
switch (i) {
@@ -119,6 +135,7 @@ int main(int ac, char **av)
case 'f': force = 1; continue;
case 'a': author = 1; continue;
case 'h': usage(); return 0;
+ case 'V': version(); return 0;
case 'q':
if (verbosity)
verbosity--;