patroni/debian/pg_createcluster_patroni
2020-05-07 12:29:43 +02:00

37 lines
686 B
Bash
Executable file

#!/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
# support both '-' and '/' as separator
if [ $(echo $SCOPE | grep -- -) ]
then
VERSION=$(echo $SCOPE | cut -d'-' -f1 )
CLUSTER=$(echo $SCOPE | cut -d'-' -f2- )
else
VERSION=$(echo $SCOPE | cut -d'/' -f1 )
CLUSTER=$(echo $SCOPE | cut -d'/' -f2- )
fi
if [ -n "$DATADIR" ]
then
pg_createcluster --start-conf=manual --datadir=$DATADIR $VERSION $CLUSTER
else
pg_createcluster --start-conf=manual $VERSION $CLUSTER
fi
exit $?