docker-calibre-web/root/etc/cont-init.d/30-config
2020-06-05 21:41:16 +01:00

50 lines
1.6 KiB
Plaintext

#!/usr/bin/with-contenv bash
# create symlinks for imagemagick policy.xml
[[ -f /etc/ImageMagick-6/policy.xml ]] && \
rm /etc/ImageMagick-6/policy.xml
[[ ! -L /etc/ImageMagick-6/policy.xml ]] && \
ln -s /defaults/policy.xml /etc/ImageMagick-6/policy.xml
# 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
# check if kepubify is present and if so make executable
[[ -f /usr/bin/kepubify ]] && \
[[ ! -x /usr/bin/kepubify ]] && \
chmod +x /usr/bin/kepubify
# permissions
chown -R abc:abc \
/config \
/app/calibre-web