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.
27 #include <libxml/tree.h>
30 #include "wgtpkg-workdir.h"
31 #include "wgtpkg-files.h"
32 #include "wgtpkg-zip.h"
33 #include "wgtpkg-digsig.h"
34 #include "wgtpkg-xmlsec.h"
38 static const char appname[] = "wgtpkg-info";
40 static void show(const char *wgtfile);
45 "usage: %s [-f] [-q] [-v] wgtfile...\n"
54 static struct option options[] = {
55 { "help", no_argument, NULL, 'h' },
56 { "quiet", no_argument, NULL, 'q' },
57 { "verbose", no_argument, NULL, 'v' },
61 /* info the widgets of the list */
62 int main(int ac, char **av)
72 i = getopt_long(ac, av, "hqv", options, NULL);
87 ERROR("missing argument value");
90 ERROR("unrecognized option");
95 /* canonic names for files */
97 for (i = 0 ; av[i] != NULL ; i++) {
98 wpath = realpath(av[i], NULL);
100 ERROR("error while getting realpath of %dth widget: %s", i+1, av[i]);
113 static int check_and_show()
115 struct wgt_info *ifo;
117 ifo = wgt_info_createat(workdirfd, NULL, 1, 1, 1);
120 wgt_info_dump(ifo, 1, "");
125 /* install the widget of the file */
126 static void show(const char *wgtfile)
128 NOTICE("-- INFO for widget %s --", wgtfile);
131 if (make_workdir_base("/tmp", "UNPACK", 0)) {
132 ERROR("failed to create a working directory");
136 if (zread(wgtfile, 0))
139 if (check_all_signatures())