From 12c9b1948d79dac76e1f1a5148de1c2260838673 Mon Sep 17 00:00:00 2001 From: "Aaron W. Swenson" Date: Sat, 2 Apr 2011 07:17:29 -0400 Subject: Links all lib* files and symlinks in /usr/lib(64)?/postgresql${SLOT}/lib(64)? Unset now calls do_update() as per bug #360467. do_update() simply calls do_set() rather than do_reset() to avoid loops, and a reset wasn't really necessary anyway. Added '-mindepth 1' to 'find' in linker() so that only the contents are returned and not the directory itself. Fixed comments regarding linker(). --- postgresql.eselect | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/postgresql.eselect b/postgresql.eselect index e4cc599..21eb803 100644 --- a/postgresql.eselect +++ b/postgresql.eselect @@ -7,7 +7,7 @@ inherit config multilib DESCRIPTION="Manage active PostgreSQL client applications and libraries" MAINTAINER="pgsql-bugs@gentoo.org" SVN_DATE='$Date: $' -VERSION="1.0.5" +VERSION="1.0.6" # Global Data B_PATH="${EROOT%/}/usr" @@ -36,9 +36,9 @@ lib_dir() { } ### Linker Function ### -# Takes three arguments: +# Takes four arguments: # - Full source path (e.g. /usr/lib/postgresql-9.0/lib) -# _ Pattern to search for +# - Pattern to search for # - Full target directory path (e.g. /usr/bin) # - Suffix (Optional) (e.g 84 to make /usr/bin/psql84) linker() { @@ -48,7 +48,7 @@ linker() { local suffix=$4 local link_source - for link_source in $(find "${source_dir}" -maxdepth 1 ${pattern}) ; do + for link_source in $(find "${source_dir}" -maxdepth 1 -mindepth 1 ${pattern}) ; do local link_target="${target_dir%/}/$(basename ${link_source})${suffix}" # For good measure, remove target before creating the symlink @@ -194,12 +194,12 @@ do_set() { echo "${B_PATH}/${x}/postgresql" >> "${E_PATH}"/active.links # Linker works for files linker "${B_PATH}/${x}/postgresql-${SLOT}/${x}" \ - "-name lib*[a|dylib|so]" "${B_PATH}/${x}" + "-name lib*" "${B_PATH}/${x}" fi done # Link binaries to /usr/bin/ - linker "${B_PATH}/$(lib_dir)/postgresql-${SLOT}/bin/" \ + linker "${B_PATH}/$(lib_dir)/postgresql-${SLOT}/bin" \ "-xtype f" "${B_PATH}/bin" # Default share path @@ -223,6 +223,8 @@ do_unset() { unlinker "${E_PATH}/active.links" rm -f "${E_PATH}/active" echo "done." + echo "Setting a new slot as the default." + do_update else echo "Inactive slot selected. No work to do." fi @@ -280,7 +282,7 @@ do_update() { # Reset, otherwise set the highest slot available. if [[ ${slots[@]} =~ ${slot} ]] ; then - do_reset + do_set ${slot} else # best_version doesn't work here as pkg_postrm runs before the world # file is updated, thereby returning a false positive. @@ -313,7 +315,7 @@ do_update() { done local share_path="${B_PATH}/share/postgresql-${curslot}/" [[ -d ${share_path} ]] && manpath+=":${share_path}" - linker "${B_PATH}/$(lib_dir)/postgresql-${curslot}/bin/" \ + linker "${B_PATH}/$(lib_dir)/postgresql-${curslot}/bin" \ "-xtype f" "${B_PATH}/bin" "${curslot//.}" echo "done." done -- cgit v1.2.3-65-gdbad