From 9dac6883f967b1ebff88a42e1462cd46fad91121 Mon Sep 17 00:00:00 2001 From: Michael Banck Date: Thu, 7 Feb 2019 17:58:52 +0100 Subject: [PATCH] * debian/pg_creatconfig_patroni: Remove --scope option in favor of pg_createcluster's regular "[options] " syntax. --- debian/changelog | 4 +++- debian/pg_createconfig_patroni | 31 +++++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index a201a77..a89120f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ patroni (1.5.4-7) UNRELEASED; urgency=medium - * + [ Michael Banck ] + * debian/pg_creatconfig_patroni: Remove --scope option in favor of + pg_createcluster's regular "[options] " syntax. -- Debian PostgreSQL Maintainers Mon, 04 Feb 2019 21:12:35 +0100 diff --git a/debian/pg_createconfig_patroni b/debian/pg_createconfig_patroni index 39b10dd..2b73a81 100755 --- a/debian/pg_createconfig_patroni +++ b/debian/pg_createconfig_patroni @@ -3,10 +3,6 @@ for i in "$@" do case $i in - --scope=*) - SCOPE="${i#*=}" - shift # past argument=value - ;; --hostip=*) HOSTIP="${i#*=}" shift # past argument=value @@ -29,11 +25,34 @@ case $i in esac done -if [ -z "$SCOPE" ]; then - echo "Required option --scope missing" +if [ -z "$2" ]; +then + echo "Usage: pg_creatconfig_patroni [options] " exit 1 +else + VERSION=$1 + echo $VERSION | egrep -q '^[[:digit:]]+\.?[[:digit:]]+$' + if [ $? -ne 0 ]; then + echo "Error: invalid version ${VERSION}" + exit 1 + fi + if [ ! -f /usr/lib/postgresql/${VERSION}/bin/initdb ]; then + echo "Error: no initdb program for version ${VERSION} found" + exit 1 + fi fi +if [ -z "$2" ]; +then + echo "Usage: pg_creatconfig_patroni [options] " + exit 1 +else + CLUSTER=$2 +fi + +echo "Version: $VERSION, Cluster: $CLUSTER" +exit 0 + if [ -z "$PORT" ]; then # try to guess next free port PORT=$(($(pg_lsclusters | awk '{print $3}' | grep -v Port | sort -n | tail -1) + 1))