1 /* opkglib.c - the opkg package management system
5 Copyright (C) 2003 kernel concepts
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.
22 #include "opkg_conf.h"
24 #include "file_util.h"
26 #include "opkg_message.h"
27 #include "opkg_error.h"
29 /* This is used for backward compatibility */
31 opkg_op (int argc, char *argv[])
37 opkg_conf_t opkg_conf;
41 optind = args_parse (&args, argc, argv);
42 if (optind == argc || optind < 0)
44 args_usage ("opkg must have one sub-command argument");
47 cmd_name = argv[optind++];
48 /* Pigi: added a flag to disable the checking of structures if the command does not need to
49 read anything from there.
51 if ( !strcmp(cmd_name,"print-architecture") ||
52 !strcmp(cmd_name,"print_architecture") ||
53 !strcmp(cmd_name,"print-installation-architecture") ||
54 !strcmp(cmd_name,"print_installation_architecture") )
55 args.nocheckfordirorfile = 1;
57 /* Pigi: added a flag to disable the reading of feed files if the command does not need to
58 read anything from there.
60 if ( !strcmp(cmd_name,"flag") ||
61 !strcmp(cmd_name,"configure") ||
62 !strcmp(cmd_name,"remove") ||
63 !strcmp(cmd_name,"files") ||
64 !strcmp(cmd_name,"search") ||
65 !strcmp(cmd_name,"compare_versions") ||
66 !strcmp(cmd_name,"compare-versions") ||
67 !strcmp(cmd_name,"list_installed") ||
68 !strcmp(cmd_name,"list-installed") ||
69 !strcmp(cmd_name,"status") )
70 args.noreadfeedsfile = 1;
73 err = opkg_conf_init (&opkg_conf, &args);
82 cmd = opkg_cmd_find (cmd_name);
85 fprintf (stderr, "%s: unknown sub-command %s\n", argv[0],
90 if (cmd->requires_args && optind == argc)
93 "%s: the ``%s'' command requires at least one argument\n",
94 __FUNCTION__, cmd_name);
98 err = opkg_cmd_exec (cmd, &opkg_conf, argc - optind, (const char **) (argv + optind), NULL);
100 opkg_conf_deinit (&opkg_conf);