1 /* opkg.c - the itsy package management system
5 Copyright (C) 2001 University of Southern California
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2, or (at
10 your option) any later version.
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
21 #include "opkg_conf.h"
24 int main(int argc
, const char *argv
[])
30 opkg_conf_t opkg_conf
;
36 optind
= args_parse(&args
, argc
, argv
);
37 if (optind
== argc
|| optind
< 0) {
38 args_usage("opkg must have one sub-command argument");
41 cmd_name
= argv
[optind
++];
43 err
= opkg_conf_init(&opkg_conf
, &args
);
50 cmd
= opkg_cmd_find(cmd_name
);
52 fprintf(stderr
, "%s: unknown sub-command %s\n", argv
[0], cmd_name
);
56 if (cmd
->requires_args
&& optind
== argc
) {
57 fprintf(stderr
, "%s: the ``%s'' command requires at least one argument\n",
58 __FUNCTION__
, cmd_name
);
62 err
= opkg_cmd_exec(cmd
, &opkg_conf
, argc
- optind
, argv
+ optind
);
65 opkg_message(opkg_conf
, OPKG_NOTICE
, "Succesfully done.\n");
67 opkg_message(opkg_conf
, OPKG_NOTICE
, "Error returned. Return value is %d\n.",err
);
72 /* XXX: FEATURE request: run ldconfig and/or depmod after package needing them are installed or removed */
73 // opkg_global_postinst();
75 opkg_conf_deinit(&opkg_conf
);