Skip to content

Commit

Permalink
Merge pull request #5 from ragusa87/kepubify
Browse files Browse the repository at this point in the history
Kepubify support multiple arch
  • Loading branch information
SergioMendolia authored Nov 26, 2024
2 parents ce4cdcf + 41b92be commit b55154d
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 9 deletions.
12 changes: 3 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,9 @@ RUN install-php-extensions \
@composer

# Install kepubify (from https://github.com/linuxserver/docker-calibre-web/blob/master/Dockerfile)
RUN \
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='[""]'); \
fi && \
curl -o \
/usr/bin/kepubify -L \
https://github.com/pgaskin/kepubify/releases/download/${KEPUBIFY_RELEASE}/kepubify-linux-64bit && \
chmod +x /usr/bin/kepubify
COPY docker/get_kepubify_url.sh /usr/bin/get_kepubify_url.sh
RUN chmod +x /usr/bin/get_kepubify_url.sh ; \
URL=$(/usr/bin/get_kepubify_url.sh) && curl -f -vvv -o /usr/bin/kepubify -L "$URL" && chmod +x /usr/bin/kepubify

RUN a2enmod rewrite

Expand Down
43 changes: 43 additions & 0 deletions docker/get_kepubify_url.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh
set -e

KEPUBIFY_RELEASE="${1}"

# Get OS and architecture
OS=$(uname -s)
ARCH=$(uname -m)
case "$OS" in
Linux)
case "$ARCH" in
x86_64) BINARY="kepubify-linux-64bit" ;;
i686 | i386) BINARY="kepubify-linux-32bit" ;;
armv7l | armv6l) BINARY="kepubify-linux-arm" ;;
aarch64) BINARY="kepubify-linux-arm64" ;;
*) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;;
esac
;;
Darwin)
case "$ARCH" in
x86_64) BINARY="kepubify-darwin-64bit" ;;
arm64) BINARY="kepubify-darwin-arm64" ;;
*) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;;
esac
;;
Windows_NT)
case "$ARCH" in
x86_64) BINARY="kepubify-windows-64bit.exe" ;;
i686 | i386) BINARY="kepubify-windows-32bit.exe" ;;
arm64) BINARY="kepubify-windows-arm64.exe" ;;
*) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;;
esac
;;
*)
echo "Unsupported OS: $OS" >&2
exit 1
;;
esac
if [ "${KEPUBIFY_RELEASE}x" = "x" ]; then
KEPUBIFY_RELEASE=$(curl -f -sX GET "https://api.github.com/repos/pgaskin/kepubify/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]');
fi

echo "https://github.com/pgaskin/kepubify/releases/download/${KEPUBIFY_RELEASE}/${BINARY}"

0 comments on commit b55154d

Please sign in to comment.