Skip to content

Commit 189a72a

Browse files
authored
Merge pull request #747 from ivan-hc/dev
Implement "torsocks" and add filters for non x64 apps in template.am / update more installation scripts
2 parents 8c0dd7f + 02c3b66 commit 189a72a

File tree

204 files changed

+14705
-21122
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+14705
-21122
lines changed

APP-MANAGER

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
AMVERSION="6.15.1-1"
3+
AMVERSION="6.16"
44

55
# Determine main repository and branch
66
AMREPO="https://raw.githubusercontent.com/ivan-hc/AM/main"

modules/template.am

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,23 @@ function _template_if_github_source() {
3232
# CHECK THE DOWNLOAD LINK, THE ONE THAT POINTS TO THE LATEST RELEASE, NOTE THAT IT MAY BE A DEVELOPMENT VERSION, ADD "/latest" AFTER "/releases" TO POINT TO THE LAST STABLE VERSION
3333
q="'"
3434
if [ "$templatetype" == 0 ]; then
35-
FUNCTION='curl -Ls https://api.github.com/repos/'"$RESPONSE"'/releases | sed '"$q"'s/[()",{} ]/\\n/g'"$q"' | grep -oi "https.*mage$" | head -1'
35+
FUNCTION='curl -Ls https://api.github.com/repos/'"$RESPONSE"'/releases | sed '"$q"'s/[()",{} ]/\\n/g'"$q"' | grep -oi "https.*mage$" | grep -vi "i386\|i686\|aarch64\|arm64\|armv7l" | head -1'
3636
elif [ "$templatetype" == 2 ]; then
37-
FUNCTION='curl -Ls https://api.github.com/repos/'"$RESPONSE"'/releases | sed '"$q"'s/[()",{} ]/\\n/g'"$q"' | grep -oi "https.*"| head -1'
37+
FUNCTION='curl -Ls https://api.github.com/repos/'"$RESPONSE"'/releases | sed '"$q"'s/[()",{} ]/\\n/g'"$q"' | grep -oi "https.*" | grep -vi "i386\|i686\|aarch64\|arm64\|armv7l" | head -1'
3838
fi
3939
sed -i "s#FUNCTION)#$FUNCTION)#g" ./am-scripts/"$arch"/"$arg"
4040
}
4141

