Skip to content

Commit

Permalink
Merge pull request #747 from ivan-hc/dev
Browse files Browse the repository at this point in the history
Implement "torsocks" and add filters for non x64 apps  in template.am / update more installation scripts
  • Loading branch information
ivan-hc authored Jul 2, 2024
2 parents 8c0dd7f + 02c3b66 commit 189a72a
Show file tree
Hide file tree
Showing 204 changed files with 14,705 additions and 21,122 deletions.
2 changes: 1 addition & 1 deletion APP-MANAGER
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

AMVERSION="6.15.1-1"
AMVERSION="6.16"

# Determine main repository and branch
AMREPO="https://raw.githubusercontent.com/ivan-hc/AM/main"
Expand Down
42 changes: 34 additions & 8 deletions modules/template.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,23 @@ function _template_if_github_source() {
# 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
q="'"
if [ "$templatetype" == 0 ]; then
FUNCTION='curl -Ls https://api.github.com/repos/'"$RESPONSE"'/releases | sed '"$q"'s/[()",{} ]/\\n/g'"$q"' | grep -oi "https.*mage$" | head -1'
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'
elif [ "$templatetype" == 2 ]; then
FUNCTION='curl -Ls https://api.github.com/repos/'"$RESPONSE"'/releases | sed '"$q"'s/[()",{} ]/\\n/g'"$q"' | grep -oi "https.*"| head -1'
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'
fi
sed -i "s#FUNCTION)#$FUNCTION)#g" ./am-scripts/"$arch"/"$arg"
}

function _template_test_github_url_if_torsocks_exists() {
if [ -z "$GHURLPREVIEW" ]; then
if command -v torsocks 1>/dev/null; then
torsocks --shell "$GHURLPREVIEW"
fi
else
echo "$GHURLPREVIEW"
fi
}

function _template_then_github_source() {

_template_if_github_source
Expand All @@ -62,9 +72,13 @@ function _template_then_github_source() {
;;
'Y'|'y'|*)
if [ "$templatetype" == 0 ]; then
echo ""; curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/"$RESPONSE"/releases$setlatest | sed 's/[()",{} ]/\n/g' | grep -oi "https.*mage$" | head -1
echo ""
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)
_template_test_github_url_if_torsocks_exists
elif [ "$templatetype" == 2 ]; then
echo ""; curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/"$RESPONSE"/releases$setlatest | sed 's/[()",{} ]/\n/g' | grep -oi "https.*"| head -1
echo ""
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)
_template_test_github_url_if_torsocks_exists
fi
echo -e "\n The URL above is an example of what both\n the install and update scripts will point to.\n"
;;
Expand All @@ -86,9 +100,13 @@ function _template_then_github_source() {
;;
'Y'|'y'|*)
if [ "$templatetype" == 0 ]; then
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
echo ""
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)
_template_test_github_url_if_torsocks_exists
elif [ "$templatetype" == 2 ]; then
echo ""; curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/"$RESPONSE"/releases$setlatest | sed 's/[()",{} ]/\n/g' | grep -oi "https.*" | grep -i "$response" | head -1
echo ""
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)
_template_test_github_url_if_torsocks_exists
fi
echo -e "\n The URL above is an example of what both\n the install and update scripts will point to.\n"
;;
Expand All @@ -109,9 +127,13 @@ function _template_then_github_source() {
;;
'Y'|'y'|*)
if [ "$templatetype" == 0 ]; then
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
echo ""
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)
_template_test_github_url_if_torsocks_exists
elif [ "$templatetype" == 2 ]; then
echo ""; curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/"$RESPONSE"/releases$setlatest | sed 's/[()",{} ]/\n/g' | grep -oi "https.*" | grep -v "$response" | head -1
echo ""
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)
_template_test_github_url_if_torsocks_exists
fi
echo -e "\n The URL above is an example of what both\n the install and update scripts will point to.\n"
;;
Expand Down Expand Up @@ -291,6 +313,8 @@ while [ -n "$1" ]; do
_template_then_github_source
elif echo "$RESPONSE" | grep -q "sourceforge"; then
_template_if_sourceforge
elif ! echo "$RESPONSE" | grep -q "://"; then
_template_then_github_source
else
_template_if_hosted_elsewhere
fi
Expand Down Expand Up @@ -374,6 +398,8 @@ while [ -n "$1" ]; do
_template_then_github_source
elif echo "$RESPONSE" | grep -q "sourceforge"; then
_template_if_sourceforge
elif ! echo "$RESPONSE" | grep -q "://"; then
_template_then_github_source
else
_template_if_hosted_elsewhere
fi
Expand Down
2 changes: 1 addition & 1 deletion programs/x86_64-apps
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@
◆ bazecor : Graphical configurator for Dygma Raise.
◆ bbg-appimage : A static blog generator based on Electron Technology.
◆ bdash : A simple business intelligence application.
◆ beaker-ng : An experimental peer-to-peer Web browser.
◆ beam-wallet : Beam Desktop Wallet.
◆ beatconnect-client : Beatconnect power for osu irc.
◆ beekeeper-studio : SQL query editor and database UI.
Expand Down Expand Up @@ -882,6 +881,7 @@
◆ kade : A desktop application for Q Methodology.
◆ kage : GUI for Metasploit Meterpreter and Session Handler.
◆ kaidan : A QtQuick Jabber client.
◆ kajongg : An ancient Chinese board game for 4 players (installs "kdegames").
◆ kanon : Maturita GPJP designed for use with kanon web app.
◆ kapman : Pac-Man clone (installs "kdegames").
◆ kate : A multi-document editor part of KDE.
Expand Down
158 changes: 59 additions & 99 deletions programs/x86_64/432hz-player
Original file line number Diff line number Diff line change
@@ -1,114 +1,74 @@
#!/bin/sh

