@@ -12,20 +12,50 @@ printf '\n%s' "rm -f /usr/local/share/applications/$APP-AM.desktop" >> ../remove
1212chmod a+x ../remove || exit 1
1313
1414# DOWNLOAD AND PREPARE THE APP, $version is also used for updates
15- version=" https://bin.ceicer.com/appimagehelper/bin/appimagehelper- x86_64.AppImage "
16- wget " $version " || exit 1
17- wget " $version .zsync " 2> /dev/null # Comment out this line if you want to use zsync
15+ version=$( curl -Ls https://bin.ceicer.com/appimagehelper/bin/ | grep -i " x86_64.*appimage " | tr ' ">< ' ' \n ' | grep " ^[0-9]*-[0-9].*[0-9]$ " | head -1 )
16+ wget " https://bin.ceicer.com/appimagehelper/bin/ $( curl -Ls https://bin.ceicer.com/appimagehelper/bin/ | tr ' ">< ' ' \n ' | grep -i " ^appimagehelper.*x86_64.*appimage$ " | head -1 ) " || exit 1
17+ # Keep this space in sync with other installation scripts
1818# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded.
1919cd ..
2020mv ./tmp/* mage ./" $APP "
21- mv ./tmp/ * .zsync ./ " $APP " .zsync 2> /dev/null
21+ # Keep this space in sync with other installation scripts
2222rm -R -f ./tmp || exit 1
2323echo " $version " > ./version
2424chmod a+x ./" $APP " || exit 1
2525
2626# LINK TO PATH
2727ln -s " /opt/$APP /$APP " " /usr/local/bin/$APP "
2828
29+ # SCRIPT TO UPDATE THE PROGRAM
30+ cat >> ./AM-updater << 'EOF '
31+ #!/bin/sh
32+ set -u
33+ APP=appimagehelper
34+ SITE="https://gitlab.com/posktomten/appimagehelper"
35+ version0=$(cat "/opt/$APP/version")
36+ version=$(curl -Ls https://bin.ceicer.com/appimagehelper/bin/ | grep -i "x86_64.*appimage" | tr '">< ' '\n' | grep "^[0-9]*-[0-9].*[0-9]$" | head -1)
37+ [ -n "$version" ] || { echo "Error getting link"; exit 1; }
38+ if command -v appimageupdatetool >/dev/null 2>&1; then
39+ cd "/opt/$APP" || exit 1
40+ appimageupdatetool -Or ./"$APP" && chmod a+x ./"$APP" && echo "$version" > ./version && exit 0
41+ fi
42+ if [ "$version" != "$version0" ]; then
43+ mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1
44+ notify-send "A new version of $APP is available, please wait"
45+ wget "https://bin.ceicer.com/appimagehelper/bin/$(curl -Ls https://bin.ceicer.com/appimagehelper/bin/ | tr '">< ' '\n' | grep -i "^appimagehelper.*x86_64.*appimage$" | head -1)" || exit 1
46+ # Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded.
47+ cd ..
48+ mv --backup=t ./tmp/*mage ./"$APP"
49+ chmod a+x ./"$APP" || exit 1
50+ echo "$version" > ./version
51+ rm -R -f ./*zs-old ./*.part ./tmp ./*~
52+ notify-send "$APP is updated!"
53+ else
54+ echo "Update not needed!"
55+ fi
56+ EOF
57+ chmod a+x ./AM-updater || exit 1
58+
2959# LAUNCHER & ICON
3060./" $APP " --appimage-extract * .desktop 1> /dev/null && mv ./squashfs-root/* .desktop ./" $APP " .desktop
3161./" $APP " --appimage-extract .DirIcon 1> /dev/null && mv ./squashfs-root/.DirIcon ./DirIcon
0 commit comments