diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/apk.c | 4 | ||||
-rw-r--r-- | src/apk_defines.h | 1 | ||||
-rw-r--r-- | src/state.c | 4 |
3 files changed, 8 insertions, 1 deletions
@@ -37,6 +37,7 @@ static struct apk_option generic_options[] = { required_argument, "REPO" }, { 'q', "quiet", "Print less information" }, { 'v', "verbose", "Print more information" }, + { 'i', "interactive", "Ask confirmation for certain operations" }, { 'V', "version", "Print program version and exit" }, { 'f', "force", "Do what was asked even if it looks dangerous" }, { 'U', "update-cache", "Update the repository cache" }, @@ -348,6 +349,9 @@ int main(int argc, char **argv) case 'f': apk_flags |= APK_FORCE; break; + case 'i': + apk_flags |= APK_INTERACTIVE; + break; case 'U': apk_flags |= APK_UPDATE_CACHE; break; diff --git a/src/apk_defines.h b/src/apk_defines.h index a7e13f9..2ce3535 100644 --- a/src/apk_defines.h +++ b/src/apk_defines.h @@ -61,6 +61,7 @@ extern unsigned int apk_flags; #define APK_UPDATE_CACHE 0x0080 #define APK_ALLOW_UNTRUSTED 0x0100 #define APK_PURGE 0x0200 +#define APK_INTERACTIVE 0x0400 #define apk_error(args...) do { apk_log("ERROR: ", args); } while (0) #define apk_warning(args...) do { if (apk_verbosity > 0) { apk_log("WARNING: ", args); } } while (0) diff --git a/src/state.c b/src/state.c index f539b3b..16acfba 100644 --- a/src/state.c +++ b/src/state.c @@ -667,7 +667,7 @@ int apk_state_commit(struct apk_state *state, } size_diff /= 1024; - if (apk_verbosity > 1) { + if (apk_verbosity > 1 || (apk_flags & APK_INTERACTIVE)) { r = dump_packages(state, cmp_remove, "The following packages will be REMOVED"); r += dump_packages(state, cmp_downgrade, @@ -681,6 +681,8 @@ int apk_state_commit(struct apk_state *state, (size_diff < 0) ? "disk space will be freed" : "additional disk space will be used"); + } + if (apk_flags & APK_INTERACTIVE) { fprintf(stderr, "Do you want to continue [Y/n]? "); fflush(stderr); r = fgetc(stdin); |