desktop-dockerized/prepare.sh

30 lines
759 B
Bash
Raw Normal View History

2022-08-28 16:51:11 +02:00
#!/bin/sh
# Check if Docker is running
2022-08-28 16:51:11 +02:00
if ! (docker ps >/dev/null 2>&1)
then
echo "Docker daemon not running, exiting"
2022-08-28 16:51:11 +02:00
exit
fi
read -e -p "Domain Guacamole should be served on [localhost]: " DOMAIN
DOMAIN=${DOMAIN:-localhost}
sed -i "s/localhost/$DOMAIN/g" ./caddy/Caddyfile
2022-08-28 16:51:11 +02:00
2022-08-28 17:04:43 +02:00
echo -n "Preparing folder guacamole/init and creating guacamole/init/initdb.sql ..."
2022-08-28 16:51:11 +02:00
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