aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron W. Swenson <titanofold@gentoo.org>2011-04-02 07:17:29 -0400
committerAaron W. Swenson <titanofold@gentoo.org>2011-04-02 07:17:29 -0400
commit12c9b1948d79dac76e1f1a5148de1c2260838673 (patch)
treed17ca7d35ff855c00d2d64bd92d5f68338646f26
parentFixed path so that it looks for something that'll actually exist. (diff)
downloadeselect-12c9b1948d79dac76e1f1a5148de1c2260838673.tar.gz
eselect-12c9b1948d79dac76e1f1a5148de1c2260838673.tar.bz2
eselect-12c9b1948d79dac76e1f1a5148de1c2260838673.zip
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().
-rw-r--r--postgresql.eselect18
1 files 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