42+
function _template_test_github_url_if_torsocks_exists() {
43+
if [ -z "$GHURLPREVIEW" ]; then
44+
if command -v torsocks 1>/dev/null; then
45+
torsocks --shell "$GHURLPREVIEW"
46+
fi
47+
else
48+
echo "$GHURLPREVIEW"
49+
fi
50+
}
51+
4252
function _template_then_github_source() {
4353

4454
_template_if_github_source
@@ -62,9 +72,13 @@ function _template_then_github_source() {
6272
;;
6373
'Y'|'y'|*)
6474
if [ "$templatetype" == 0 ]; then
65-
echo ""; curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/"$RESPONSE"/releases$setlatest | sed 's/[()",{} ]/\n/g' | grep -oi "https.*mage$" | head -1
75+
echo ""
76+
GHURLPREVIEW=$(curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/"$RESPONSE"/releases$setlatest | sed 's/[()",{} ]/\n/g' | grep -oi "https.*mage$" | grep -vi "i386\|i686\|aarch64\|arm64\|armv7l" | head -1)
77+
_template_test_github_url_if_torsocks_exists
6678
elif [ "$templatetype" == 2 ]; then
67-
echo ""; curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/"$RESPONSE"/releases$setlatest | sed 's/[()",{} ]/\n/g' | grep -oi "https.*"| head -1
79+
echo ""
80+
GHURLPREVIEW=$(curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/"$RESPONSE"/releases$setlatest | sed 's/[()",{} ]/\n/g' | grep -oi "https.*" | grep -vi "i386\|i686\|aarch64\|arm64\|armv7l" | head -1)
81+
_template_test_github_url_if_torsocks_exists
6882
fi
6983
echo -e "\n The URL above is an example of what both\n the install and update scripts will point to.\n"
7084
;;
@@ -86,9 +100,13 @@ function _template_then_github_source() {
86100
;;
87101
'Y'|'y'|*)
88102
if [ "$templatetype" == 0 ]; then
89-
echo ""; curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/"$RESPONSE"/releases$setlatest | sed 's/[()",{} ]/\n/g' | grep -oi "https.*mage$" | grep -i "$response" | head -1
103+
echo ""
104+
GHURLPREVIEW=$(curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/"$RESPONSE"/releases$setlatest | sed 's/[()",{} ]/\n/g' | grep -oi "https.*mage$" | grep -vi "i386\|i686\|aarch64\|arm64\|armv7l" | grep -i "$response" | head -1)
105+
_template_test_github_url_if_torsocks_exists
90106
elif [ "$templatetype" == 2 ]; then
91-
echo ""; curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/"$RESPONSE"/releases$setlatest | sed 's/[()",{} ]/\n/g' | grep -oi "https.*" | grep -i "$response" | head -1
107+
echo ""
108+
GHURLPREVIEW=$(curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/"$RESPONSE"/releases$setlatest | sed 's/[()",{} ]/\n/g' | grep -oi "https.*" | grep -vi "i386\|i686\|aarch64\|arm64\|armv7l" | grep -i "$response" | head -1)
109+
_template_test_github_url_if_torsocks_exists
92110
fi
93111
echo -e "\n The URL above is an example of what both\n the install and update scripts will point to.\n"
94112
;;
@@ -109,9 +127,13 @@ function _template_then_github_source() {
109127
;;
110128
'Y'|'y'|*)
111129
if [ "$templatetype" == 0 ]; then
112-
echo ""; curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/"$RESPONSE"/releases$setlatest | sed 's/[()",{} ]/\n/g' | grep -oi "https.*mage$" | grep -v "$response" | head -1
130+
echo ""
131+
GHURLPREVIEW=$(curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/"$RESPONSE"/releases$setlatest | sed 's/[()",{} ]/\n/g' | grep -oi "https.*mage$" | grep -vi "i386\|i686\|aarch64\|arm64\|armv7l" | grep -v "$response" | head -1)
132+
_template_test_github_url_if_torsocks_exists
113133
elif [ "$templatetype" == 2 ]; then
114-
echo ""; curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/"$RESPONSE"/releases$setlatest | sed 's/[()",{} ]/\n/g' | grep -oi "https.*" | grep -v "$response" | head -1
134+
echo ""
135+
GHURLPREVIEW=$(curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/"$RESPONSE"/releases$setlatest | sed 's/[()",{} ]/\n/g' | grep -oi "https.*" | grep -vi "i386\|i686\|aarch64\|arm64\|armv7l" | grep -v "$response" | head -1)
136+
_template_test_github_url_if_torsocks_exists
115137
fi
116138
echo -e "\n The URL above is an example of what both\n the install and update scripts will point to.\n"
117139
;;
@@ -291,6 +313,8 @@ while [ -n "$1" ]; do
291313
_template_then_github_source
292314
elif echo "$RESPONSE" | grep -q "sourceforge"; then
293315
_template_if_sourceforge
316+
elif ! echo "$RESPONSE" | grep -q "://"; then
317+
_template_then_github_source
294318
else
295319
_template_if_hosted_elsewhere
296320
fi
@@ -374,6 +398,8 @@ while [ -n "$1" ]; do
374398
_template_then_github_source
375399
elif echo "$RESPONSE" | grep -q "sourceforge"; then
376400
_template_if_sourceforge
401+
elif ! echo "$RESPONSE" | grep -q "://"; then
402+
_template_then_github_source
377403
else
378404
_template_if_hosted_elsewhere
379405
fi

programs/x86_64-apps

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@
133133
◆ bazecor : Graphical configurator for Dygma Raise.
134134
◆ bbg-appimage : A static blog generator based on Electron Technology.
135135
◆ bdash : A simple business intelligence application.
136-
◆ beaker-ng : An experimental peer-to-peer Web browser.
137136
◆ beam-wallet : Beam Desktop Wallet.
138137
◆ beatconnect-client : Beatconnect power for osu irc.
139138
◆ beekeeper-studio : SQL query editor and database UI.
@@ -882,6 +881,7 @@
882881
◆ kade : A desktop application for Q Methodology.
883882
◆ kage : GUI for Metasploit Meterpreter and Session Handler.
884883
◆ kaidan : A QtQuick Jabber client.
884+
◆ kajongg : An ancient Chinese board game for 4 players (installs "kdegames").
885885
◆ kanon : Maturita GPJP designed for use with kanon web app.
886886
◆ kapman : Pac-Man clone (installs "kdegames").
887887
◆ kate : A multi-document editor part of KDE.

programs/x86_64/432hz-player

Lines changed: 59 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,74 @@
11
#!/bin/sh
22

3+
# AM INSTALL SCRIPT VERSION 3.5
4+
set -u
35
APP=432hz-player
4-
REPO="mysteryx93/NaturalGroundingPlayer"
6+
SITE="mysteryx93/NaturalGroundingPlayer"
57

6-
# CREATE THE FOLDER
7-
mkdir /opt/$APP
8-
cd /opt/$APP
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
913

10-
# ADD THE REMOVER
11-
echo '#!/bin/sh' >> /opt/$APP/remove
12-
echo "rm -R -f /usr/share/applications/AM-$APP.desktop /opt/$APP /usr/local/bin/$APP" >> /opt/$APP/remove
13-
chmod a+x /opt/$APP/remove
14-
15-
# DOWNLOAD THE ARCHIVE
16-
mkdir tmp
17-
cd ./tmp
18-
19-
version=$(curl -Ls https://api.github.com/repos/$REPO/releases | grep -i Player432Hz | grep x64| grep -w -v i386 | grep -w -v i686 | grep -w -v aarch64 | grep -w -v arm64 | grep -w -v armv7l | grep browser_download_url | grep -i appimage | cut -d '"' -f 4 | head -1)
20-
wget $version
21-
echo "$version" >> /opt/$APP/version
14+
# DOWNLOAD AND PREPARE THE APP, $version is also used for updates
15+
version=$(curl -Ls https://api.github.com/repos/mysteryx93/NaturalGroundingPlayer/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*player.*x64.*mage$" | head -1)
16+
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.
2219
cd ..
23-
mv ./tmp/*mage ./$APP
24-
chmod a+x /opt/$APP/$APP
25-
rmdir ./tmp
20+
mv ./tmp/*mage ./"$APP"
21+
mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null
22+
rm -R -f ./tmp || exit 1
23+
echo "$version" > ./version
24+
chmod a+x ./"$APP" || exit 1
2625

27-
# LINK
28-
ln -s /opt/$APP/$APP /usr/local/bin/$APP
26+
# LINK TO PATH
27+
ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP"
2928

3029
# SCRIPT TO UPDATE THE PROGRAM
31-
cat >> /opt/$APP/AM-updater << 'EOF'
32-
#!/usr/bin/env bash
30+
cat >> ./AM-updater << 'EOF'
31+
#!/bin/sh
32+
set -u
3333
APP=432hz-player
34-
REPO="mysteryx93/NaturalGroundingPlayer"
35-
version0=$(cat /opt/$APP/version)
36-
version=$(curl -Ls https://api.github.com/repos/$REPO/releases | grep -i Player432Hz | grep x64| grep -w -v i386 | grep -w -v i686 | grep -w -v aarch64 | grep -w -v arm64 | grep -w -v armv7l | grep browser_download_url | grep -i appimage | cut -d '"' -f 4 | head -1)
37-
if [ $version = $version0 ]; then
38-
echo "Update not needed!"
39-
else
40-
notify-send "A new version of $APP is available, please wait"
41-
mkdir /opt/$APP/tmp
42-
cd /opt/$APP/tmp
43-
wget $version
44-
if ls . | grep mage; then
34+
SITE="mysteryx93/NaturalGroundingPlayer"
35+
version0=$(cat "/opt/$APP/version")
36+
version=$(curl -Ls https://api.github.com/repos/mysteryx93/NaturalGroundingPlayer/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*player.*x64.*mage$" | head -1)
37+
[ -n "$version" ] || { echo "Error getting link"; exit 1; }
38+
if [ "$version" != "$version0" ] || [ -e /opt/"$APP"/*.zsync ]; then
39+
mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1
40+
[ -e ../*.zsync ] || notify-send "A new version of $APP is available, please wait"
41+
[ -e ../*.zsync ] && wget "$version.zsync" 2>/dev/null || { wget "$version" || exit 1; }
42+
# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded.
4543
cd ..
46-
if test -f ./tmp/*mage; then rm ./version
47-
fi
48-
echo $version >> ./version
49-
mv --backup=t ./tmp/*mage ./$APP
50-
chmod a+x /opt/$APP/$APP
51-
rm -R -f ./tmp ./*~
52-
fi
53-
notify-send "$APP is updated!"
44+
mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/*mage ./"$APP"
45+
[ -e ./*.zsync ] && { zsync ./"$APP".zsync || notify-send -u critical "zsync failed to update $APP"; }
46+
chmod a+x ./"$APP" || exit 1
47+
echo "$version" > ./version
48+
rm -R -f ./*zs-old ./*.part ./tmp ./*~
49+
notify-send "$APP is updated!"
50+
else
51+
echo "Update not needed!"
5452
fi
5553
EOF
56-
chmod a+x /opt/$APP/AM-updater
54+
chmod a+x ./AM-updater || exit 1
5755

5856
# LAUNCHER & ICON
59-
app=$(echo $APP | cut -c -3)
60-
cd /opt/$APP
61-
./$APP --appimage-extract *.desktop 1>/dev/null
62-
./$APP --appimage-extract share/applications/*.desktop 1>/dev/null
63-
./$APP --appimage-extract usr/share/applications/*.desktop 1>/dev/null
64-
mv squashfs-root/*.desktop ./$APP.desktop
65-
mv squashfs-root/share/applications/*.desktop ./$APP.desktop
66-
mv squashfs-root/usr/share/applications/*.desktop ./$APP.desktop
67-
if [ ! -e ./$APP.desktop ]; then
68-
rm ./$APP.desktop; ./$APP --appimage-extract usr/share/applications/*$app*.desktop
69-
mv squashfs-root/usr/share/applications/*.desktop ./$APP.desktop
70-
fi
71-
if [ ! -e ./$APP.desktop ]; then
72-
rm ./$APP.desktop; ./$APP --appimage-extract share/applications/*$app*.desktop 1>/dev/null
73-
mv squashfs-root/share/applications/*.desktop ./$APP.desktop
74-
fi
75-
CHANGEEXEC=$(cat ./$APP.desktop | grep Exec= | tr ' ' '\n' | tr '=' '\n' | tr '/' '\n' | grep $app | head -1)
76-
sed -i "s#$CHANGEEXEC#$APP#g" ./$APP.desktop
77-
sed -i "s#AppRun#$APP#g" ./$APP.desktop
78-
sed -i "s#Exec=/bin/#Exec=#g" ./$APP.desktop
79-
sed -i "s#Exec=/usr/bin/#Exec=#g" ./$APP.desktop
80-
CHANGEICON=$(cat ./$APP.desktop | grep Icon= | head -1)
81-
sed -i "s#$CHANGEICON#Icon=/opt/$APP/icons/$APP#g" ./$APP.desktop
82-
83-
mkdir icons
84-
./$APP --appimage-extract *.png 2>&1 | grep -v "squashfs-root"; mv ./squashfs-root/*$app* ./icons/$APP 2>/dev/null
85-
./$APP --appimage-extract *.svg 2>&1 | grep -v "squashfs-root"; mv ./squashfs-root/*$app* ./icons/$APP 2>/dev/null
86-
./$APP --appimage-extract share/icons/*/*/* 1>/dev/null
87-
./$APP --appimage-extract usr/share/icons/*/*/* 1>/dev/null
88-
./$APP --appimage-extract share/icons/*/*/*/* 1>/dev/null
89-
./$APP --appimage-extract usr/share/icons/*/*/*/* 1>/dev/null
90-
mv ./squashfs-root/share/icons/hicolor/22x22/apps/*$app* ./icons/$APP 2>/dev/null
91-
mv ./squashfs-root/share/icons/hicolor/24x24/apps/*$app* ./icons/$APP 2>/dev/null
92-
mv ./squashfs-root/share/icons/hicolor/32x32/apps/*$app* ./icons/$APP 2>/dev/null
93-
mv ./squashfs-root/share/icons/hicolor/48x48/apps/*$app* ./icons/$APP 2>/dev/null
94-
mv ./squashfs-root/share/icons/hicolor/64x64/apps/*$app* ./icons/$APP 2>/dev/null
95-
mv ./squashfs-root/share/icons/hicolor/128x128/apps/*$app* ./icons/$APP 2>/dev/null
96-
mv ./squashfs-root/share/icons/hicolor/256x256/apps/*$app* ./icons/$APP 2>/dev/null
97-
mv ./squashfs-root/share/icons/hicolor/512x512/apps/*$app* ./icons/$APP 2>/dev/null
98-
mv ./squashfs-root/share/icons/hicolor/scalable/apps/*$app* ./icons/$APP 2>/dev/null
99-
mv ./squashfs-root/usr/share/icons/hicolor/22x22/apps/*$app* ./icons/$APP 2>/dev/null
100-
mv ./squashfs-root/usr/share/icons/hicolor/24x24/apps/*$app* ./icons/$APP 2>/dev/null
101-
mv ./squashfs-root/usr/share/icons/hicolor/32x32/apps/*$app* ./icons/$APP 2>/dev/null
102-
mv ./squashfs-root/usr/share/icons/hicolor/48x48/apps/*$app* ./icons/$APP 2>/dev/null
103-
mv ./squashfs-root/usr/share/icons/hicolor/64x64/apps/*$app* ./icons/$APP 2>/dev/null
104-
mv ./squashfs-root/usr/share/icons/hicolor/128x128/apps/*$app* ./icons/$APP 2>/dev/null
105-
mv ./squashfs-root/usr/share/icons/hicolor/256x256/apps/*$app* ./icons/$APP 2>/dev/null
106-
mv ./squashfs-root/usr/share/icons/hicolor/512x512/apps/*$app* ./icons/$APP 2>/dev/null
107-
mv ./squashfs-root/usr/share/icons/hicolor/scalable/apps/*$app* ./icons/$APP 2>/dev/null
108-
109-
rm -R -f /opt/$APP/squashfs-root
110-
mv ./$APP.desktop /usr/share/applications/AM-$APP.desktop
111-
112-
113-
114-
57+
./"$APP" --appimage-extract *.desktop 1>/dev/null && mv ./squashfs-root/*.desktop ./"$APP".desktop
58+
./"$APP" --appimage-extract .DirIcon 1>/dev/null && mv ./squashfs-root/.DirIcon ./DirIcon
59+
COUNT=0
60+
while [ "$COUNT" -lt 10 ]; do # Tries to get the actual icon/desktop if it is a symlink to another symlink
61+
if [ -L ./"$APP".desktop ]; then
62+
LINKPATH="$(readlink ./"$APP".desktop | sed 's|^\./||' 2>/dev/null)"
63+
./"$APP" --appimage-extract "$LINKPATH" 1>/dev/null && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop
64+
fi
65+
if [ -L ./DirIcon ]; then
66+
LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)"
67+
./"$APP" --appimage-extract "$LINKPATH" 1>/dev/null && mv ./squashfs-root/"$LINKPATH" ./DirIcon
68+
fi
69+
[ ! -L ./"$APP".desktop ] && [ ! -L ./DirIcon ] && break
70+
COUNT=$((COUNT + 1))
71+
done
72+
sed -i "s#Exec=[^ ]*#Exec=$APP#g; s#Icon=.*#Icon=/opt/$APP/icons/$APP#g" ./"$APP".desktop
73+
mv ./"$APP".desktop /usr/local/share/applications/"$APP"-AM.desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null
74+
rm -R -f ./squashfs-root

0 commit comments

Comments
 (0)