/usr/share/postgresql-common/maintscripts-functions is in postgresql-client-common 129.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | # This file contains common functionality for all postgresql server
# package maintainer scripts.
# arguments: version package master
_link_manpages() {
MANS=$(unset GREP_OPTIONS; dpkg -L $2|egrep '/man/.*\.[1-9](\.gz)?$' | grep -v "$3")
SLAVES=$(for i in $MANS; do TARGET=$(echo $i | sed "s/postgresql\/$1\///"); echo -n " --slave $TARGET $(basename $i) $i"; done)
update-alternatives --install /usr/share/man/man1/$3 \
$3 /usr/share/postgresql/$1/man/man1/$3 \
$(echo "$1" | tr -cd 0-9) $SLAVES
}
_unlink_manpages() {
update-alternatives --remove $3 /usr/share/postgresql/$1/man/man1/$3
}
_remove_tsearch() {
find /usr/share/postgresql/$1/tsearch_data -type l \( -name '*.dict' -o -name '*.affix' \) -exec rm '{}' \;
}
# arguments: <major version> <most recently configured package version>
configure_version() {
VERSION="$1"
# Create a main cluster for given version ($1) if no cluster already exists
# for that version and we are installing from scratch.
[ "$VERSION" ] || { echo "Error: configure_version: need version parameter" >&2; exit 1; }
if [ ! -d "/etc/postgresql/$VERSION" ] || [ -z "$(ls /etc/postgresql/$VERSION)" ] || \
[ -z "$(ls /etc/postgresql/$VERSION/*/postgresql.conf 2>/dev/null)" ]; then
[ "$2" ] || /usr/bin/pg_createcluster -u postgres $VERSION main || {
echo "Error: could not create default cluster. Please create it manually with
pg_createcluster $VERSION main --start
or a similar command (see 'man pg_createcluster')." >&2
}
fi
_link_manpages "$VERSION" "postgresql-$VERSION" postmaster.1.gz
if [ -x /etc/init.d/postgresql ] && [ ! -x /etc/init.d/postgresql-$VERSION ]; then
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d postgresql start $VERSION || exit $?
else
/etc/init.d/postgresql start $VERSION || exit $?
fi
fi
}
stop_version() {
if [ -x /etc/init.d/postgresql ] && [ ! -x /etc/init.d/postgresql-$1 ]; then
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d postgresql stop $1 || exit $?
else
/etc/init.d/postgresql stop $1 || exit $?
fi
fi
}
remove_version() {
_unlink_manpages "$1" "postgresql-$1" postmaster.1.gz
_remove_tsearch "$1"
}
configure_client_version() {
_link_manpages "$1" "postgresql-client-$1" psql.1.gz
}
remove_client_version() {
_unlink_manpages "$1" "postgresql-client-$1" psql.1.gz
}
configure_contrib_version() {
:
}
remove_contrib_version() {
:
}
|