quasseldocker/postgres/prep.sh

24 lines
692 B
Bash
Executable File

#!/bin/bash
# removing the database cluster if it exists and prepping everything for posgresql operation
# be careful, Will Robinson!
# we need to be root for this
if [[ `whoami` != 'root' ]]; then
echo "we need to be root for this, quitting"
exit 1
fi
# work the directory
cd /var/lib/postgresql
chown postgres:postgres ./
chmod 0700 ./
# initdb as postgres
su -c '/usr/lib/postgresql/9.3/bin/initdb /var/lib/postgresql/9.3/main' postgres
# let quassel db
/etc/init.d/postgresql start
su -c 'psql --command "CREATE USER quassel;"' postgres
su -c "psql --command \"CREATE DATABASE quassel WITH OWNER quassel TEMPLATE template0 ENCODING 'UTF8';\"" postgres
/etc/init.d/postgresql stop