postgresql/postgresql-install-alternatives

28 lines
494 B
Plaintext
Raw Normal View History

#!/bin/bash
shopt -s nullglob
if test "$#" -ne 2; then
echo "usage: $0 basedir priority" 1>&2
exit 1
fi
PGBASEDIR=$1
PRIO=$2
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