scripts/install-posgtresql
2021-02-09 10:34:52 +01:00

23 lines
529 B
Bash
Executable file

#!/bin/sh
set -e
# shellcheck disable=SC1091
. /etc/weblate-bootstrap
cd /tmp
# Install postgresql
apt install -y postgresql
# Figure out current cluster version
# shellcheck disable=SC2012
CLUSTER_VERSION=$(ls /etc/postgresql | sort | tail -n1)
# Start cluster
pg_ctlcluster "$CLUSTER_VERSION" main start
# Create Weblate user and database
sudo -u postgres createuser --superuser weblate
sudo -u postgres createdb -O weblate weblate
sudo -u postgres psql -c "alter user weblate with encrypted password '$POSTGRES_PASS';"