lbry-docker/www.spee.ch/docker-entrypoint.sh

43 lines
1.6 KiB
Bash
Raw Normal View History

2018-06-01 02:08:01 +02:00
#!/bin/ash
## This compose file will take a copy of the configuration and install any
## envvars and then copy any required files into the /app/ directory next to any
## custom files added by the user.
# default to run whatever the user wanted like "/bin/ash"
## If user runs no need to run any more of the entrypoint script.
if [[ -z "$@" ]]; then
echof info "User did not attempt input."
else
exec "$@"
exit 1
fi
# if Spee.ch is not yet installed, copy it into web root.
# This could be updated to be part of an upgrade mechanism.
if [ ! -e '/app/config/siteConfig.json' ]; then
2018-06-01 22:15:33 +02:00
echof warn "Spee.ch doesn't appear to have a configuration."
echof blank "Don't worry we can install it for you."
if [ "$(ls -A /app)" ]; then
echof warn "/app is not Empty. It contains:" 1>&2
ls -A 1>&2
2018-06-01 22:20:50 +02:00
echof info "Making an attempt to nicely merge files using:"
2018-06-01 22:15:33 +02:00
echof run "mv -fnu /usr/local/src/www.spee.ch/* /app/"
mv -fnu /usr/local/src/www.spee.ch/* /app/
else
echof run "mv /usr/local/src/www.spee.ch/* /app/"
mv /usr/local/src/www.spee.ch/* /app/
fi
echo "Spee.ch installed into /app"
2018-06-01 22:20:50 +02:00
## Finally reassert permissions in case there is user added drift.
rddo "test_for_dir" '775 "speech:speech"'
rfdo "test_for_file" '665 "speech:speech"'
## Define any exceptions here.
# test_for_dir /app/config 775 "speech:speech"
# test_for_file /app/config/siteConfig.json 665 "speech:speech"
2018-06-01 22:15:33 +02:00
echof info "Copied Spee.ch and set permissions"
fi
echof run 'test_for_dir /app/config/siteConfig.json 775 "speech:speech"'
test_for_file /app/config/siteConfig.json 775 "speech:speech"