4 author: José Bollo <jose.bollo@iot.bzh>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
19 #define _BSD_SOURCE /* see readdir */
29 #include <libxml/tree.h>
32 #include "wgtpkg-workdir.h"
33 #include "wgtpkg-files.h"
34 #include "wgtpkg-zip.h"
35 #include "wgtpkg-digsig.h"
36 #include "wgtpkg-xmlsec.h"
40 static const char appname[] = "wgtpkg-info";
42 static void show(const char *wgtfile);
47 "usage: %s [-f] [-q] [-v] wgtfile...\n"
56 static struct option options[] = {
57 { "help", no_argument, NULL, 'h' },
58 { "quiet", no_argument, NULL, 'q' },
59 { "verbose", no_argument, NULL, 'v' },
63 /* info the widgets of the list */
64 int main(int ac, char **av)
74 i = getopt_long(ac, av, "hqv", options, NULL);
89 ERROR("missing argument value");
92 ERROR("unrecognized option");
97 /* canonic names for files */
99 for (i = 0 ; av[i] != NULL ; i++) {
100 wpath = realpath(av[i], NULL);
102 ERROR("error while getting realpath of %dth widget: %s", i+1, av[i]);
115 static int check_and_show()
117 struct wgt_info *ifo;
119 ifo = wgt_info_createat(workdirfd, NULL, 1, 1, 1);
122 wgt_info_dump(ifo, 1, "");
127 /* install the widget of the file */
128 static void show(const char *wgtfile)
130 NOTICE("-- INFO for widget %s --", wgtfile);
133 if (make_workdir_base("/tmp", "UNPACK", 0)) {
134 ERROR("failed to create a working directory");
138 if (zread(wgtfile, 0))
141 if (check_all_signatures())