From b4b5754e7c0f9d1be9f98ca578bba10cbc417eab Mon Sep 17 00:00:00 2001
From: Philippe PITTOLI
Date: Thu, 24 Oct 2019 12:03:40 +0200
Subject: [PATCH] Postgresql user and database creation script.
---
utils/pg_create_user.sh | 117 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 117 insertions(+)
create mode 100755 utils/pg_create_user.sh
diff --git a/utils/pg_create_user.sh b/utils/pg_create_user.sh
new file mode 100755
index 0000000..d91c01d
--- /dev/null
+++ b/utils/pg_create_user.sh
@@ -0,0 +1,117 @@
+#!/usr/bin/env zsh
+
+: ${PGHOST:=localhost}
+: ${PGUSER:=postgres}
+
+# TODO: add default postgresql port
+: ${pgport}
+: ${dbname}
+
+: ${command}
+: ${cmdparameters}
+
+: ${simulation}
+
+function usage() {
+ cat < postgresql hostname
+--pgport=<...> postgresql port
+--pgdatadir=<...> postgresql data dir
+--pguser=<...> postgresql username
+--dbuser=<...> database username
+--dbpassfile=<...> database password file
+--dbname=<...> database name
+--simulation print commands
+
+command:
+ create_user
+ create_db
+ create_user_and_db
+END
+}
+
+function print_create_user() {
+ cat <