desktop-dockerized/prepare.sh

30 lines
759 B
Bash
Executable File

#!/bin/sh
# Check if Docker is running
if ! (docker ps >/dev/null 2>&1)
then
echo "Docker daemon not running, exiting"
exit
fi
read -e -p "Domain Guacamole should be served on [localhost]: " DOMAIN
DOMAIN=${DOMAIN:-localhost}
sed -i "s/localhost/$DOMAIN/g" ./caddy/Caddyfile
echo -n "Preparing folder guacamole/init and creating guacamole/init/initdb.sql ..."
mkdir -p ./guacamole/init
chmod -R +x ./guacamole/init
docker run --rm guacamole/guacamole /opt/guacamole/bin/initdb.sh --postgres > ./guacamole/init/initdb.sql
echo "done"
echo "Setting permissions for user directory (chown needs root)"
if $(sudo -v); then
mkdir -p ./user
sudo chown -R 10000:10000 ./user
else
echo "Sudo privileges not granted, skipped"
fi
echo "everything done"
exit 0