summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2007-10-07 06:00:20 +0000
committerJason Woodward2007-10-07 06:00:20 +0000
commit29f36f8a214cdb03e0df5a52679e37e586a0e668 (patch)
treef4df4c54e7ca208a5684abb063d9e791cfbce915
parent33c6514ddcdebd5ec6d29b9479f2d3976eb87373 (diff)
downloadslapt-get-29f36f8a214cdb03e0df5a52679e37e586a0e668.tar.gz
make sure new R_OK option from --simulate does not allow things that need W_OK
-rw-r--r--ChangeLog9
-rw-r--r--src/main.c20
2 files changed, 24 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index d8dbfba..64a4c02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,8 @@
-0.9.12c Oct 06, 2007
- * allow any option with --simulate to be ran without write privileges
- to the working directory (thanks Anders Bjorklund and John Babiak)
- * allow --version to be ran without write privileges to the working
- directory (thanks Anders Bjorklund and John Babiak)
+0.9.12c Oct 07, 2007
+ * allow version, list, available, installed, show, and search options to be
+ ran without write priviledes to the working directory (thanks
+ Anders Bjorklund and John Babiak)
* compile time definition for SLACKWARE_EXTRA_TESTING_PASTURE_WORKAROUND
(see package.c for comment)
diff --git a/src/main.c b/src/main.c
index 3538507..afbca16 100644
--- a/src/main.c
+++ b/src/main.c
@@ -111,15 +111,19 @@ int main( int argc, char *argv[] )
break;
case SLAPT_SHOW_OPT: /* show */
do_action = SHOW;
+ global_config->simulate = SLAPT_TRUE; /* allow read access */
break;
case SLAPT_SEARCH_OPT: /* search */
do_action = SEARCH;
+ global_config->simulate = SLAPT_TRUE; /* allow read access */
break;
case SLAPT_LIST_OPT: /* list */
do_action = LIST;
+ global_config->simulate = SLAPT_TRUE; /* allow read access */
break;
case SLAPT_INSTALLED_OPT: /* installed */
do_action = INSTALLED;
+ global_config->simulate = SLAPT_TRUE; /* allow read access */
break;
case SLAPT_CLEAN_OPT: /* clean */
do_action = CLEAN;
@@ -211,6 +215,7 @@ int main( int argc, char *argv[] )
break;
case SLAPT_AVAILABLE_OPT: /* show available packages */
do_action = AVAILABLE;
+ global_config->simulate = SLAPT_TRUE; /* allow read access */
break;
case SLAPT_INSTALL_DISK_SET_OPT: /* install a disk set */
do_action = INSTALL_DISK_SET;
@@ -230,16 +235,31 @@ int main( int argc, char *argv[] )
/* Check optional arguments presence */
switch(do_action) {
+
+ /* can't simulate update, clean, autoclean, or add keys */
+ case CLEAN:
+ case AUTOCLEAN:
+ #ifdef SLAPT_HAS_GPGME
+ case ADD_KEYS:
+ #endif
+ case UPDATE:
+ global_config->simulate = SLAPT_FALSE;
+ break;
+
+ /* remove obsolete can take the place of arguments */
case INSTALL:
case INSTALL_DISK_SET:
case REMOVE:
if (global_config->remove_obsolete == SLAPT_TRUE)
break;
+
+ /* show and search must have arguments */
case SHOW:
case SEARCH:
if ( optind >= argc )
do_action = 0;
break;
+
default:
if (optind < argc)
do_action = USAGE;