Skip to content

Commit d4dca84

Browse files
authored
Merge pull request #806 from Samueru-sama/main
Update zen-browser
2 parents 8f6115a + b51a89c commit d4dca84

File tree

1 file changed

+37
-6
lines changed

1 file changed

+37
-6
lines changed

programs/x86_64/zen-browser

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,46 @@
33
# AM INSTALL SCRIPT VERSION 3.5
44
set -u
55
APP=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
1011
printf "#!/bin/sh\nset -e\nrm -f /usr/local/bin/$APP\nrm -R -f /opt/$APP" > ../remove
1112
printf '\n%s' "rm -f /usr/local/share/applications/$APP-AM.desktop" >> ../remove
1213
chmod 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)
1645
wget "$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.
1946
cd ..
2047
mv ./tmp/*mage ./"$APP"
2148
mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null
@@ -31,9 +58,10 @@ cat >> ./AM-updater << 'EOF'
3158
#!/bin/sh
3259
set -u
3360
APP=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)
3563
version0=$(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; }
3866
if [ "$version" != "$version0" ] || [ -e /opt/"$APP"/*.zsync ]; then
3967
mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1
@@ -51,8 +79,11 @@ else
5179
echo "Update not needed!"
5280
fi
5381
EOF
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; }
5484
chmod 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

Comments
 (0)