Skip to content

Commit a68c477

Browse files
authored
Merge pull request #951 from linuxserver/universal-calibre-bundle-binaries
2 parents 4813231 + ef884b9 commit a68c477

3 files changed

Lines changed: 35 additions & 43 deletions

File tree

.github/workflows/BuildImage.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
name: Build Image
22

3-
on: [push, pull_request_target, workflow_dispatch]
3+
on:
4+
push:
5+
pull_request_target:
6+
workflow_dispatch:
7+
inputs:
8+
mod_version:
9+
type: string
10+
required: false
411

512
env:
13+
MOD_VERSION: ${{ inputs.mod_version }}
614
GITHUB_REPO: "linuxserver/docker-mods" #don't modify
715
ENDPOINT: "linuxserver/mods" #don't modify
816
BASEIMAGE: "universal" #replace
917
MODNAME: "calibre" #replace
18+
MULTI_ARCH: "true" #set to false if not needed
1019

1120
jobs:
1221
set-vars:
@@ -19,15 +28,23 @@ jobs:
1928
echo "ENDPOINT=${{ env.ENDPOINT }}" >> $GITHUB_OUTPUT
2029
echo "BASEIMAGE=${{ env.BASEIMAGE }}" >> $GITHUB_OUTPUT
2130
echo "MODNAME=${{ env.MODNAME }}" >> $GITHUB_OUTPUT
31+
echo "MULTI_ARCH=${{ env.MULTI_ARCH }}" >> $GITHUB_OUTPUT
2232
# **** If the mod needs to be versioned, set the versioning logic below. Otherwise leave as is. ****
23-
MOD_VERSION=$(curl -sX GET "https://api.github.com/repos/kovidgoyal/calibre/releases/latest" | jq -r '.tag_name')
33+
if [[ -z "${{ env.MOD_VERSION }}" ]]; then
34+
MOD_VERSION=$(curl -sX GET "https://api.github.com/repos/kovidgoyal/calibre/releases/latest" | jq -r '.tag_name')
35+
else
36+
MOD_VERSION=${{ env.MOD_VERSION }}
37+
echo "MOD_VERSION_OVERRIDE=true" >> $GITHUB_OUTPUT
38+
fi
2439
echo "MOD_VERSION=${MOD_VERSION}" >> $GITHUB_OUTPUT
2540
outputs:
2641
GITHUB_REPO: ${{ steps.outputs.outputs.GITHUB_REPO }}
2742
ENDPOINT: ${{ steps.outputs.outputs.ENDPOINT }}
2843
BASEIMAGE: ${{ steps.outputs.outputs.BASEIMAGE }}
2944
MODNAME: ${{ steps.outputs.outputs.MODNAME }}
45+
MULTI_ARCH: ${{ steps.outputs.outputs.MULTI_ARCH }}
3046
MOD_VERSION: ${{ steps.outputs.outputs.MOD_VERSION }}
47+
MOD_VERSION_OVERRIDE: ${{ steps.outputs.outputs.MOD_VERSION_OVERRIDE }}
3148

3249
build:
3350
uses: linuxserver/github-workflows/.github/workflows/docker-mod-builder.yml@v1
@@ -42,4 +59,6 @@ jobs:
4259
ENDPOINT: ${{ needs.set-vars.outputs.ENDPOINT }}
4360
BASEIMAGE: ${{ needs.set-vars.outputs.BASEIMAGE }}
4461
MODNAME: ${{ needs.set-vars.outputs.MODNAME }}
62+
MULTI_ARCH: ${{ needs.set-vars.outputs.MULTI_ARCH }}
4563
MOD_VERSION: ${{ needs.set-vars.outputs.MOD_VERSION }}
64+
MOD_VERSION_OVERRIDE: ${{ needs.set-vars.outputs.MOD_VERSION_OVERRIDE }}

Dockerfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# syntax=docker/dockerfile:1
22

