aboutsummaryrefslogtreecommitdiffstats
path: root/src/main-wgtpkg-pack.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2020-02-27 17:12:55 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2020-02-28 12:39:07 +0100
commit956e7c57d15bde67d7392aab01a9c0fc6906bbd4 (patch)
tree57ab4679060160c510fc45f92e20f0e5df8fdc9c /src/main-wgtpkg-pack.c
parentc5d922d7085c980edad3764687e2488a1b0907d0 (diff)
Add feature of autosigning widgets
This adds the ability to automatically sign the widgets that are packaged. This is done by defining in the environment of the packaging process the variables WGTPKG_AUTOSIGN_X=key-filepath[:cert-filepath]... Where X is a number. If such variable exist, signatures are generated in the directory of the packaged or signed widget, one for each variable, replacing any existing one. Obviously, nothing is done if no such variable exist. The generated signature file depends on X. - 0 is for file author-signature.xml - X is for file signature-X.xml The program wgtpkg-pack automatically include that behaviour by default. An option allows to remove it. Bug-AGL: SPEC-2840 Change-Id: I00bc4a4d094f71b307e467f984f20d3d4cc3c7bd Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/main-wgtpkg-pack.c')
-rw-r--r--src/main-wgtpkg-pack.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/main-wgtpkg-pack.c b/src/main-wgtpkg-pack.c
index e448497..5e9a18f 100644
--- a/src/main-wgtpkg-pack.c
+++ b/src/main-wgtpkg-pack.c
@@ -31,6 +31,7 @@
#include "wgtpkg-files.h"
#include "wgtpkg-workdir.h"
#include "wgtpkg-zip.h"
+#include "wgtpkg-digsig.h"
const char appname[] = "wgtpkg-pack";
@@ -55,7 +56,9 @@ static void usage()
"\n"
" -o wgtfile the output widget file\n"
" -f force overwriting\n"
+ " -N no auto-sign"
" -q quiet\n"
+ " -S auto-sign"
" -v verbose\n"
" -V version\n"
"\n",
@@ -67,7 +70,9 @@ static struct option options[] = {
{ "output", required_argument, NULL, 'o' },
{ "force", no_argument, NULL, 'f' },
{ "help", no_argument, NULL, 'h' },
+ { "no-auto-sign",no_argument, NULL, 'N' },
{ "quiet", no_argument, NULL, 'q' },
+ { "auto-sign", no_argument, NULL, 'S' },
{ "verbose", no_argument, NULL, 'v' },
{ "version", no_argument, NULL, 'V' },
{ NULL, 0, NULL, 0 }
@@ -76,12 +81,13 @@ static struct option options[] = {
/* install the widgets of the list */
int main(int ac, char **av)
{
- int i, force;
+ int i, force, autosign;
char *wgtfile, *directory, *x;
struct stat s;
LOGUSER(appname);
+ autosign = 1;
force = 0;
wgtfile = directory = NULL;
for (;;) {
@@ -105,9 +111,15 @@ int main(int ac, char **av)
case 'h':
usage();
return 0;
+ case 'N':
+ autosign = 0;
+ break;
case 'V':
version();
return 0;
+ case 'S':
+ autosign = 1;
+ break;
case ':':
ERROR("missing argument");
return 1;
@@ -174,10 +186,12 @@ int main(int ac, char **av)
if (set_workdir(".", 0))
return 1;
-
if (fill_files())
return 1;
+ if (autosign && create_auto_digsig() < 0)
+ return 1;
+
return !!zwrite(wgtfile);
}