aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--postgresql.eselect36
1 files changed, 23 insertions, 13 deletions
diff --git a/postgresql.eselect b/postgresql.eselect
index 1e9ff3b..8d816dc 100644
--- a/postgresql.eselect
+++ b/postgresql.eselect
@@ -122,28 +122,36 @@ describe_list() {
}
do_list() {
- write_list_start "Available PostgreSQL Slots"
-
if $(is_output_mode brief) ; then
echo $(get_slots)
else
+ write_list_start "Available PostgreSQL Slots"
+
+ local provider
local slot
+ local bindir
for slot in $(get_slots) ; do
- local postgres_ebuilds=""
- local src
- for src in "${E_PATH}"/slots/${slot}/{server,service,base,docs} ; do
- [[ -r ${src} ]] && source "${src}"
- done
+ bindir="${B_PATH}/$(lib_dir)/postgresql-${slot}/bin"
+
+ # The output of `pg_config --version` also includes "PostgreSQL" in
+ # the string, which is a bit redundant.
+ provider=$("${bindir}"/pg_config --version | \
+ sed 's/[^0-9]*\(.*\)/\1/')
+
+ # Unless a file exists that's controlled by the 'server' use flag,
+ # report that it's client only.
+ [[ -e "${bindir}/postmaster" ]] || provider+=' (Clients Only)'
case "${slot}" in
- "$(active_slot)" ) write_kv_list_entry \
- "$(highlight_marker ${slot})" "${postgres_ebuilds//postgresql-/}";;
- * ) write_kv_list_entry \
- "${slot}" "${postgres_ebuilds//postgresql-/}";;
+ "$(active_slot)" )
+ write_kv_list_entry \
+ "$(highlight_marker ${slot})" "${provider}";;
+ * )
+ write_kv_list_entry "${slot}" "${provider}";;
esac
done
- [[ -z ${postgres_ebuilds} ]] && write_warning_msg "No slots available."
+ [[ -z "$(get_slots)" ]] && write_warning_msg "No slots available."
fi
}
@@ -292,8 +300,10 @@ do_update() {
local slot=$(active_slot)
# 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
local f
- for f in "${E_PATH}/active" "${E_PATH}/service"; do
+ for f in "${E_PATH}/active" "${E_PATH}/service" ; do
[[ -e "${f}" ]] && rm -f "${f}"
done