# AM INSTALL SCRIPT VERSION 3.5
set -u
APP=432hz-player
REPO="mysteryx93/NaturalGroundingPlayer"
SITE="mysteryx93/NaturalGroundingPlayer"

# CREATE THE FOLDER
mkdir /opt/$APP
cd /opt/$APP
# CREATE DIRECTORIES AND ADD REMOVER
[ -n "$APP" ] && mkdir -p "/opt/$APP/tmp" "/opt/$APP/icons" && cd "/opt/$APP/tmp" || exit 1
printf "#!/bin/sh\nset -e\nrm -f /usr/local/bin/$APP\nrm -R -f /opt/$APP" > ../remove
printf '\n%s' "rm -f /usr/local/share/applications/$APP-AM.desktop" >> ../remove
chmod a+x ../remove || exit 1

# ADD THE REMOVER
echo '#!/bin/sh' >> /opt/$APP/remove
echo "rm -R -f /usr/share/applications/AM-$APP.desktop /opt/$APP /usr/local/bin/$APP" >> /opt/$APP/remove
chmod a+x /opt/$APP/remove

# DOWNLOAD THE ARCHIVE
mkdir tmp
cd ./tmp

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)
wget $version
echo "$version" >> /opt/$APP/version
# DOWNLOAD AND PREPARE THE APP, $version is also used for updates
version=$(curl -Ls https://api.github.com/repos/mysteryx93/NaturalGroundingPlayer/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*player.*x64.*mage$" | head -1)
wget "$version" || exit 1
#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync
# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded.
cd ..
mv ./tmp/*mage ./$APP
chmod a+x /opt/$APP/$APP
rmdir ./tmp
mv ./tmp/*mage ./"$APP"
mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null
rm -R -f ./tmp || exit 1
echo "$version" > ./version
chmod a+x ./"$APP" || exit 1

# LINK
ln -s /opt/$APP/$APP /usr/local/bin/$APP
# LINK TO PATH
ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP"

# SCRIPT TO UPDATE THE PROGRAM
cat >> /opt/$APP/AM-updater << 'EOF'
#!/usr/bin/env bash
cat >> ./AM-updater << 'EOF'
#!/bin/sh
set -u
APP=432hz-player
REPO="mysteryx93/NaturalGroundingPlayer"
version0=$(cat /opt/$APP/version)
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)
if [ $version = $version0 ]; then
echo "Update not needed!"
else
notify-send "A new version of $APP is available, please wait"
mkdir /opt/$APP/tmp
cd /opt/$APP/tmp
wget $version
if ls . | grep mage; then
SITE="mysteryx93/NaturalGroundingPlayer"
version0=$(cat "/opt/$APP/version")
version=$(curl -Ls https://api.github.com/repos/mysteryx93/NaturalGroundingPlayer/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*player.*x64.*mage$" | head -1)
[ -n "$version" ] || { echo "Error getting link"; exit 1; }
if [ "$version" != "$version0" ] || [ -e /opt/"$APP"/*.zsync ]; then
mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1
[ -e ../*.zsync ] || notify-send "A new version of $APP is available, please wait"
[ -e ../*.zsync ] && wget "$version.zsync" 2>/dev/null || { wget "$version" || exit 1; }
# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded.
cd ..
if test -f ./tmp/*mage; then rm ./version
fi
echo $version >> ./version
mv --backup=t ./tmp/*mage ./$APP
chmod a+x /opt/$APP/$APP
rm -R -f ./tmp ./*~
fi
notify-send "$APP is updated!"
mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/*mage ./"$APP"
[ -e ./*.zsync ] && { zsync ./"$APP".zsync || notify-send -u critical "zsync failed to update $APP"; }
chmod a+x ./"$APP" || exit 1
echo "$version" > ./version
rm -R -f ./*zs-old ./*.part ./tmp ./*~
notify-send "$APP is updated!"
else
echo "Update not needed!"
fi
EOF
chmod a+x /opt/$APP/AM-updater
chmod a+x ./AM-updater || exit 1

# LAUNCHER & ICON
app=$(echo $APP | cut -c -3)
cd /opt/$APP
./$APP --appimage-extract *.desktop 1>/dev/null
./$APP --appimage-extract share/applications/*.desktop 1>/dev/null
./$APP --appimage-extract usr/share/applications/*.desktop 1>/dev/null
mv squashfs-root/*.desktop ./$APP.desktop
mv squashfs-root/share/applications/*.desktop ./$APP.desktop
mv squashfs-root/usr/share/applications/*.desktop ./$APP.desktop
if [ ! -e ./$APP.desktop ]; then
rm ./$APP.desktop; ./$APP --appimage-extract usr/share/applications/*$app*.desktop
mv squashfs-root/usr/share/applications/*.desktop ./$APP.desktop
fi
if [ ! -e ./$APP.desktop ]; then
rm ./$APP.desktop; ./$APP --appimage-extract share/applications/*$app*.desktop 1>/dev/null
mv squashfs-root/share/applications/*.desktop ./$APP.desktop
fi
CHANGEEXEC=$(cat ./$APP.desktop | grep Exec= | tr ' ' '\n' | tr '=' '\n' | tr '/' '\n' | grep $app | head -1)
sed -i "s#$CHANGEEXEC#$APP#g" ./$APP.desktop
sed -i "s#AppRun#$APP#g" ./$APP.desktop
sed -i "s#Exec=/bin/#Exec=#g" ./$APP.desktop
sed -i "s#Exec=/usr/bin/#Exec=#g" ./$APP.desktop
CHANGEICON=$(cat ./$APP.desktop | grep Icon= | head -1)
sed -i "s#$CHANGEICON#Icon=/opt/$APP/icons/$APP#g" ./$APP.desktop

mkdir icons
./$APP --appimage-extract *.png 2>&1 | grep -v "squashfs-root"; mv ./squashfs-root/*$app* ./icons/$APP 2>/dev/null
./$APP --appimage-extract *.svg 2>&1 | grep -v "squashfs-root"; mv ./squashfs-root/*$app* ./icons/$APP 2>/dev/null
./$APP --appimage-extract share/icons/*/*/* 1>/dev/null
./$APP --appimage-extract usr/share/icons/*/*/* 1>/dev/null
./$APP --appimage-extract share/icons/*/*/*/* 1>/dev/null
./$APP --appimage-extract usr/share/icons/*/*/*/* 1>/dev/null
mv ./squashfs-root/share/icons/hicolor/22x22/apps/*$app* ./icons/$APP 2>/dev/null
mv ./squashfs-root/share/icons/hicolor/24x24/apps/*$app* ./icons/$APP 2>/dev/null
mv ./squashfs-root/share/icons/hicolor/32x32/apps/*$app* ./icons/$APP 2>/dev/null
mv ./squashfs-root/share/icons/hicolor/48x48/apps/*$app* ./icons/$APP 2>/dev/null
mv ./squashfs-root/share/icons/hicolor/64x64/apps/*$app* ./icons/$APP 2>/dev/null
mv ./squashfs-root/share/icons/hicolor/128x128/apps/*$app* ./icons/$APP 2>/dev/null
mv ./squashfs-root/share/icons/hicolor/256x256/apps/*$app* ./icons/$APP 2>/dev/null
mv ./squashfs-root/share/icons/hicolor/512x512/apps/*$app* ./icons/$APP 2>/dev/null
mv ./squashfs-root/share/icons/hicolor/scalable/apps/*$app* ./icons/$APP 2>/dev/null
mv ./squashfs-root/usr/share/icons/hicolor/22x22/apps/*$app* ./icons/$APP 2>/dev/null
mv ./squashfs-root/usr/share/icons/hicolor/24x24/apps/*$app* ./icons/$APP 2>/dev/null
mv ./squashfs-root/usr/share/icons/hicolor/32x32/apps/*$app* ./icons/$APP 2>/dev/null
mv ./squashfs-root/usr/share/icons/hicolor/48x48/apps/*$app* ./icons/$APP 2>/dev/null
mv ./squashfs-root/usr/share/icons/hicolor/64x64/apps/*$app* ./icons/$APP 2>/dev/null
mv ./squashfs-root/usr/share/icons/hicolor/128x128/apps/*$app* ./icons/$APP 2>/dev/null
mv ./squashfs-root/usr/share/icons/hicolor/256x256/apps/*$app* ./icons/$APP 2>/dev/null
mv ./squashfs-root/usr/share/icons/hicolor/512x512/apps/*$app* ./icons/$APP 2>/dev/null
mv ./squashfs-root/usr/share/icons/hicolor/scalable/apps/*$app* ./icons/$APP 2>/dev/null

rm -R -f /opt/$APP/squashfs-root
mv ./$APP.desktop /usr/share/applications/AM-$APP.desktop




./"$APP" --appimage-extract *.desktop 1>/dev/null && mv ./squashfs-root/*.desktop ./"$APP".desktop
./"$APP" --appimage-extract .DirIcon 1>/dev/null && mv ./squashfs-root/.DirIcon ./DirIcon
COUNT=0
while [ "$COUNT" -lt 10 ]; do # Tries to get the actual icon/desktop if it is a symlink to another symlink
if [ -L ./"$APP".desktop ]; then
LINKPATH="$(readlink ./"$APP".desktop | sed 's|^\./||' 2>/dev/null)"
./"$APP" --appimage-extract "$LINKPATH" 1>/dev/null && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop
fi
if [ -L ./DirIcon ]; then
LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)"
./"$APP" --appimage-extract "$LINKPATH" 1>/dev/null && mv ./squashfs-root/"$LINKPATH" ./DirIcon
fi
[ ! -L ./"$APP".desktop ] && [ ! -L ./DirIcon ] && break
COUNT=$((COUNT + 1))
done
sed -i "s#Exec=[^ ]*#Exec=$APP#g; s#Icon=.*#Icon=/opt/$APP/icons/$APP#g" ./"$APP".desktop
mv ./"$APP".desktop /usr/local/share/applications/"$APP"-AM.desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null
rm -R -f ./squashfs-root
Loading

0 comments on commit 189a72a

Please sign in to comment.