docker-calibre-web/root/etc/cont-init.d/30-config
2019-06-04 20:48:24 -07:00

39 lines
1.3 KiB
Plaintext

#!/usr/bin/with-contenv bash
# create symlinks for database and log
[[ ! -f /config/app.db ]] && \
cp /defaults/app.db /config/app.db
[[ -f /app/calibre-web/app.db ]] && \
rm /app/calibre-web/app.db
[[ ! -L /app/calibre-web/app.db ]] && \
ln -s /config/app.db /app/calibre-web/app.db
# create symlinks for log
[[ ! -f /config/calibre-web.log ]] && \
touch /config/calibre-web.log
[[ -f /app/calibre-web/calibre-web.log ]] && \
rm /app/calibre-web/calibre-web.log
[[ ! -L /app/calibre-web/calibre-web.log ]] && \
ln -s /config/calibre-web.log /app/calibre-web/calibre-web.log
# create Google drive client_secrets.json file
[[ ! -f /config/client_secrets.json ]] && \
echo "{}" > /config/client_secrets.json
[[ -f /app/calibre-web/client_secrets.json ]] &&
rm /app/calibre-web/client_secrets.json
[[ ! -L /app/calibre-web/client_secrets.json ]] &&
ln -s /config/client_secrets.json /app/calibre-web/client_secrets.json
# create Google drive symlinks for database
[[ ! -f /config/gdrive.db ]] && \
cp /app/calibre-web/gdrive.db /config/gdrive.db
[[ -f /app/calibre-web/gdrive.db ]] && \
rm /app/calibre-web/gdrive.db
[[ ! -L /app/calibre-web/gdrive.db ]] && \
ln -s /config/gdrive.db /app/calibre-web/gdrive.db
# permissions
chown -R abc:abc \
/config \
/app/calibre-web