diff --git a/.gitignore b/.gitignore index 14da8a03..a4b97f90 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,6 @@ vendor/ .pylint.d # calibre-web -*.db *.log cps/cache diff --git a/root/defaults/app.db b/root/defaults/app.db new file mode 100644 index 00000000..752e6916 Binary files /dev/null and b/root/defaults/app.db differ diff --git a/root/defaults/policy.xml b/root/defaults/policy.xml new file mode 100644 index 00000000..5ec3385c --- /dev/null +++ b/root/defaults/policy.xml @@ -0,0 +1,80 @@ + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/root/etc/cont-init.d/30-config b/root/etc/cont-init.d/30-config new file mode 100644 index 00000000..4ca17b9e --- /dev/null +++ b/root/etc/cont-init.d/30-config @@ -0,0 +1,49 @@ +#!/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 diff --git a/root/etc/services.d/calibre-web/run b/root/etc/services.d/calibre-web/run new file mode 100644 index 00000000..98523a39 --- /dev/null +++ b/root/etc/services.d/calibre-web/run @@ -0,0 +1,6 @@ +#!/usr/bin/with-contenv bash + +cd /app/calibre-web || exit + +exec \ + s6-setuidgid abc python3 /app/calibre-web/cps.py