opkg command line frontend using libopkg
*/
-#include "includes.h"
+#include "config.h"
+#include <stdio.h>
#include <getopt.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
#include "opkg_conf.h"
#include "opkg_cmd.h"
ARGS_OPT_FORCE_REMOVAL_OF_ESSENTIAL_PACKAGES,
ARGS_OPT_FORCE_SPACE,
ARGS_OPT_NOACTION,
+ ARGS_OPT_DOWNLOAD_ONLY,
ARGS_OPT_NODEPS,
ARGS_OPT_AUTOREMOVE,
ARGS_OPT_CACHE,
{"force_removal_of_essential_packages", 0, 0,
ARGS_OPT_FORCE_REMOVAL_OF_ESSENTIAL_PACKAGES},
{"noaction", 0, 0, ARGS_OPT_NOACTION},
+ {"download-only", 0, 0, ARGS_OPT_DOWNLOAD_ONLY},
{"nodeps", 0, 0, ARGS_OPT_NODEPS},
{"offline", 1, 0, 'o'},
{"offline-root", 1, 0, 'o'},
case ARGS_OPT_NOACTION:
conf->noaction = 1;
break;
+ case ARGS_OPT_DOWNLOAD_ONLY:
+ conf->download_only = 1;
+ break;
case ':':
parse_err = -1;
break;
printf("\t--force-downgrade Allow opkg to downgrade packages\n");
printf("\t--force-space Disable free space checks\n");
printf("\t--noaction No action -- test only\n");
+ printf("\t--download-only No action -- download only\n");
printf("\t--nodeps Do not follow dependences\n");
printf("\t--force-removal-of-dependent-packages\n");
printf("\t Remove package and all dependencies\n");
int
main(int argc, char *argv[])
{
- int opts;
+ int opts, err = -1;
char *cmd_name;
opkg_cmd_t *cmd;
int nocheckfordirorfile = 0;
int noreadfeedsfile = 0;
+ conf->verbosity = NOTICE;
+
opts = args_parse(argc, argv);
if (opts == argc || opts < 0) {
fprintf (stderr, "%s: unknown sub-command %s\n", argv[0],
usage();
}
- conf->verbosity = NOTICE;
conf->pfm = cmd->pfm;
if (opkg_conf_init())
usage();
}
- if (opkg_cmd_exec(cmd, argc - opts, (const char **) (argv + opts)))
- goto err2;
-
- print_error_list();
- free_error_list();
-
- return 0;
+ err = opkg_cmd_exec(cmd, argc - opts, (const char **) (argv + opts));
-err2:
#ifdef HAVE_CURL
opkg_curl_cleanup();
#endif
print_error_list();
free_error_list();
- return -1;
+ return err;
}