commit: 0e8210cb39211c30ec8b02006d0e695bc8e6130f Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org> AuthorDate: Thu Dec 10 22:30:04 2015 +0000 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org> CommitDate: Thu Dec 10 22:30:04 2015 +0000 URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=0e8210cb
Switch get_active_apache2() and set_apache2() to the new mod_php.so symlink. src/php.eselect.in | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/php.eselect.in b/src/php.eselect.in index 14ba819..4bbc695 100644 --- a/src/php.eselect.in +++ b/src/php.eselect.in @@ -190,24 +190,22 @@ get_apache2_active_symlink_path() { # "php5.6" or "php7.0". # get_active_apache2() { - local libs target ver - libs="${EROOT}$(get_active_libdir)/apache2/modules/libphp[57].so" + local active_symlink target ver + + # The symlink to our active module. + active_symlink="$(get_apache2_active_symlink_path)" # This sed expression finds the "display name" of the PHP version # corresponding to a copy of libphp. For example, it parses the # string "php5.6" out of "/usr/lib64/php5.6/apache2/libphp5.so". ver="s:.*/usr/.*/\(php[0-9]\.[0-9]\)/apache2/libphp[57].so:\1:p" - for lib in $libs; do - if [[ -L "${lib}" ]] ; then - target=$(canonicalise "${lib}") - if [[ -a "${target}" ]] ; then - echo "${target}" | @SED@ -ne "${ver}" - # Short-circuit here because we should never have more - # than one active version. - return - fi + + if [[ -L "${active_symlink}" ]] ; then + target=$(canonicalise "${active_symlink}") + if [[ -a "${target}" ]] ; then + echo "${target}" | @SED@ -ne "${ver}" fi - done + fi } resolv_target() { @@ -281,13 +279,17 @@ list_fpm() { } set_apache2() { - local libdir t=$(resolv_target apache2 $1) - [[ -z $t ]] && die -q "Bad target" + local active_symlink libdir t=$(resolv_target apache2 $1) + active_symlink="$(get_apache2_active_symlink_path)" + + [[ -z $t ]] && die -q "invalid target" for libdir in $(get_libdirs); do - rm -f "${EROOT}${libdir}/apache2/modules/libphp[57].so" - @LN_S@ --force "../../$t/apache2/libphp${t:3:1}.so" \ - "${EROOT}${libdir}/apache2/modules/" || \ - die -q "Failed to set symlink for ${EPREFIX}${libdir}/apache2/modules/libphp${t:3:1}.so" + rm --force "${active_symlink}" || \ + die "failed to remove active module symlink" + + @LN_S@ --force "../../${t}/apache2/libphp${t:3:1}.so" \ + "${active_symlink}" || \ + die -q "failed to create active mod_php symlink" done echo "Please restart apache for the changes to take effect." }