* debian/pg_createcluster_patroni, debian/pg_clonecluster_patroni: New files,

wrapper scripts that can be used for Patroni bootstrap or standby setup.
  * debian/patroni.install: Install them in /usr/share/patroni.
This commit is contained in:
Michael Banck 2018-10-22 18:40:17 +02:00
parent 5c467495c6
commit f9ee2d0854
4 changed files with 66 additions and 0 deletions

3
debian/changelog vendored
View file

@ -4,6 +4,9 @@ patroni (1.5.0-9) UNRELEASED; urgency=medium
* debian/patches/startup_scripts.patch: Add patroni service template
patroni@.service.
* debian/patroni.install: Install it.
* debian/pg_createcluster_patroni, debian/pg_clonecluster_patroni: New files,
wrapper scripts that can be used for Patroni bootstrap or standby setup.
* debian/patroni.install: Install them in /usr/share/patroni.
-- Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org> Sat, 06 Oct 2018 11:57:54 +0200

View file

@ -1,3 +1,5 @@
extras/startup-scripts/patroni etc/init.d
extras/startup-scripts/patroni.service lib/systemd/system
extras/startup-scripts/patroni@.service lib/systemd/system
debian/pg_clonecluster_patroni usr/share/patroni
debian/pg_createcluster_patroni usr/share/patroni

37
debian/pg_clonecluster_patroni vendored Executable file
View file

@ -0,0 +1,37 @@
#!/bin/sh
for i in "$@"
do
case $i in
--scope=*)
SCOPE="${i#*=}"
shift # past argument=value
;;
--role=*)
ROLE="${i#*=}"
shift # past argument=value
;;
--datadir=*)
DATADIR="${i#*=}"
shift # past argument=value
;;
--connstring=*)
CONNSTR="${i#*=}"
shift # past argument=value
;;
*)
# unknown option
;;
esac
done
VERSION=$(echo $SCOPE | sed -e 's/\/.*//')
CLUSTER=$(echo $SCOPE | sed -e 's/.*\///')
if [ -f /etc/postgresql/$VERSION/$CLUSTER/postgresql.conf ]
then
pg_dropcluster $VERSION $CLUSTER
fi
pg_createcluster $VERSION $CLUSTER && rm -rf $DATADIR && pg_basebackup --pgdata $DATADIR -X stream --dbname=$CONNSTR
exit $?

24
debian/pg_createcluster_patroni vendored Executable file
View file

@ -0,0 +1,24 @@
#!/bin/sh
for i in "$@"
do
case $i in
--scope=*)
SCOPE="${i#*=}"
shift # past argument=value
;;
--datadir=*)
DATADIR="${i#*=}"
shift # past argument=value
;;
*)
# unknown option
;;
esac
done
VERSION=$(echo $SCOPE | sed -e 's/\/.*//')
CLUSTER=$(echo $SCOPE | sed -e 's/.*\///')
pg_createcluster $VERSION $CLUSTER
exit $?