diff --git a/CHANGELOG.md b/CHANGELOG.md index c6c799e7..144c1c46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * `lib/yum`, `lib/dpkg`, `lib/apk`: Fix #96, #143 by adding `-q` (quiet) option for `Qs`. * `lib/apk`: `Q` prints version information. +* `lib/apk`: Fix `--noconfirm` issue (#150) ## v2.4.4 diff --git a/lib/00_core.sh b/lib/00_core.sh index be6743a3..a102480b 100644 --- a/lib/00_core.sh +++ b/lib/00_core.sh @@ -179,7 +179,6 @@ _translate_debug() { # Translate the --noconfirm option. # FIXME: does "yes | pacapt" just help? _translate_noconfirm() { - echo "$_EOPT" | $GREP -q ":noconfirm:" || return 0 local _opt= @@ -196,6 +195,7 @@ _translate_noconfirm() { "zypper") _opt="--no-confirm";; "pkgng") _opt="-y";; "tazpkg") _opt="--auto";; + "apk") _opt="";; *) _opt="" _ret=1 @@ -203,8 +203,8 @@ _translate_noconfirm() { ;; esac - echo $_opt - return $_ret + echo "$_opt" + return "$_ret" } _translate_all() { @@ -212,11 +212,12 @@ _translate_all() { local _debug= local _noconfirm= - _debug="$(_translate_debug)" - _noconfirm="$(_translate_noconfirm)" + _debug="$(_translate_debug)" || return 1 + _noconfirm="$(_translate_noconfirm)" || return 1 _args="$(_translate_w)" || return 1 - _args="${_args}${_noconfirm:+ }${_noconfirm}" || return 1 - _args="${_args}${_debug:+ }${_debug}" || return 1 + + _args="${_args}${_noconfirm:+ }${_noconfirm}" + _args="${_args}${_debug:+ }${_debug}" export _EOPT="${_args# }" } diff --git a/lib/apk.sh b/lib/apk.sh index ab9422f9..7994141b 100644 --- a/lib/apk.sh +++ b/lib/apk.sh @@ -60,26 +60,26 @@ apk_Qu() { } apk_R() { - apk del -- "$@" + apk del $_TOPT -- "$@" } apk_Rn() { - apk del --purge -- "$@" + apk del --purge $_TOPT -- "$@" } apk_Rns() { - apk del --purge -r -- "$@" + apk del --purge -r $_TOPT -- "$@" } apk_Rs() { - apk del -r -- "$@" + apk del -r $_TOPT -- "$@" } apk_S() { case ${_EOPT} in # Download only ("fetch") shift - apk fetch -- "$@" ;; + apk fetch $_TOPT -- "$@" ;; (*) apk add $_TOPT -- "$@" ;; esac } @@ -129,9 +129,9 @@ apk_Sy() { } apk_Sw() { - apk fetch -- "$@" + apk fetch $_TOPT -- "$@" } apk_U() { - apk add --allow-untrusted -- "$@" + apk add --allow-untrusted $_TOPT -- "$@" }