4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
8 http://www.apache.org/licenses/LICENSE-2.0
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
32 static const char appname[] = "wgtpkg-install";
33 static const char *root;
39 "usage: %s [-f] [-q] [-v] [-p list] rootdir wgtfile...\n"
41 " rootdir the root directory for installing\n"
42 " -p list a list of comma separated permissions to allow\n"
43 " -f force overwriting\n"
51 static struct option options[] = {
52 { "permissions", required_argument, NULL, 'p' },
53 { "force", no_argument, NULL, 'f' },
54 { "help", no_argument, NULL, 'h' },
55 { "quiet", no_argument, NULL, 'q' },
56 { "verbose", no_argument, NULL, 'v' },
60 /* install the widgets of the list */
61 int main(int ac, char **av)
66 openlog(appname, LOG_PERROR, LOG_AUTH);
72 i = getopt_long(ac, av, "hfqvp:", options, NULL);
90 grant_permission_list(optarg);
93 syslog(LOG_ERR, "missing argument value");
96 syslog(LOG_ERR, "unrecognized option");
103 syslog(LOG_ERR, "arguments are missing");
107 /* canonic names for files */
109 for (i = 0 ; av[i] != NULL ; i++) {
110 wpath = realpath(av[i], NULL);
112 syslog(LOG_ERR, "error while getting realpath of %dth widget: %s", i+1, av[i]);
119 /* install widgets */
121 install_widget(*av, root, force);