summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Orlitzky <mjo@gentoo.org>2015-12-10 17:30:04 -0500
committerMichael Orlitzky <mjo@gentoo.org>2015-12-10 17:30:04 -0500
commit0e8210cb39211c30ec8b02006d0e695bc8e6130f (patch)
tree8465cd8836f3dd8881b4c8d484df8ef17c0be816
parentClean up error/info messages and quoting in the set_* functions. (diff)
downloadeselect-php-0e8210cb39211c30ec8b02006d0e695bc8e6130f.tar.gz
eselect-php-0e8210cb39211c30ec8b02006d0e695bc8e6130f.tar.bz2
eselect-php-0e8210cb39211c30ec8b02006d0e695bc8e6130f.zip
Switch get_active_apache2() and set_apache2() to the new mod_php.so symlink.
-rw-r--r--src/php.eselect.in38
1 files 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."
}