diff options
-rw-r--r-- | src/php.eselect.in.in | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in index 12ef1e1..f78bf3d 100644 --- a/src/php.eselect.in.in +++ b/src/php.eselect.in.in @@ -85,7 +85,7 @@ sapi_active_link_target_dir() { local sapi="${1}" local target="${2}" - local link_target_dir="@LIBDIR@/${target}/bin" + local link_target_dir="${ROOT%/}@LIBDIR@/${target}/bin" if [[ "${sapi}" == "apache2" ]] ; then link_target_dir+="/../apache2" fi @@ -459,9 +459,16 @@ set_sapi() { for link_name in $(sapi_active_link_names "${sapi}"); do local link_target=$(sapi_link_name_target "${sapi}" "${target_name}" "${link_name}") + # We need these links to be relative: when setting a target + # with ROOT nonempty, the symlink needs to point within + # ROOT. But if you later chroot() into ROOT, that link will + # point... nowhere, most likely. We need it to still point + # at the right target in that case! + local relative_target=$(relative_name \ + "${link_tgt_dir}/${link_target}" \ + "${link_dir}" ) # Use the short "-f" option for POSIX compatibility. - @LN_S@ -f "${link_tgt_dir}/${link_target}" \ - "${link_dir}/${link_name}" || \ + @LN_S@ -f "${relative_target}" "${link_dir}/${link_name}" || \ die -q "failed to create active ${link_name} symlink" done @@ -518,11 +525,6 @@ describe_list_options() { } do_list() { - if [ "${ROOT%/}" != "" ] ; then - local msg - write_warning_msg "ROOT only supported in setting the configuration" - echo - fi local sapi="${1}" check_module "${sapi}" list_sapi "${sapi}" @@ -543,11 +545,6 @@ describe_show_options() { } do_show() { - if [ "${ROOT%/}" != "" ] ; then - local msg - write_warning_msg "ROOT only supported in setting the configuration" - echo - fi local sapi="${1}" check_module "${sapi}" get_sapi_active_target "${sapi}" |