diff options
author | Michael Orlitzky <mjo@gentoo.org> | 2016-01-08 21:21:08 -0500 |
---|---|---|
committer | Michael Orlitzky <mjo@gentoo.org> | 2016-01-08 21:21:08 -0500 |
commit | 98bd99ab0dfb91297091b52fad8622b1b689b096 (patch) | |
tree | 415497638eac13bb49414552bc995ae0f9c2d038 | |
parent | Clean up check_module() a bit and give it some documentation. (diff) | |
download | eselect-php-98bd99ab0dfb91297091b52fad8622b1b689b096.tar.gz eselect-php-98bd99ab0dfb91297091b52fad8622b1b689b096.tar.bz2 eselect-php-98bd99ab0dfb91297091b52fad8622b1b689b096.zip |
Fix cleanup and update actions.
-rw-r--r-- | src/php.eselect.in | 23 |
1 files 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 |