* debian/pg_createconfig_patroni: Exit gracefully if iproute2 is not

installed.
This commit is contained in:
Michael Banck 2019-09-20 18:03:57 +02:00
parent 5d0a1b71cc
commit 69f8f7d410
2 changed files with 16 additions and 2 deletions

2
debian/changelog vendored
View file

@ -2,6 +2,8 @@ patroni (1.6.0-2) UNRELEASED; urgency=medium
[ Michael Banck ]
* debian/control: Recommend iproute2.
* debian/pg_createconfig_patroni: Exit gracefully if iproute2 is not
installed.
-- Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org> Wed, 21 Aug 2019 13:18:29 +0200

View file

@ -92,11 +92,23 @@ HOSTNAME=$(hostname)
# set default ipv4 address in case it was not provided
if [ -z "$HOSTIP" ]; then
HOSTIP=$(ip -4 route get 8.8.8.8 | grep ^8.8.8.8 | sed -e s/.*src.// -e s/\ .*//g)
if [ -x /bin/ip ]; then
HOSTIP=$(/bin/ip -4 route get 8.8.8.8 | grep ^8.8.8.8 | sed -e s/.*src.// -e s/\ .*//g)
else
echo "iproute2 package missing, cannot determine host ip addresss and --hostip is not set"
rm -f $CONFIG_FILE
exit 1
fi
fi
if [ -z "$NETWORK" ]; then
NETWORK=$(ip -4 route get 8.8.8.8 | grep ^8.8.8.8 | sed -e s/.*src.// -e s/\ .*//g -e s/\.[0-9]*$/.0/)/24
if [ -x /bin/ip ]; then
NETWORK=$(/bin/ip -4 route get 8.8.8.8 | grep ^8.8.8.8 | sed -e s/.*src.// -e s/\ .*//g -e s/\.[0-9]*$/.0/)/24
else
echo "iproute2 package missing, cannot determine network and --network is not set"
rm -f $CONFIG_FILE
exit 1
fi
fi
# add remaining patroni configuration from template