33
## Buildstage ##
4-
FROM ghcr.io/linuxserver/baseimage-alpine:3.19 AS buildstage
4+
FROM ghcr.io/linuxserver/baseimage-alpine:3.20 AS buildstage
55

66
ARG MOD_VERSION
77

@@ -12,6 +12,15 @@ RUN \
1212
MOD_VERSION=$(curl -sX GET "https://api.github.com/repos/kovidgoyal/calibre/releases/latest" \
1313
| jq -r '.tag_name'); \
1414
fi && \
15+
if [ "$(uname -m)" == "x86_64" ]; then \
16+
curl -o \
17+
/root-layer/calibre.txz -L \
18+
"https://download.calibre-ebook.com/${MOD_VERSION:1}/calibre-${MOD_VERSION:1}-x86_64.txz"; \
19+
elif [ "$(uname -m)" == "aarch64" ]; then \
20+
curl -o \
21+
/root-layer/calibre.txz -L \
22+
"https://download.calibre-ebook.com/${MOD_VERSION:1}/calibre-${MOD_VERSION:1}-arm64.txz"; \
23+
fi && \
1524
echo $MOD_VERSION > /root-layer/CALIBRE_RELEASE
1625

1726
# copy local files
Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
#!/usr/bin/with-contenv bash
22

3-
if [[ "$(uname -m)" == "armv7l" ]]; then
4-
cat <<-EOF
5-
********************************************************
6-
********************************************************
7-
* *
8-
* !!!! *
9-
* universal-calibre mod is not supported on armhf. *
10-
* *
11-
********************************************************
12-
********************************************************
13-
EOF
14-
exit 0
15-
fi
16-
17-
if [ ! -f /usr/bin/apt ]; then
3+
if [[ ! -f /usr/bin/apt ]]; then
184
cat <<-EOF
195
********************************************************
206
********************************************************
@@ -31,33 +17,11 @@ fi
3117

3218
export DEBIAN_FRONTEND="noninteractive"
3319

34-
CALIBRE_RELEASE="$(cat /CALIBRE_RELEASE)"
35-
if [ -z ${CALIBRE_RELEASE+x} ]; then
36-
CALIBRE_RELEASE=$(curl -sX GET "https://api.github.com/repos/kovidgoyal/calibre/releases/latest" \
37-
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
38-
fi
39-
40-
41-
if [ ! -e /usr/bin/calibre-server ] || [ "${CALIBRE_RELEASE}" != "$(cat /config/.CALIBRE_RELEASE || :)" ]; then
42-
echo "**** Installing/updating calibre ****"
43-
rm -rf /app/calibre
44-
mkdir -p \
45-
/app/calibre
46-
if [ "$(uname -m)" == "x86_64" ]; then
47-
curl -o \
48-
/tmp/calibre.txz -L \
49-
"https://github.com/kovidgoyal/calibre/releases/download/${CALIBRE_RELEASE}/calibre-${CALIBRE_RELEASE:1}-x86_64.txz"
50-
elif [ "$(uname -m)" == "aarch64" ]; then
51-
curl -o \
52-
/tmp/calibre.txz -L \
53-
"https://github.com/kovidgoyal/calibre/releases/download/${CALIBRE_RELEASE}/calibre-${CALIBRE_RELEASE:1}-arm64.txz"
54-
fi
20+
if [[ -e /tmp/calibre.txz ]]; then
5521
tar xf \
5622
/tmp/calibre.txz \
5723
-C /app/calibre
58-
rm /tmp/calibre.txz
24+
echo "Installing Calibre version $(cat /CALIBRE_RELEASE)"
5925
/app/calibre/calibre_postinstall
60-
echo "${CALIBRE_RELEASE}" > /config/.CALIBRE_RELEASE
61-
else
62-
echo "**** Calibre already installed, skipping ****"
26+
rm /tmp/calibre.txz
6327
fi

0 commit comments

Comments
 (0)