Skip to content

Commit e2f1011

Browse files
authored
Add koreader-nightly
fix #2061
1 parent fd13318 commit e2f1011

File tree

2 files changed

+81
-1
lines changed

2 files changed

+81
-1
lines changed

programs/x86_64-apps

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,8 @@
13071307
◆ konquest : Game of planets. This script installs the full "kdegames" suite.
13081308
◆ koodo-reader : Modern ebook manager and reader with sync & backup capacities.
13091309
◆ kopia : Cross-platform backup tool.
1310-
◆ koreader : A document viewer.
1310+
◆ koreader : A document viewer for E Ink devices. Supported fileformats include EPUB, PDF, DjVu, XPS, CBT, CBZ, FB2, PDB, TXT, HTML, RTF, CHM, DOC, MOBI and ZIP files. It’s available for Kindle, Kobo, PocketBook, Android and desktop Linux.
1311+
◆ koreader-nightly : A document viewer for E Ink devices. Supported fileformats include EPUB, PDF, DjVu, XPS, CBT, CBZ, FB2, PDB, TXT, HTML, RTF, CHM, DOC, MOBI and ZIP files. It’s available for Kindle, Kobo, PocketBook, Android and desktop Linux. Nightly build.
13111312
◆ kpat : Unofficial, Klondike, Spider, Free Cell and other Solitaire. This script installs the full "kdegames" suite.
13121313
◆ krecorder : Unofficial, An audio recording application. This script installs the full "kdeutils" suite.
13131314
◆ kreversi : Reversi game. This script installs the full "kdegames" suite.

programs/x86_64/koreader-nightly

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/sh
2+
3+
# AM INSTALL SCRIPT VERSION 3.5
4+
set -u
5+
APP=koreader-nightly
6+
SITE="http://koreader.rocks"
7+
8+
# CREATE DIRECTORIES AND ADD REMOVER
9+
[ -n "$APP" ] && mkdir -p "/opt/$APP/tmp" "/opt/$APP/icons" && cd "/opt/$APP/tmp" || exit 1
10+
printf "#!/bin/sh\nset -e\nrm -f /usr/local/bin/$APP\nrm -R -f /opt/$APP" > ../remove
11+
printf '\n%s' "rm -f /usr/local/share/applications/$APP-AM.desktop" >> ../remove
12+
chmod a+x ../remove || exit 1
13+
14+
# DOWNLOAD AND PREPARE THE APP, $version is also used for updates
15+
build=$(curl -Ls https://build.koreader.rocks/download/nightly/ | tr '"></ ' '\n' | grep "^v20" | sort -u --version-sort | tail -1)
16+
version="https://build.koreader.rocks/download/nightly/$build/$(curl -Ls "https://build.koreader.rocks/download/nightly/$build/" | tr '">< ' '\n' | grep -i "x86_64.*appimage$" | sort -u | head -1)"
17+
wget "$version" || exit 1
18+
# Keep this space in sync with other installation scripts
19+
# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded.
20+
cd ..
21+
mv ./tmp/*mage ./"$APP"
22+
# Keep this space in sync with other installation scripts
23+
rm -R -f ./tmp || exit 1
24+
echo "$version" > ./version
25+
chmod a+x ./"$APP" || exit 1
26+
27+
# LINK TO PATH
28+
ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP"
29+
30+
# SCRIPT TO UPDATE THE PROGRAM
31+
cat >> ./AM-updater << 'EOF'
32+
#!/bin/sh
33+
set -u
34+
APP=koreader-nightly
35+
SITE="http://koreader.rocks"
36+
version0=$(cat "/opt/$APP/version")
37+
build=$(curl -Ls https://build.koreader.rocks/download/nightly/ | tr '"></ ' '\n' | grep "^v20" | sort -u --version-sort | tail -1)
38+
version="https://build.koreader.rocks/download/nightly/$build/$(curl -Ls "https://build.koreader.rocks/download/nightly/$build/" | tr '">< ' '\n' | grep -i "x86_64.*appimage$" | sort -u | head -1)"
39+
[ -n "$version" ] || { echo "Error getting link"; exit 1; }
40+
if command -v appimageupdatetool >/dev/null 2>&1; then
41+
cd "/opt/$APP" || exit 1
42+
appimageupdatetool -Or ./"$APP" && chmod a+x ./"$APP" && echo "$version" > ./version && exit 0
43+
fi
44+
if [ "$version" != "$version0" ]; then
45+
mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1
46+
notify-send "A new version of $APP is available, please wait"
47+
wget "$version" || exit 1
48+
# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded.
49+
cd ..
50+
mv --backup=t ./tmp/*mage ./"$APP"
51+
chmod a+x ./"$APP" || exit 1
52+
echo "$version" > ./version
53+
rm -R -f ./*zs-old ./*.part ./tmp ./*~
54+
notify-send "$APP is updated!"
55+
else
56+
echo "Update not needed!"
57+
fi
58+
EOF
59+
chmod a+x ./AM-updater || exit 1
60+
61+
# LAUNCHER & ICON
62+
./"$APP" --appimage-extract *.desktop 1>/dev/null && mv ./squashfs-root/*.desktop ./"$APP".desktop
63+
./"$APP" --appimage-extract .DirIcon 1>/dev/null && mv ./squashfs-root/.DirIcon ./DirIcon
64+
COUNT=0
65+
while [ "$COUNT" -lt 10 ]; do # Tries to get the actual icon/desktop if it is a symlink to another symlink
66+
if [ -L ./"$APP".desktop ]; then
67+
LINKPATH="$(readlink ./"$APP".desktop | sed 's|^\./||' 2>/dev/null)"
68+
./"$APP" --appimage-extract "$LINKPATH" 1>/dev/null && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop
69+
fi
70+
if [ -L ./DirIcon ]; then
71+
LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)"
72+
./"$APP" --appimage-extract "$LINKPATH" 1>/dev/null && mv ./squashfs-root/"$LINKPATH" ./DirIcon
73+
fi
74+
[ ! -L ./"$APP".desktop ] && [ ! -L ./DirIcon ] && break
75+
COUNT=$((COUNT + 1))
76+
done
77+
sed -i "s#Exec=[^ ]*#Exec=$APP#g; s#Icon=.*#Icon=/opt/$APP/icons/$APP#g; s# --no-sandbox##g" ./"$APP".desktop
78+
mv ./"$APP".desktop /usr/local/share/applications/"$APP"-AM.desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null
79+
rm -R -f ./squashfs-root

0 commit comments

Comments
 (0)