aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Woodward2004-10-02 20:26:44 +0000
committerJason Woodward2004-10-02 20:26:44 +0000
commit0a2a81593f7634de7b1867eefe631c8433922888 (patch)
tree46a7bb1abb11070972dbf7f1a193130c13e3c9cc /src
parent3a1d2efe6ac62e59848904a9501fcfd88f80eb03 (diff)
downloadslapt-get-0a2a81593f7634de7b1867eefe631c8433922888.tar.gz
added --autoclean option to run purge_old_cached_pkgs() instead of automatically at the end of each transation (thanks Michel Hermier)
Diffstat (limited to 'src')
-rw-r--r--src/main.c7
-rw-r--r--src/main.h2
-rw-r--r--src/transaction.c2
3 files changed, 8 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 9445858..d2ea2c3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -55,6 +55,7 @@ int main( int argc, char *argv[] ){
{"show-stats",0, 0, 'S'},
{"S",0, 0, 'S'},
{"config",1, 0, 'C'},
+ {"autoclean", 0, 0, 'a'},
};
int option_index = 0;
/* */
@@ -167,6 +168,9 @@ int main( int argc, char *argv[] ){
free_rc_config(tmp_gc);
}
break;
+ case 'a': /* clean old old package versions */
+ do_action = AUTOCLEAN;
+ break;
default:
usage();
exit(1);
@@ -261,6 +265,8 @@ int main( int argc, char *argv[] ){
chdir(global_config->working_dir);
}else if( do_action == SHOWVERSION ){
version_info();
+ }else if( do_action == AUTOCLEAN ){
+ purge_old_cached_pkgs(global_config->working_dir);
}else if( do_action == 0 ){ /* default initialized value */
usage();
exit(1);
@@ -291,6 +297,7 @@ void usage(void){
printf(" --list - %s\n",_("list available pkgs"));
printf(" --installed - %s\n",_("list installed pkgs"));
printf(" --clean - %s\n",_("purge cached pkgs"));
+ printf(" --autoclean - %s\n",_("purge older versions of cached pkgs"));
printf(" --version - %s\n",_("print version and license info"));
printf("\n");
printf(_("Options:\n"));
diff --git a/src/main.h b/src/main.h
index 579b047..44cc504 100644
--- a/src/main.h
+++ b/src/main.h
@@ -44,7 +44,7 @@
enum action {
UPDATE = 1, INSTALL, REMOVE, SHOW, SEARCH, UPGRADE,
- LIST, INSTALLED, CLEAN, SHOWVERSION
+ LIST, INSTALLED, CLEAN, SHOWVERSION, AUTOCLEAN
};
#define DEBUG 0
diff --git a/src/transaction.c b/src/transaction.c
index 27199cf..c2bbb47 100644
--- a/src/transaction.c
+++ b/src/transaction.c
@@ -224,8 +224,6 @@ int handle_transaction(const rc_config *global_config, transaction *tran){
if( remove_pkg(global_config,tran->remove_pkgs->pkgs[i]) == -1 ) exit(1);
}
- purge_old_cached_pkgs(global_config->working_dir);
-
printf(_("Done\n"));
return 0;