Improve permissions handling, use CALIBRE_DBPATH

This commit is contained in:
TheSpad 2023-04-15 16:04:27 +01:00
parent 336e10ed70
commit 856b48cc74
No known key found for this signature in database
GPG Key ID: 08F06191F4587860
8 changed files with 21 additions and 43 deletions

View File

@ -15,7 +15,6 @@ RUN \
apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
git \
libldap2-dev \
libsasl2-dev \
python3-dev && \
@ -51,14 +50,15 @@ RUN \
/app/calibre-web --strip-components=1 && \
cd /app/calibre-web && \
pip3 install --no-cache-dir -U \
pip wheel && \
pip install --no-cache-dir -U --ignore-installed --find-links https://wheel-index.linuxserver.io/ubuntu/ -r \
pip \
wheel && \
pip3 install --no-cache-dir -U --ignore-installed --find-links https://wheel-index.linuxserver.io/ubuntu/ -r \
requirements.txt -r \
optional-requirements.txt && \
echo "***install kepubify" && \
if [ -z ${KEPUBIFY_RELEASE+x} ]; then \
KEPUBIFY_RELEASE=$(curl -sX GET "https://api.github.com/repos/pgaskin/kepubify/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
curl -o \
/usr/bin/kepubify -L \
@ -66,7 +66,6 @@ RUN \
echo "**** cleanup ****" && \
apt-get -y purge \
build-essential \
git \
libldap2-dev \
libsasl2-dev \
python3-dev && \

View File

@ -15,7 +15,6 @@ RUN \
apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
libffi-dev \
libjpeg-dev \
libldap2-dev \
@ -56,14 +55,15 @@ RUN \
/app/calibre-web --strip-components=1 && \
cd /app/calibre-web && \
pip3 install --no-cache-dir -U \
pip wheel && \
pip install --no-cache-dir -U --ignore-installed --find-links https://wheel-index.linuxserver.io/ubuntu/ -r \
pip \
wheel && \
pip3 install --no-cache-dir -U --ignore-installed --find-links https://wheel-index.linuxserver.io/ubuntu/ -r \
requirements.txt -r \
optional-requirements.txt && \
echo "***install kepubify" && \
if [ -z ${KEPUBIFY_RELEASE+x} ]; then \
KEPUBIFY_RELEASE=$(curl -sX GET "https://api.github.com/repos/pgaskin/kepubify/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
curl -o \
/usr/bin/kepubify -L \
@ -72,7 +72,6 @@ RUN \
apt-get -y purge \
build-essential \
cmake \
git \
libffi-dev \
libjpeg-dev \
libldap2-dev \

View File

@ -1,47 +1,24 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
# create symlinks for imagemagick policy.xml
rm -rf /etc/ImageMagick-6/policy.xml
ln -s /defaults/policy.xml /etc/ImageMagick-6/policy.xml
# create symlinks for database and log
if [[ ! -f /config/app.db ]] && [[ -f /app/calibre-web/app.db ]]; then
cp /defaults/app.db /config/app.db
fi
rm -rf /app/calibre-web/app.db
ln -s /config/app.db /app/calibre-web/app.db
# create symlinks for log
if [[ ! -f /config/calibre-web.log ]]; then
touch /config/calibre-web.log
fi
rm -rf /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
if [[ ! -f /config/client_secrets.json ]]; then
echo "{}" > /config/client_secrets.json
fi
rm -rf /app/calibre-web/client_secrets.json
ln -s /config/client_secrets.json /app/calibre-web/client_secrets.json
# create Google drive symlinks for database
if [[ ! -f /config/gdrive.db ]] && [[ -f /app/calibre-web/gdrive.db ]]; then
cp /app/calibre-web/gdrive.db /config/gdrive.db
fi
rm -rf /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
if [[ -f /usr/bin/kepubify ]] && [[ ! -x /usr/bin/kepubify ]]; then
chmod +x /usr/bin/kepubify
fi
# Symlink logfiles
if [[ ! -L "/app/calibre-web/calibre-web.log" ]]; then
ln -s /config/calibre-web.log /app/calibre-web/calibre-web.log
fi
# Pre-stage some files & directories for permissions purposes
mkdir -p /app/calibre-web/cps/cache
# permissions
chown -R abc:abc \
/config
lsiown -R abc:abc \
/config \
/app/calibre-web/cps/cache

View File

@ -1 +1 @@
oneshot
oneshot

View File

@ -1 +1 @@
/etc/s6-overlay/s6-rc.d/init-calibre-web-config/run
/etc/s6-overlay/s6-rc.d/init-calibre-web-config/run

View File

@ -1,4 +1,7 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
export CALIBRE_DBPATH=/config
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 8083" \

View File

@ -1 +1 @@
longrun
longrun