build files for making podman containers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

13 lines
355 B

#!/bin/bash
cmd() {
sudo -u postgres psql -c "$1"
}
cd /var/lib/postgresql
cmd "DROP DATABASE IF EXISTS ${DBNAME:?};"
cmd "DROP USER IF EXISTS ${DBUSER:?};"
cmd "CREATE USER ${DBUSER:?};"
cmd "CREATE DATABASE ${DBNAME:?};"
cmd "ALTER DATABASE ${DBNAME:?} OWNER TO ${DBUSER:?};"
cmd "GRANT ALL PRIVILEGES ON DATABASE ${DBNAME:?} TO ${DBUSER:?};"