commit:     98bd99ab0dfb91297091b52fad8622b1b689b096
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Jan  9 02:21:08 2016 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Jan  9 02:21:08 2016 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=98bd99ab

Fix cleanup and update actions.

 src/php.eselect.in | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/php.eselect.in b/src/php.eselect.in
index d19b93a..e0c208a 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -183,12 +183,13 @@ cleanup_sapis() {
 }
 
 cleanup_sapi() {
-       local l=${1}_link
+       local sapi="${1}"
+       local l="${sapi}_link"
        local link=${!l}
        if [[ -L $link && ! -e $link ]] ; then
-               echo -n "Broken link for $1"
+               echo -n "Broken link for ${sapi}"
                if update_sapi $1 ; then
-                       echo ", updated version to $(get_active_$1)"
+                       echo ", updated version to $(get_sapi_active_target 
"${sapi}")"
                        return
                else
                        rm $link || die "failed to remove ${link}"
@@ -197,7 +198,7 @@ cleanup_sapi() {
                fi
        fi
 
-       if [[ "${1}" == "apache2" ]]; then
+       if [[ "${sapi}" == "apache2" ]] ; then
                rm -f 
"${EROOT}$(get_active_libdir)/apache2/modules/libphp[57].so" \
                   || die "failed to remove old libphp.so symlink"
        fi
@@ -206,11 +207,12 @@ cleanup_sapi() {
 }
 
 update_sapi() {
-       local target=$(find_sapi_targets $1 | tail -n 1)
-       local current=$(get_active_$1)
+       local sapi="${1}"
+       local target=$(find_sapi_targets "${sapi}" | tail -n 1)
+       local current=$(get_sapi_active_target "${sapi}")
        [[ -z $target ]] && return 1
        [[ $current = $target ]] && return 1
-       set_$1 $target
+       set_$sapi $target
 }
 
 get_libdirs() {
@@ -580,16 +582,17 @@ describe_update_options() {
 }
 
 do_update() {
-       check_module $1
+       local sapi="${1}"
+       check_module "${sapi}"
        [[ -z ${2} || ( -z ${3} && ( ${2} == ifunset || ${2} == '--if-unset' ) 
) ]] || \
                die -q "Usage error"
 
-       if [[ (${2} == ifunset || ${2} == '--if-unset') && -n $(get_active_$1) 
]];
+       if [[ (${2} == ifunset || ${2} == '--if-unset') && -n 
$(get_sapi_active_target "${sapi}") ]];
        then
                return
        fi
 
-       update_sapi $1 || echo "Nothing to update"
+       update_sapi "${sapi}" || echo "Nothing to update"
 }
 
 ## cleanup action

Reply via email to