/*
- Copyright 2015 IoT.bzh
+ Copyright 2015, 2016 IoT.bzh
+
+ author: José Bollo <jose.bollo@iot.bzh>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
#include <unistd.h>
#include <limits.h>
#include <errno.h>
-#include <syslog.h>
#include <getopt.h>
+#include <libxml/tree.h>
+
#include "verbose.h"
-#include "wgtpkg.h"
+#include "wgtpkg-permissions.h"
+#include "wgtpkg-xmlsec.h"
+#include "wgt-info.h"
+#include "wgtpkg-install.h"
static const char appname[] = "wgtpkg-installer";
static const char *root;
/* install the widgets of the list */
int main(int ac, char **av)
{
- int i;
+ int i, rc;
+ struct wgt_info *ifo;
- openlog(appname, LOG_PERROR, LOG_AUTH);
+ LOGAUTH(appname);
xmlsec_init();
verbosity++;
break;
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");
/* install widgets */
av += optind;
root = *av++;
- for ( ; *av ; av++)
- install_widget(*av, root, force);
+ for ( ; *av ; av++) {
+ ifo = install_widget(*av, root, force);
+ if (ifo)
+ wgt_info_unref(ifo);
+ }
return 0;
}