33# AM INSTALL SCRIPT VERSION 3.5
44set -u
55APP=zen-browser
6- SITE=" zen-browser/desktop"
6+ SITE1=$( curl -Ls https://api.github.com/repos/zen-browser/desktop/releases | sed ' s/[()",{} ]/\n/g' | grep -oi " https.*generic.*mage$" | grep -vi " i386\|i686\|aarch64\|arm64\|armv7l" | head -1)
7+ SITE2=$( curl -Ls https://api.github.com/repos/zen-browser/desktop/releases | sed ' s/[()",{} ]/\n/g' | grep -oi " https.*specific.*mage$" | grep -vi " i386\|i686\|aarch64\|arm64\|armv7l" | head -1)
78
89# CREATE DIRECTORIES AND ADD REMOVER
910[ -n " $APP " ] && mkdir -p " /opt/$APP /tmp" " /opt/$APP /icons" && cd " /opt/$APP /tmp" || exit 1
1011printf " #!/bin/sh\nset -e\nrm -f /usr/local/bin/$APP \nrm -R -f /opt/$APP " > ../remove
1112printf ' \n%s' " rm -f /usr/local/share/applications/$APP -AM.desktop" >> ../remove
1213chmod a+x ../remove || exit 1
1314
15+ # CHOOSE A VERSION
16+ read -r -p "
17+ Choose which version of Zen Browser to use:
18+
19+ 1. Zen Browser Generic
20+ Official generic build, targets x86-64 generic.
21+ source: https://github.com/zen-browser
22+
23+ 2. Zen Browser Specific
24+ Official optimized build, targets x86-64 v3.
25+ Only works on CPUs equal or newer than Haswell/Excavator.
26+ source: https://github.com/zen-browser
27+
28+ Which version you choose (type a number and press ENTER)?: " RESPONSE
29+
30+ case " $RESPONSE " in
31+ 1)
32+ UPDATER=1
33+ version=" $SITE1 "
34+ ;;
35+
36+ 2)
37+ UPDATER=2
38+ version=" $SITE2 "
39+ ;;
40+
41+ * ) ../remove && echo " Not a valid number, aborting" && exit 1;;
42+ esac
43+
1444# DOWNLOAD AND PREPARE THE APP, $version is also used for updates
15- version=$( curl -Ls https://api.github.com/repos/zen-browser/desktop/releases | sed ' s/[()",{} ]/\n/g' | grep -oi " https.*mage$" | grep -vi " i386\|i686\|aarch64\|arm64\|armv7l" | head -1)
1645wget " $version " || exit 1
17- # wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync
18- # Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded.
1946cd ..
2047mv ./tmp/* mage ./" $APP "
2148mv ./tmp/* .zsync ./" $APP " .zsync 2> /dev/null
@@ -31,9 +58,10 @@ cat >> ./AM-updater << 'EOF'
3158#!/bin/sh
3259set -u
3360APP=zen-browser
34- SITE="zen-browser/desktop"
61+ #SITE1=$(curl -Ls https://api.github.com/repos/zen-browser/desktop/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*generic.*mage$" | grep -vi "i386\|i686\|aarch64\|arm64\|armv7l" | head -1)
62+ #SITE2=$(curl -Ls https://api.github.com/repos/zen-browser/desktop/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*specific.*mage$" | grep -vi "i386\|i686\|aarch64\|arm64\|armv7l" | head -1)
3563version0=$(cat "/opt/$APP/version")
36- version=$(curl -Ls https://api.github.com/repos/zen-browser/desktop/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*mage$" | grep -vi "i386\|i686\|aarch64\|arm64\|armv7l" | head -1)
64+ version="REPLACETHIS"
3765[ -n "$version" ] || { echo "Error getting link"; exit 1; }
3866if [ "$version" != "$version0" ] || [ -e /opt/"$APP"/*.zsync ]; then
3967 mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1
5179 echo "Update not needed!"
5280fi
5381EOF
82+ [ " $UPDATER " = 1 ] && { sed -i ' s|REPLACETHIS|$SITE1|g; s|#SITE1|SITE1|g' ./AM-updater || exit 1; }
83+ [ " $UPDATER " = 2 ] && { sed -i ' s|REPLACETHIS|$SITE2|g; s|#SITE2|SITE2|g' ./AM-updater || exit 1; }
5484chmod a+x ./AM-updater || exit 1
5585
86+
5687# LAUNCHER & ICON
5788./" $APP " --appimage-extract * .desktop 1> /dev/null && mv ./squashfs-root/* .desktop ./" $APP " .desktop
5889./" $APP " --appimage-extract .DirIcon 1> /dev/null && mv ./squashfs-root/.DirIcon ./DirIcon
0 commit comments