-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrelease.sh
executable file
·62 lines (54 loc) · 2.42 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash -e
KOREADER_VERSION="2024.11"
if [ "${NO_COMPRESSION}" == "true" ]; then
echo "Not using SquashFS compression"
MKSQUASHFS_ARGS=('-b' '1048576' '-always-use-fragments' '-noI' '-noD' '-noF' '-noX')
elif [ "${GZIP_COMPRESSION}" == "true" ]; then
MKSQUASHFS_ARGS=('-b' '1048576' '-comp' 'gzip' '-always-use-fragments')
else
MKSQUASHFS_ARGS=('-b' '1048576' '-comp' 'xz' '-Xdict-size' '100%' '-always-use-fragments')
fi
[ -z "${GITDIR}" ] && echo "Please provide the GITDIR environment variable." && exit 1
[ -z "${1}" ] && echo "Please provide the 'signature key' argument." && exit 1
[ -z "${2}" ] && echo "Please provide the 'version' argument." && exit 1
[ -z "${3}" ] && echo "Please provide the 'binaries build folders location' argument." && exit 1
cd "${GITDIR}"
# Copying compiled binaries
pushd "content/inkbox"
cp "${3}/build_inkbox/inkbox" "./inkbox-bin"
cp "${3}/build_oobe-inkbox/oobe-inkbox" "./oobe-inkbox-bin"
cp "${3}/build_lockscreen/lockscreen" "./lockscreen-bin"
popd
# Downloading and extracting KOReader package
if [ ! -d "content/koreader" ]; then
pushd "content"
if grep -q "kt/private.pem" <<< "${1}"; then
wget "https://github.com/koreader/koreader/releases/download/v${KOREADER_VERSION}/koreader-kindle-v${KOREADER_VERSION}.zip" -O koreader.zip
else
wget "https://github.com/koreader/koreader/releases/download/v${KOREADER_VERSION}/koreader-kobo-v${KOREADER_VERSION}.zip" -O koreader.zip
fi
unzip koreader.zip -x koreader.png && rm koreader.zip
mkdir -p koreader/data/dict && pushd koreader/data/dict
wget http://build.koreader.rocks/download/dict/gcide.tar.gz && tar -xvf gcide.tar.gz && mv gcide "GNU Collaborative International Dictionary of English" && rm gcide.tar.gz
popd
popd
fi
# Squashing packages
rm -rf "out/"
mkdir -p "out/update-bundle" && pushd "out/update-bundle"
echo "${2}" > "./version"
cp "${GITDIR}/content/license" "./license"
cp "${GITDIR}/content/changelog" "./changelog"
mksquashfs "${GITDIR}/content/inkbox" "./inkbox.isa" "${MKSQUASHFS_ARGS[@]}" -all-root
mksquashfs "${GITDIR}/content/qt" "./qt.isa" "${MKSQUASHFS_ARGS[@]}" -all-root
mksquashfs "${GITDIR}/content/koreader" "./koreader.isa" "${MKSQUASHFS_ARGS[@]}" -all-root
for f in *.isa; do
if [ "${f}" != "*" ]; then
openssl dgst -sha256 -sign "${1}" -out "${f}.dgst" "${f}"
fi
done
sync
# Creating final GUI bundle
mksquashfs "${GITDIR}/out/update-bundle" "${GITDIR}/out/update.isa" "${MKSQUASHFS_ARGS[@]}" -all-root
sync
exit 0