patroni/debian/pg_createcluster_patroni
2019-01-21 17:07:05 +01:00

32 lines
577 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 | sed -e 's/-.*//')
CLUSTER=$(echo $SCOPE | sed -e 's/.*-//')
else
VERSION=$(echo $SCOPE | sed -e 's/\/.*//')
CLUSTER=$(echo $SCOPE | sed -e 's/.*\///')
fi
pg_createcluster --start-conf=manual $VERSION $CLUSTER
exit $?