postgresql/postgresql-install-alternatives
Reinhard Max 15a35fecca Accepting request 545144 from home:darix:branches:server:database:postgresql
- instead of hardcoding version 10, just check if the prio is
  smaller than 80.

- simplify the postgresql-install-alternatives to only require the
  pg version and go from there.
  supported calls of the script are:
  /usr/share/postgresql/install-alternatives postgresqlXY
  /usr/share/postgresql/install-alternatives XY
  where XY can currently be: 92 93 94 95 96 10

OBS-URL: https://build.opensuse.org/request/show/545144
OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql?expand=0&rev=97
2017-11-24 12:45:09 +00:00

37 lines
630 B
Bash

#!/bin/bash
shopt -s nullglob
if test "$#" -ne 1; then
echo "usage: $0 pgversion" 1>&2
exit 1
fi
PRIO=$1
case "$PRIO" in
postgresql*)
PRIO="${PRIO##postgresql}"
;;
esac
PGBASEDIR=/usr/lib/postgresql$PRIO
if [ $PRIO -lt 80 ] ; then
PRIO="${PRIO}0"
fi
PGBINDIR=$PGBASEDIR/bin
for FILE in $PGBINDIR/*; do
NAME=$(basename $FILE)
DIR=/usr/bin
SLAVES="$SLAVES --slave $DIR/$NAME $NAME $FILE"
done
if test -n "$SLAVES"; then
update-alternatives --quiet --install \
/usr/lib/postgresql postgresql $PGBASEDIR $PRIO \
$SLAVES
else
update-alternatives --remove postgresql $PGBASEDIR
fi