Merge pull request #473 from linuxserver/universal-calibre-s6v3

switch to hybrid (universal-calibre)
This commit is contained in:
aptalca 2022-08-30 13:25:00 -04:00 committed by GitHub
commit 83408a3fd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 128 additions and 0 deletions

View File

@ -0,0 +1,61 @@
#!/usr/bin/with-contenv bash
if [[ "$(uname -m)" == "armv7l" ]]; then
cat <<-EOF
********************************************************
********************************************************
* *
* !!!! *
* universal-calibre mod is not supported on armhf. *
* *
********************************************************
********************************************************
EOF
exit 0
fi
if [ ! -f /usr/bin/apt ]; then
cat <<-EOF
********************************************************
********************************************************
* *
* !!!! *
* universal-calibre mod is only supported on images *
* using an Ubuntu base image. *
* *
********************************************************
********************************************************
EOF
exit 0
fi
if ! dpkg -s xz-utils >/dev/null 2>&1; then
PACKAGES="xz-utils ${PACKAGES}"
fi
if [ ! -L /usr/lib/x86_64-linux-gnu/libGL.so.1 ]; then
PACKAGES="libgl1-mesa-glx ${PACKAGES}"
fi
if [ ! -L /usr/lib/x86_64-linux-gnu/libxdamage.so.1 ]; then
PACKAGES="libxdamage1 ${PACKAGES}"
fi
if [ ! -L /usr/lib/x86_64-linux-gnu/libEGL.so.1 ]; then
PACKAGES="libegl1 ${PACKAGES}"
fi
if [ ! -L /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0 ]; then
PACKAGES="libxkbcommon0 ${PACKAGES}"
fi
if [ ! -L /usr/lib/x86_64-linux-gnu/libOpenGL.so.0 ]; then
PACKAGES="libopengl0 ${PACKAGES}"
fi
if [ -n "${PACKAGES}" ]; then
echo "${PACKAGES}" >> /mod-repo-packages-to-install.list
echo "**** Adding calibre dependencies to package install list ****"
else
echo "**** Calibre dependencies already installed, skipping ****"
fi

View File

@ -0,0 +1 @@
oneshot

View File

@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-mod-universal-calibre-add-package/run

View File

@ -0,0 +1,63 @@
#!/usr/bin/with-contenv bash
if [[ "$(uname -m)" == "armv7l" ]]; then
cat <<-EOF
********************************************************
********************************************************
* *
* !!!! *
* universal-calibre mod is not supported on armhf. *
* *
********************************************************
********************************************************
EOF
exit 0
fi
if [ ! -f /usr/bin/apt ]; then
cat <<-EOF
********************************************************
********************************************************
* *
* !!!! *
* universal-calibre mod is only supported on images *
* using an Ubuntu base image. *
* *
********************************************************
********************************************************
EOF
exit 0
fi
export DEBIAN_FRONTEND="noninteractive"
CALIBRE_RELEASE="$(cat /CALIBRE_RELEASE)"
if [ -z ${CALIBRE_RELEASE+x} ]; then
CALIBRE_RELEASE=$(curl -sX GET "https://api.github.com/repos/kovidgoyal/calibre/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi
if [ ! -e /usr/bin/calibre-server ] || [ "${CALIBRE_RELEASE}" != "$(cat /config/.CALIBRE_RELEASE || :)" ]; then
echo "**** Installing/updating calibre ****"
rm -rf /app/calibre
mkdir -p \
/app/calibre
if [ "$(uname -m)" == "x86_64" ]; then
curl -o \
/tmp/calibre.txz -L \
"https://github.com/kovidgoyal/calibre/releases/download/${CALIBRE_RELEASE}/calibre-${CALIBRE_RELEASE:1}-x86_64.txz"
elif [ "$(uname -m)" == "aarch64" ]; then
curl -o \
/tmp/calibre.txz -L \
"https://github.com/kovidgoyal/calibre/releases/download/${CALIBRE_RELEASE}/calibre-${CALIBRE_RELEASE:1}-arm64.txz"
fi
tar xf \
/tmp/calibre.txz \
-C /app/calibre
rm /tmp/calibre.txz
/app/calibre/calibre_postinstall
echo "${CALIBRE_RELEASE}" > /config/.CALIBRE_RELEASE
else
echo "**** Calibre already installed, skipping ****"
fi

View File

@ -0,0 +1 @@
oneshot

View File

@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-mod-universal-calibre-setup/run