aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron W. Swenson <titanofold@gentoo.org>2016-08-08 18:39:19 -0400
committerAaron W. Swenson <titanofold@gentoo.org>2016-08-08 18:39:19 -0400
commit2ab66cffbfd5ff7111244eca0e4f7e06dcf7cae7 (patch)
treefd0c1639d562ef03fc932a74f95fead2a59768bd /postgresql.eselect
parentRefactor update to clean out old files and directories that are no longer used. (diff)
downloadeselect-2ab66cffbfd5ff7111244eca0e4f7e06dcf7cae7.tar.gz
eselect-2ab66cffbfd5ff7111244eca0e4f7e06dcf7cae7.tar.bz2
eselect-2ab66cffbfd5ff7111244eca0e4f7e06dcf7cae7.zip
Rename global variables to something sensible
Decoding those 1 character prefixes is exhausting!
Diffstat (limited to 'postgresql.eselect')
-rw-r--r--postgresql.eselect102
1 files changed, 51 insertions, 51 deletions
diff --git a/postgresql.eselect b/postgresql.eselect
index 8463344..93dc723 100644
--- a/postgresql.eselect
+++ b/postgresql.eselect
@@ -9,8 +9,8 @@ MAINTAINER="pgsql-bugs@gentoo.org"
VERSION="1.3"
# Global Data
-B_PATH="${EROOT%/}/usr"
-E_PATH="${EROOT%/}/etc/eselect/postgresql"
+USR_PATH="${EROOT%/}/usr"
+ETC_PATH="${EROOT%/}/etc/eselect/postgresql"
ENV_FILE="${EROOT%/}/etc/env.d/50postgresql"
# This list of files/directories are the symbolic link targets that need to be
@@ -19,19 +19,19 @@ ENV_FILE="${EROOT%/}/etc/env.d/50postgresql"
# If you change this list, remember to change include_sources in do_set. And,
# they must be listed in the same order.
INCLUDE_TARGETS=(
- "${B_PATH}"/include/postgresql
- "${B_PATH}"/include/libpq-fe.h
- "${B_PATH}"/include/pg_config_ext.h
- "${B_PATH}"/include/pg_config_manual.h
- "${B_PATH}"/include/libpq
- "${B_PATH}"/include/postgres_ext.h
+ "${USR_PATH}"/include/postgresql
+ "${USR_PATH}"/include/libpq-fe.h
+ "${USR_PATH}"/include/pg_config_ext.h
+ "${USR_PATH}"/include/pg_config_manual.h
+ "${USR_PATH}"/include/libpq
+ "${USR_PATH}"/include/postgres_ext.h
)
active_slot() {
- # ${B_PATH}/share/postgresql is a symlink. See if it's there, then
+ # ${USR_PATH}/share/postgresql is a symlink. See if it's there, then
# find out where it links to
- if [[ -h "${B_PATH}/share/postgresql" ]] ; then
- canonicalise "${B_PATH}/share/postgresql" | \
+ if [[ -h "${USR_PATH}/share/postgresql" ]] ; then
+ canonicalise "${USR_PATH}/share/postgresql" | \
sed 's|.*postgresql-\([1-9][0-9.]*\)|\1|'
else
echo "(none)"
@@ -41,13 +41,13 @@ active_slot() {
lib_dir() {
local lib_list=$(list_libdirs)
if [[ ${lib_list} =~ .*lib64.* && \
- -n $(ls -d ${B_PATH}/lib64/postgresql-*/lib64 2> /dev/null) ]] ; then
+ -n $(ls -d ${USR_PATH}/lib64/postgresql-*/lib64 2> /dev/null) ]] ; then
echo "lib64"
elif [[ ${lib_list} =~ .*lib32.* && \
- -n $(ls -d ${B_PATH}/lib32/postgresql-*/lib32 2> /dev/null) ]] ; then
+ -n $(ls -d ${USR_PATH}/lib32/postgresql-*/lib32 2> /dev/null) ]] ; then
echo "lib32"
elif [[ ${lib_list} =~ .*libx32.* && \
- -n $(ls -d ${B_PATH}/libx32/postgresql-*/libx32 2> /dev/null) ]] ; then
+ -n $(ls -d ${USR_PATH}/libx32/postgresql-*/libx32 2> /dev/null) ]] ; then
echo "libx32"
else
echo "lib"
@@ -124,13 +124,13 @@ get_slots() {
local slot
local found_slots
- for slot in $(find "${B_PATH}/$(lib_dir)/" -maxdepth 1 -type d \
+ for slot in $(find "${USR_PATH}/$(lib_dir)/" -maxdepth 1 -type d \
-regex '.*postgresql-[0-9][0-9]*\.[0-9][0-9]*' | \
sed -re 's#.*([0-9]+\.[0-9]+)$#\1#' | sort -n)
do
# Check that pg_config exists for this slot, otherwise we have
# a false positive.
- [[ -x "${B_PATH}/$(lib_dir)/postgresql-${slot}/bin/pg_config" ]] && \
+ [[ -x "${USR_PATH}/$(lib_dir)/postgresql-${slot}/bin/pg_config" ]] && \
found_slots+=( ${slot} )
done
@@ -152,7 +152,7 @@ do_list() {
local slot
local bindir
for slot in $(get_slots) ; do
- bindir="${B_PATH}/$(lib_dir)/postgresql-${slot}/bin"
+ bindir="${USR_PATH}/$(lib_dir)/postgresql-${slot}/bin"
# The output of `pg_config --version` also includes "PostgreSQL" in
# the string, which is a bit redundant.
@@ -203,7 +203,7 @@ describe_set() {
do_set() {
local SLOT=$1
- if [[ ! -d ${B_PATH}/$(lib_dir)/postgresql-${SLOT} ]] ; then
+ if [[ ! -d ${USR_PATH}/$(lib_dir)/postgresql-${SLOT} ]] ; then
die -q "Not a valid slot."
fi
@@ -227,12 +227,12 @@ do_set() {
# If you change this list, you must change the INCLUDE_TARGETS list,
# too. And, they must be listed in the same order.
local include_sources=(
- "${B_PATH}"/include/postgresql-${SLOT}
- "${B_PATH}"/include/postgresql-${SLOT}/libpq-fe.h
- "${B_PATH}"/include/postgresql-${SLOT}/pg_config_ext.h
- "${B_PATH}"/include/postgresql-${SLOT}/pg_config_manual.h
- "${B_PATH}"/include/postgresql-${SLOT}/libpq
- "${B_PATH}"/include/postgresql-${SLOT}/postgres_ext.h
+ "${USR_PATH}"/include/postgresql-${SLOT}
+ "${USR_PATH}"/include/postgresql-${SLOT}/libpq-fe.h
+ "${USR_PATH}"/include/postgresql-${SLOT}/pg_config_ext.h
+ "${USR_PATH}"/include/postgresql-${SLOT}/pg_config_manual.h
+ "${USR_PATH}"/include/postgresql-${SLOT}/libpq
+ "${USR_PATH}"/include/postgresql-${SLOT}/postgres_ext.h
)
# The linker function cannot accomadate this special purpose.
@@ -253,24 +253,24 @@ do_set() {
# Link modules to /usr/lib{,32,64}/
local x
for x in $(list_libdirs) ; do
- if [[ -d ${B_PATH}/${x}/postgresql-${SLOT}/${x} ]] ; then
+ if [[ -d ${USR_PATH}/${x}/postgresql-${SLOT}/${x} ]] ; then
# 'linker' function doesn't work for linking directories.
# Default lib path - create a relative link
- ln -s "postgresql-${SLOT}/${x}" "${B_PATH}/${x}/postgresql"
+ ln -s "postgresql-${SLOT}/${x}" "${USR_PATH}/${x}/postgresql"
# Linker works for files
- linker "${B_PATH}/${x}/postgresql-${SLOT}/${x}/" \
- "-name lib*" "${B_PATH}/${x}"
+ linker "${USR_PATH}/${x}/postgresql-${SLOT}/${x}/" \
+ "-name lib*" "${USR_PATH}/${x}"
fi
done
# Link binaries to /usr/bin/
- linker "${B_PATH}/$(lib_dir)/postgresql-${SLOT}/bin/" \
- "-type f" "${B_PATH}/bin"
+ linker "${USR_PATH}/$(lib_dir)/postgresql-${SLOT}/bin/" \
+ "-type f" "${USR_PATH}/bin"
# Default share path - use a relative link here by just specifying the
# base name
- ln -s "postgresql-${SLOT}" "${B_PATH}/share/postgresql"
+ ln -s "postgresql-${SLOT}" "${USR_PATH}/share/postgresql"
echo "done."
echo "Setting ${SLOT} as default was successful!"
@@ -295,7 +295,7 @@ do_unset() {
fi
local l
- for l in ${INCLUDE_TARGETS[@]} "${B_PATH}/share/postgresql" ; do
+ for l in ${INCLUDE_TARGETS[@]} "${USR_PATH}/share/postgresql" ; do
# Remove target before creating the symlink
[[ -h ${l} ]] && rm -f "${l}"
@@ -305,15 +305,15 @@ do_unset() {
done
for x in $(list_libdirs) ; do
- if [[ -d ${B_PATH}/${x}/postgresql-${SLOT}/${x} ]] ; then
- if [[ -h "${B_PATH}/${x}/postgresql" ]] ; then
- rm -f "${B_PATH}/${x}/postgresql"
- [[ -e "${B_PATH}/${x}/postgresql" ]] && \
- die -q "Unable to remove '${B_PATH}/${x}/postgresql'"
+ if [[ -d ${USR_PATH}/${x}/postgresql-${SLOT}/${x} ]] ; then
+ if [[ -h "${USR_PATH}/${x}/postgresql" ]] ; then
+ rm -f "${USR_PATH}/${x}/postgresql"
+ [[ -e "${USR_PATH}/${x}/postgresql" ]] && \
+ die -q "Unable to remove '${USR_PATH}/${x}/postgresql'"
fi
- unlinker "${B_PATH}/${x}/postgresql-${SLOT}/${x}/" \
- "-name lib*" "${B_PATH}/${x}"
+ unlinker "${USR_PATH}/${x}/postgresql-${SLOT}/${x}/" \
+ "-name lib*" "${USR_PATH}/${x}"
fi
done
}
@@ -345,17 +345,17 @@ do_update() {
# Remove environment files that have been generated by the ebuilds
rm -f "${ENV_FILE}"-*
- if [[ -d ${E_PATH} ]] ; then
+ if [[ -d ${ETC_PATH} ]] ; then
# Remove some files outright as they're entirely useless now.
- # ${E_PATH}/active: Contents was the active slot (e.g., 9.5)
- # ${E_PATH}/service: Told the initscript which slot to start
+ # ${ETC_PATH}/active: Contents was the active slot (e.g., 9.5)
+ # ${ETC_PATH}/service: Told the initscript which slot to start
local f
- for f in "${E_PATH}/active" "${E_PATH}/service" ; do
+ for f in "${ETC_PATH}/active" "${ETC_PATH}/service" ; do
[[ -e "${f}" ]] && rm -f "${f}"
done
local active_link_file
- for active_link_file in "${E_PATH}"/active.links* ; do
+ for active_link_file in "${ETC_PATH}"/active.links* ; do
local active_links=($(<"${active_link_file}"))
for (( i=0; $i < ${#active_links[@]}; i++ )) ; do
[[ -h "${ROOT%/}/${active_links[$i]}" ]] && \
@@ -369,14 +369,14 @@ do_update() {
done
local unused_files
- unused_file=$(find "${E_PATH}" -type f -not -name '.keep*')
+ unused_file=$(find "${ETC_PATH}" -type f -not -name '.keep*')
if [[ -n "${unused_file[@]}" ]] ; then
write_warning_msg "You have unused files that should be removed:"
for f in ${unused_file[@]} ; do
write_warning_msg $f
done
else
- echo "It's should be safe for you to remove '${E_PATH}'"
+ echo "It's should be safe for you to remove '${ETC_PATH}'"
fi
fi
@@ -405,18 +405,18 @@ do_update() {
local ldpath
local x
for x in $(list_libdirs) ; do
- [[ -h ${B_PATH}/${x}/postgresql ]] && \
- ldpath+="${B_PATH}/${x}/postgresql:"
+ [[ -h ${USR_PATH}/${x}/postgresql ]] && \
+ ldpath+="${USR_PATH}/${x}/postgresql:"
done
ldpath="${ldpath%:}"
- local manpath="${B_PATH}/share/postgresql/man/"
+ local manpath="${USR_PATH}/share/postgresql/man/"
while [[ $[--index] -gt -1 ]] ; do
local curslot="${slots[$index]}"
for x in $(list_libdirs) ; do
- local lib_path="${B_PATH}/${x}/postgresql-${curslot}/${x}/"
+ local lib_path="${USR_PATH}/${x}/postgresql-${curslot}/${x}/"
[[ -d ${lib_path} ]] && ldpath+=":${lib_path}"
done
- local tmp_manpath="${B_PATH}/share/postgresql-${curslot}/man/"
+ local tmp_manpath="${USR_PATH}/share/postgresql-${curslot}/man/"
[[ -d ${tmp_manpath} ]] && manpath+=":${tmp_manpath}"
echo "done."
done