Files
docker-guacamole/root/etc/services.d/guacamole/run
T
2018-04-05 17:46:50 +10:00

24 lines
750 B
Plaintext

#!/usr/bin/with-contenv sh
until pg_isready; do
echo "Waiting for postgres to come up..."
sleep 1
done
# Create database if it does not exist
psql -U postgres -lqt | cut -d \| -f 1 | grep -qw $POSTGRES_DB
if [ $? -ne 0 ]; then
createuser -U postgres $POSTGRES_USER
createdb -U postgres -O $POSTGRES_USER $POSTGRES_DB
cat /app/guacamole/schema/*.sql | psql -U $POSTGRES_USER -d $POSTGRES_DB -f -
echo "0.9.14" > /config/.database-version
else
if [ "$(cat /config/.database-version)" != "0.9.14" ]; then
cat /app/guacamole/schema/upgrade/upgrade-pre-0.9.14.sql | psql -U $POSTGRES_USER -d $POSTGRES_DB -f -
echo "0.9.14" > /config/.database-version
fi
fi
echo "Starting guacamole client..."
s6-setuidgid root catalina.sh run