tazpkg rev 913
Modules install, remove: improve compatibility with auto-answer options --yes and --noconfirm.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Fri Jul 22 09:57:30 2016 +0300 (2016-07-22) |
parents | d36dc9257f15 |
children | 348730f0ec97 |
files | modules/install modules/remove |
line diff
1.1 --- a/modules/install Thu Jul 14 23:20:26 2016 +0200 1.2 +++ b/modules/install Fri Jul 22 09:57:30 2016 +0300 1.3 @@ -128,9 +128,14 @@ 1.4 "$num")" 1.5 1.6 1.7 - if [ "$AUTO_INSTALL_DEPS" == 'yes' -o -n "$quiet" ]; then 1.8 + if [ -n "$quiet" ]; then 1.9 + # Quietly not display anything. Assume 'yes' unless '--noconfirm' is provided 1.10 answer=0 1.11 + [ -n "$noconfirm" ] && answer=1 1.12 else 1.13 + [ "$AUTO_INSTALL_DEPS" == 'yes' ] && yes='yes' 1.14 + 1.15 + # Display question; wait for answer or print auto-answer 1.16 newline 1.17 confirm "$(_ 'Install all missing dependencies? (y/N)')" 1.18 answer=$?
2.1 --- a/modules/remove Thu Jul 14 23:20:26 2016 +0200 2.2 +++ b/modules/remove Fri Jul 22 09:57:30 2016 +0300 2.3 @@ -123,14 +123,14 @@ 2.4 fi 2.5 2.6 # Confirmation 2.7 -if im && [ -z "$auto" ]; then 2.8 +if [ -n "$noconfirm$yes" ] || im && [ -z "$auto" ]; then 2.9 confirm "$(_ 'Remove package "%s" (%s)? (y/N)' "$PACKAGE" "$VERSION$EXTRAVERSION")" 2.10 if [ "$?" -ne 0 ]; then 2.11 newline; _ 'Uninstallation of package "%s" cancelled.' "$PACKAGE" 2.12 exit 0 2.13 fi 2.14 fi 2.15 -# We are here: non-interactive mode, or --auto, or answer 'y' 2.16 +# We are here: non-interactive mode, or --auto, or --yes, or answer 'y' 2.17 2.18 # Removing package 2.19 title 'Removing package "%s"' "$PACKAGE"