summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libopkg/args.c9
-rw-r--r--libopkg/args.h2
-rw-r--r--libopkg/libopkg.h1
-rw-r--r--libopkg/opkg_conf.c3
-rw-r--r--libopkg/opkg_conf.h1
-rw-r--r--libopkg/opkg_remove.c5
6 files changed, 19 insertions, 2 deletions
diff --git a/libopkg/args.c b/libopkg/args.c
index 99f3e12..d4e3b83 100644
--- a/libopkg/args.c
+++ b/libopkg/args.c
@@ -42,7 +42,8 @@ enum long_args_opt
ARGS_OPT_NODEPS,
ARGS_OPT_VERBOSE_WGET,
ARGS_OPT_VERBOSITY,
- ARGS_OPT_MULTIPLE_PROVIDERS
+ ARGS_OPT_MULTIPLE_PROVIDERS,
+ ARGS_OPT_AUTOREMOVE
};
int args_init(args_t *args)
@@ -67,6 +68,7 @@ int args_init(args_t *args)
args->force_reinstall = ARGS_DEFAULT_FORCE_REINSTALL;
args->force_removal_of_dependent_packages = ARGS_DEFAULT_FORCE_REMOVAL_OF_DEPENDENT_PACKAGES;
args->force_removal_of_essential_packages = ARGS_DEFAULT_FORCE_REMOVAL_OF_ESSENTIAL_PACKAGES;
+ args->autoremove = ARGS_DEFAULT_AUTOREMOVE;
args->noaction = ARGS_DEFAULT_NOACTION;
args->nodeps = ARGS_DEFAULT_NODEPS;
args->verbose_wget = ARGS_DEFAULT_VERBOSE_WGET;
@@ -94,6 +96,7 @@ int args_parse(args_t *args, int argc, char *argv[])
int parse_err = 0;
static struct option long_options[] = {
{"query-all", 0, 0, 'A'},
+ {"autoremove", 0, 0, ARGS_OPT_AUTOREMOVE},
{"conf-file", 1, 0, 'f'},
{"conf", 1, 0, 'f'},
{"dest", 1, 0, 'd'},
@@ -169,6 +172,9 @@ int args_parse(args_t *args, int argc, char *argv[])
else
args->verbosity += 1;
break;
+ case ARGS_OPT_AUTOREMOVE:
+ args->autoremove = 1;
+ break;
case ARGS_OPT_FORCE_DEFAULTS:
args->force_defaults = 1;
break;
@@ -299,6 +305,7 @@ void args_usage(char *complaint)
fprintf(stderr, "\t-nodeps Do not follow dependences\n");
fprintf(stderr, "\t-force-removal-of-dependent-packages\n");
fprintf(stderr, "\t-recursive Allow opkg to remove package and all that depend on it.\n");
+ fprintf(stderr, "\t-autoremove Allow opkg to remove packages that where installed automatically to satisfy dependencies.\n");
fprintf(stderr, "\t-test No action -- test only\n");
fprintf(stderr, "\t-t Specify tmp-dir.\n");
fprintf(stderr, "\t--tmp-dir Specify tmp-dir.\n");
diff --git a/libopkg/args.h b/libopkg/args.h
index a470778..0c16d7e 100644
--- a/libopkg/args.h
+++ b/libopkg/args.h
@@ -39,6 +39,7 @@ struct args
int verbosity;
int nocheckfordirorfile;
int noreadfeedsfile;
+ int autoremove;
char *offline_root;
char *offline_root_pre_script_cmd;
char *offline_root_post_script_cmd;
@@ -63,6 +64,7 @@ typedef struct args args_t;
#define ARGS_DEFAULT_NODEPS 0
#define ARGS_DEFAULT_VERBOSE_WGET 0
#define ARGS_DEFAULT_VERBOSITY 1
+#define ARGS_DEFAULT_AUTOREMOVE 0
int args_init(args_t *args);
void args_deinit(args_t *args);
diff --git a/libopkg/libopkg.h b/libopkg/libopkg.h
index 3430e1c..be4c31b 100644
--- a/libopkg/libopkg.h
+++ b/libopkg/libopkg.h
@@ -39,6 +39,7 @@ typedef int (*opkg_status_callback)(char *name, int istatus, char *desc,
typedef char* (*opkg_response_callback)(char *question);
typedef void (*opkg_download_progress_callback)(int percent, char *url);
typedef void (*opkg_state_changed_callback)(opkg_state_t state, const char *data);
+typedef void (*opkg_progress_callback)(int complete, int total, void *userdata);
extern int opkg_op(int argc, char *argv[]); /* opkglib.c */
extern int opkg_init (opkg_message_callback mcall,
diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c
index abeab19..8bb872c 100644
--- a/libopkg/opkg_conf.c
+++ b/libopkg/opkg_conf.c
@@ -231,6 +231,9 @@ int opkg_conf_init(opkg_conf_t *conf, const args_t *args)
right now it is ridiculous. Maybe opkg_conf_t should just save
a pointer to args_t (which could then not be freed), rather
than duplicating every field here? */
+ if (args->autoremove) {
+ conf->autoremove = 1;
+ }
if (args->force_depends) {
conf->force_depends = 1;
}
diff --git a/libopkg/opkg_conf.h b/libopkg/opkg_conf.h
index 4b50900..98b3fe1 100644
--- a/libopkg/opkg_conf.h
+++ b/libopkg/opkg_conf.h
@@ -54,6 +54,7 @@ struct opkg_conf
const char *pending_dir;
/* options */
+ int autoremove;
int force_depends;
int force_defaults;
int force_overwrite;
diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c
index eb7825a..8bf1d2a 100644
--- a/libopkg/opkg_remove.c
+++ b/libopkg/opkg_remove.c
@@ -169,7 +169,10 @@ int opkg_remove_pkg(opkg_conf_t *conf, pkg_t *pkg,int message)
*/
int err;
abstract_pkg_t *parent_pkg = NULL;
-
+
+ if (conf->autoremove)
+ printf ("autoremove is enabled, but not yet implemented\n");
+
if (pkg->essential && !message) {
if (conf->force_removal_of_essential_packages) {
fprintf(stderr, "WARNING: Removing essential package %s under your coercion.\n"