From 6bb80708e22433d6aff983a27c46760c7d60c397 Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Wed, 26 Jun 2024 21:42:37 +0200 Subject: [PATCH 01/10] Update template.am: eperimental support for sourceforge --- modules/template.am | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/modules/template.am b/modules/template.am index d39d649ca..f114d49b8 100644 --- a/modules/template.am +++ b/modules/template.am @@ -114,6 +114,32 @@ function _template_then_github_source() { esac } +function _template_if_sourceforge() { + sed -i "s#REPLACETHIS#$RESPONSE#g" ./am-scripts/"$arch"/"$arg" + # ADD A DESCRIPTION FOR THIS APPLICATION + read -r -ep " ◆ ADD A BRIEF DESCRIPTION FOR THIS APPLICATION $(echo -e '\n : ')" COMMENT + case "$COMMENT" in + *) + # CREATE A WEBPAGE FOR https://portable-linux-apps.github.io CONTAINING ALL THE INFO ABOUT THIS APP + echo "# $(echo "$arg" | tr '[:lower:]' '[:upper:]')" >> ./am-scripts/portable-linux-apps.github.io/apps/"$arg".md + echo -e "\n $COMMENT\n\n SITE: $RESPONSE\n\n | [Applications](https://portable-linux-apps.github.io/apps.html) | [Home](https://portable-linux-apps.github.io)\n | --- | --- |" >> ./am-scripts/portable-linux-apps.github.io/apps/"$arg".md && + # CREATE A NEW LINE FOR THE APPLICATION'S LIST + echo "◆ $arg : $COMMENT" >> ./am-scripts/list + ;; + esac + echo "-----------------------------------------------------------------------" + mv ./am-scripts/"$arch"/"$arg" ./am-scripts/"$arch"/"$arg".old + sed -n '1,14p' ./am-scripts/"$arch"/"$arg".old >> ./am-scripts/"$arch"/"$arg" + echo "version=\$(curl -Ls https://sourceforge.net/p/$arg/activity/feed | grep -Eo \"(http|https)://[a-zA-Z0-9./?=_%:-]*\" | grep -i appimage | head -1 | sed 's#https%3A//sourceforge.net##g')" >> ./am-scripts/"$arch"/"$arg" + sed -n '16,35p' ./am-scripts/"$arch"/"$arg".old >> ./am-scripts/"$arch"/"$arg" + echo "version=\$(curl -Ls https://sourceforge.net/p/$arg/activity/feed | grep -Eo \"(http|https)://[a-zA-Z0-9./?=_%:-]*\" | grep -i appimage | head -1 | sed 's#https%3A//sourceforge.net##g')" >> ./am-scripts/"$arch"/"$arg" + sed -n '37,132p' ./am-scripts/"$arch"/"$arg".old >> ./am-scripts/"$arch"/"$arg" + rm -f ./am-scripts/"$arch"/"$arg".old + sed -i 's#./tmp/*mage#./tmp/download#g' ./am-scripts/"$arch"/"$arg" + curl -Ls https://sourceforge.net/p/$arg/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i appimage | head -1 | sed 's#https%3A//sourceforge.net##g' + echo -e "\n The URL above is an example of what both\n the install and update scripts will point to.\n" +} + function _template_if_hosted_elsewhere() { sed -i "s#REPLACETHIS#$RESPONSE#g" ./am-scripts/"$arch"/"$arg" # ADD A DESCRIPTION FOR THIS APPLICATION @@ -230,6 +256,8 @@ while [ -n "$1" ]; do *) if echo "$RESPONSE" | grep -q "https://github.com"; then _template_then_github_source + elif echo "$RESPONSE" | grep -q "https://sourceforge.net"; then + _template_if_sourceforge else _template_if_hosted_elsewhere fi From 01a1544cd403d46676a372553b760d6cf247801d Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Wed, 26 Jun 2024 21:52:23 +0200 Subject: [PATCH 02/10] Run the new function for any sourceforge reference (option -t) --- modules/template.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/template.am b/modules/template.am index f114d49b8..11b077942 100644 --- a/modules/template.am +++ b/modules/template.am @@ -256,7 +256,7 @@ while [ -n "$1" ]; do *) if echo "$RESPONSE" | grep -q "https://github.com"; then _template_then_github_source - elif echo "$RESPONSE" | grep -q "https://sourceforge.net"; then + elif echo "$RESPONSE" | grep -q "sourceforge"; then _template_if_sourceforge else _template_if_hosted_elsewhere From 33219b4d95aa5fd9dcd8b16cd9b718960aa75143 Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Thu, 27 Jun 2024 00:32:37 +0200 Subject: [PATCH 03/10] Update template.am: improve function for sourceforge --- modules/template.am | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/modules/template.am b/modules/template.am index 11b077942..94af3ea7f 100644 --- a/modules/template.am +++ b/modules/template.am @@ -116,6 +116,22 @@ function _template_then_github_source() { function _template_if_sourceforge() { sed -i "s#REPLACETHIS#$RESPONSE#g" ./am-scripts/"$arch"/"$arg" + # ADD PROJECTNAME + read -r -ep " ◆ ADD THE NAME OF THE PROJECT OR LEAVE BLANK IF ITS THE SAME $(echo -e '\n : ')" projectname + case "$projectname" in + '') SOURCEFORGE="https://sourceforge.net/p/$arg/activity/feed";; + *) SOURCEFORGE="https://sourceforge.net/p/$projectname/activity/feed";; + esac + echo "-----------------------------------------------------------------------" + # FILE TYPE + if [ "$templatetype" == 0 ]; then + filetype="appimage" + elif [ "$templatetype" == 2 ]; then + read -r -ep " ◆ ADD an univoque keyword for the file (for example \"tar.gz\", \"linux\"):" filekeyword + case "$filekeyword" in + *) filetype="$filekeyword";; + esac + fi # ADD A DESCRIPTION FOR THIS APPLICATION read -r -ep " ◆ ADD A BRIEF DESCRIPTION FOR THIS APPLICATION $(echo -e '\n : ')" COMMENT case "$COMMENT" in @@ -130,13 +146,13 @@ function _template_if_sourceforge() { echo "-----------------------------------------------------------------------" mv ./am-scripts/"$arch"/"$arg" ./am-scripts/"$arch"/"$arg".old sed -n '1,14p' ./am-scripts/"$arch"/"$arg".old >> ./am-scripts/"$arch"/"$arg" - echo "version=\$(curl -Ls https://sourceforge.net/p/$arg/activity/feed | grep -Eo \"(http|https)://[a-zA-Z0-9./?=_%:-]*\" | grep -i appimage | head -1 | sed 's#https%3A//sourceforge.net##g')" >> ./am-scripts/"$arch"/"$arg" + echo "version=\$(curl -Ls $SOURCEFORGE | grep -Eo \"(http|https)://[a-zA-Z0-9./?=_%:-]*\" | grep -i \"$filetype\" | grep -v '%' | head -1)" >> ./am-scripts/"$arch"/"$arg" sed -n '16,35p' ./am-scripts/"$arch"/"$arg".old >> ./am-scripts/"$arch"/"$arg" - echo "version=\$(curl -Ls https://sourceforge.net/p/$arg/activity/feed | grep -Eo \"(http|https)://[a-zA-Z0-9./?=_%:-]*\" | grep -i appimage | head -1 | sed 's#https%3A//sourceforge.net##g')" >> ./am-scripts/"$arch"/"$arg" + echo "version=\$(curl -Ls $SOURCEFORGE | grep -Eo \"(http|https)://[a-zA-Z0-9./?=_%:-]*\" | grep -i \"$filetype\" | grep -v '%' | head -1)" >> ./am-scripts/"$arch"/"$arg" sed -n '37,132p' ./am-scripts/"$arch"/"$arg".old >> ./am-scripts/"$arch"/"$arg" rm -f ./am-scripts/"$arch"/"$arg".old - sed -i 's#./tmp/*mage#./tmp/download#g' ./am-scripts/"$arch"/"$arg" - curl -Ls https://sourceforge.net/p/$arg/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i appimage | head -1 | sed 's#https%3A//sourceforge.net##g' + curl -Ls $SOURCEFORGE | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "$filetype" | grep -v '%' | head -1 + sed -i 's/*mage/*/g' ./am-scripts/"$arch"/"$arg" echo -e "\n The URL above is an example of what both\n the install and update scripts will point to.\n" } @@ -330,13 +346,17 @@ while [ -n "$1" ]; do ;; 2) # DOWNLOAD ANY ARCHIVE + _template_create_dirs_and_ask_for_source + # ADD THE NAME OF THE SOURCE read -r -ep " ◆ ADD THE URL OF THE SITE (BETTER IF IT COME FROM GITHUB), FOR EXAMPLE: $(echo -e '\n\n - if from github.com, use "https://github.com/USER/PROJECT"\n\n - if from other sources, use "https://www.SITENAME.com" or something\n\n URL: ')" RESPONSE case "$RESPONSE" in *) if echo "$RESPONSE" | grep -q "https://github.com"; then _template_then_github_source + elif echo "$RESPONSE" | grep -q "sourceforge"; then + _template_if_sourceforge else _template_if_hosted_elsewhere fi From 33437fae20fb3bf926a80bbc39063ee80d7814d3 Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Thu, 27 Jun 2024 00:39:59 +0200 Subject: [PATCH 04/10] Add files via upload --- programs/x86_64/jklubtv | 155 ++++++++++++------------------ programs/x86_64/loopauditioneer | 155 ++++++++++++------------------ programs/x86_64/makagiga | 139 +++++++++++++-------------- programs/x86_64/nootka | 117 ++++++++++------------- programs/x86_64/psi+ | 158 ++++++++++++------------------- programs/x86_64/qbittorrent | 161 ++++++++++++-------------------- programs/x86_64/qmidictl | 138 +++++++++++++-------------- programs/x86_64/qmidinet | 138 +++++++++++++-------------- programs/x86_64/qtractor | 139 +++++++++++++-------------- programs/x86_64/qxgedit | 158 +++++++++++++------------------ programs/x86_64/scribus | 153 ++++++++++++------------------ programs/x86_64/sweethome3d | 74 ++++++++++----- programs/x86_64/synthv1 | 158 +++++++++++++------------------ programs/x86_64/tagstoo | 139 +++++++++++++-------------- programs/x86_64/tulip | 140 +++++++++++++-------------- programs/x86_64/xmedcon | 156 ++++++++++++------------------- 16 files changed, 975 insertions(+), 1303 deletions(-) diff --git a/programs/x86_64/jklubtv b/programs/x86_64/jklubtv index 14885ba12..57419d6ac 100644 --- a/programs/x86_64/jklubtv +++ b/programs/x86_64/jklubtv @@ -1,110 +1,75 @@ #!/bin/sh +# AM INSTALL SCRIPT VERSION 3. +set -u APP=jklubtv -SITE="https://sourceforge.net/u/schmuck5/profile/" +SITE="https://sourceforge.net/projects/chess-round-robin-manager" -# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" -# 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://sourceforge.net/projects/chess-round-robin-manager/files/ | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | sort -u | grep -i appimage) -wget $version -echo "$version" >> /opt/$APP/version +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/p/chess-round-robin-manager/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded. cd .. -mv ./tmp/* ./$APP -chmod a+x /opt/$APP/$APP -rmdir ./tmp +mv ./tmp/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$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 >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u APP=jklubtv -version0=$(cat /opt/$APP/version) -version=$(curl -Ls https://sourceforge.net/projects/chess-round-robin-manager/files/ | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | sort -u | grep -i appimage) -if [ $version = $version0 ]; then - echo "Update not needed!" +SITE="https://sourceforge.net/projects/chess-round-robin-manager" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://sourceforge.net/p/chess-round-robin-manager/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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 .. + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$APP" || exit 1 + echo "$version" > ./version + rm -R -f ./*zs-old ./*.part ./tmp ./*~ + notify-send "$APP is updated!" else - notify-send "A new version of $APP is available, please wait" - mkdir /opt/$APP/tmp - cd /opt/$APP/tmp - wget $version - cd .. - rm ./version - echo $version >> ./version - mv --backup=t ./tmp/* ./$APP - chmod a+x /opt/$APP/$APP - rm -R -f ./tmp ./*~ - notify-send "$APP is updated!" + echo "Update not needed!" fi EOF -chmod a+x /opt/$APP/AM-updater +chmod a+x "/opt/$APP/AM-updater" # 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 - - - - +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root diff --git a/programs/x86_64/loopauditioneer b/programs/x86_64/loopauditioneer index 9c130ca7a..c7dc989a5 100644 --- a/programs/x86_64/loopauditioneer +++ b/programs/x86_64/loopauditioneer @@ -1,110 +1,75 @@ #!/bin/sh +# AM INSTALL SCRIPT VERSION 3. +set -u APP=loopauditioneer -SITE="https://sourceforge.net/projects/loopauditioneer/" +SITE="https://sourceforge.net/projects/loopauditioneer" -# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" -# 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=$(echo $(curl -Ls https://aur.archlinux.org/packages/loopauditioneer-appimage | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i ".appimage" | grep -w -v arm64 | grep -w -v armv7l | grep -w -v ".asc" | grep -w -v ".zsync" | grep -w -v "archlinux.org" | head -1)) -wget --user-agent="X11; Linux x86_64;" https://sourceforge.net/projects/loopauditioneer/files/latest/download -O $APP.AppImage -echo "$version" >> /opt/$APP/version +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/p/loopauditioneer/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded. cd .. -mv ./tmp/* ./$APP -chmod a+x /opt/$APP/$APP -rmdir ./tmp +mv ./tmp/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$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 >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u APP=loopauditioneer -version0=$(cat /opt/$APP/version) -version=$(echo $(curl -Ls https://aur.archlinux.org/packages/loopauditioneer-appimage | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i ".appimage" | grep -w -v arm64 | grep -w -v armv7l | grep -w -v ".asc" | grep -w -v ".zsync" | grep -w -v "archlinux.org" | head -1)) -if [ $version = $version0 ]; then - echo "Update not needed!" +SITE="https://sourceforge.net/projects/loopauditioneer" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://sourceforge.net/p/loopauditioneer/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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 .. + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$APP" || exit 1 + echo "$version" > ./version + rm -R -f ./*zs-old ./*.part ./tmp ./*~ + notify-send "$APP is updated!" else - notify-send "A new version of $APP is available, please wait" - mkdir /opt/$APP/tmp - cd /opt/$APP/tmp - wget --user-agent="X11; Linux x86_64;" https://sourceforge.net/projects/loopauditioneer/files/latest/download -O $APP.AppImage - cd .. - rm ./version - echo $version >> ./version - mv --backup=t ./tmp/* ./$APP - chmod a+x /opt/$APP/$APP - rm -R -f ./tmp ./*~ - notify-send "$APP is updated!" + echo "Update not needed!" fi EOF -chmod a+x /opt/$APP/AM-updater +chmod a+x "/opt/$APP/AM-updater" # 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 - - - - +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root diff --git a/programs/x86_64/makagiga b/programs/x86_64/makagiga index e377745c9..0f5aab7fb 100644 --- a/programs/x86_64/makagiga +++ b/programs/x86_64/makagiga @@ -1,86 +1,75 @@ #!/bin/sh +# AM INSTALL SCRIPT VERSION 3. +set -u APP=makagiga SITE="https://makagiga.sourceforge.io" -# CREATE THE FOLDER -mkdir /opt/$APP -cd /opt/$APP - -# 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 - -wget --user-agent="X11; Linux x86_64;" https://sourceforge.net/projects/makagiga/files/latest/download -O $APP.AppImage +# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://makagiga.sourceforge.io/download.html | tr '"' '\n' | grep http | grep -i appimage | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# 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 -echo "appimage" >> /opt/$APP/version -rmdir ./tmp +mv ./tmp/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$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" -# 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 +# SCRIPT TO UPDATE THE PROGRAM +cat >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u +APP=makagiga +SITE="https://makagiga.sourceforge.io" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://makagiga.sourceforge.io/download.html | tr '"' '\n' | grep http | grep -i appimage | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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 .. + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$APP" || exit 1 + echo "$version" > ./version + rm -R -f ./*zs-old ./*.part ./tmp ./*~ + notify-send "$APP is updated!" +else + echo "Update not needed!" 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 - - - +EOF +chmod a+x "/opt/$APP/AM-updater" +# LAUNCHER & ICON +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root diff --git a/programs/x86_64/nootka b/programs/x86_64/nootka index c6b58e4a4..7d2440ee0 100644 --- a/programs/x86_64/nootka +++ b/programs/x86_64/nootka @@ -1,96 +1,75 @@ #!/bin/sh +# AM INSTALL SCRIPT VERSION 3. +set -u APP=nootka SITE="https://nootka.sourceforge.io" -# CREATE DIRECTORIES -if [ -z "$APP" ]; then exit 1; fi -mkdir -p "/opt/$APP/tmp" "/opt/$APP/icons" && cd "/opt/$APP/tmp" || exit 1 - -# ADD THE REMOVER -echo "#!/bin/sh -rm -f /usr/share/applications/AM-$APP.desktop /usr/local/bin/$APP -rm -R -f /opt/$APP" > "/opt/$APP/remove" +# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" chmod a+x "/opt/$APP/remove" -# DOWNLOAD AND PREPARE THE APP -# $version is also used for updates - -version=$(wget -q https://sourceforge.net/projects/nootka/files/ -O - | tr '"' '\n' | grep "^Nootka-[0-9]" | head -1 | grep -Eo "([0-9]{1,}\.)+[0-9]{1,}") -wget --user-agent="X11; Linux x86_64;" https://sourceforge.net/projects/nootka/files/latest/download -O $APP.AppImage -wget "$version.zsync" 2> /dev/null -echo "$version" >> /opt/$APP/version -# Use tar fx ./*tar* for example in this line in case a compressed file is downloaded. +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/p/nootka/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded. cd .. -mv ./tmp/*mage ./"$APP" -mv ./tmp/*.zsync ./"$APP".zsync 2> /dev/null -chmod a+x "/opt/$APP/$APP" -rm -R -f ./tmp +mv ./tmp/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$APP" || exit 1 -# LINK +# LINK TO PATH ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP" # SCRIPT TO UPDATE THE PROGRAM cat >> "/opt/$APP/AM-updater" << 'EOF' #!/bin/sh +set -u APP=nootka SITE="https://nootka.sourceforge.io" -if [ -z "$APP" ]; then exit 1; fi version0=$(cat "/opt/$APP/version") -version=$(wget -q https://sourceforge.net/projects/nootka/files/ -O - | tr '"' '\n' | grep "^Nootka-[0-9]" | head -1 | grep -Eo "([0-9]{1,}\.)+[0-9]{1,}") -if test -f "/opt/$APP/*.zsync"; then - mkdir "/opt/$APP/tmp" - cd "/opt/$APP/tmp" || exit 1 - wget "$version.zsync" 2> /dev/null +version=$(curl -Ls https://sourceforge.net/p/nootka/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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 .. - mv ./tmp/*.zsync ./"$APP".zsync - rm -R -f ./tmp - zsync "/opt/$APP/$APP.zsync" - rm -R -f "/opt/$APP/*zs-old" "/opt/$APP/*.part" - chmod a+x "/opt/$APP/$APP" - if [ "$version" != "$version0" ]; then - echo "$version" > /opt/$APP/version - fi + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$APP" || exit 1 + echo "$version" > ./version + rm -R -f ./*zs-old ./*.part ./tmp ./*~ + notify-send "$APP is updated!" else - if [ "$version" = "$version0" ]; then - echo "Update not needed!" && exit 0 - else - notify-send "A new version of $APP is available, please wait" - mkdir "/opt/$APP/tmp" - cd "/opt/$APP/tmp" || exit 1 - wget --user-agent="X11; Linux x86_64;" https://sourceforge.net/projects/nootka/files/latest/download -O $APP.AppImage - if ls . | grep mage; then - - cd .. - - if ! test -f ./tmp/*mage; then exit 1; fi - echo "$version" > ./version - mv --backup=t ./tmp/* ./"$APP" - chmod a+x "/opt/$APP/$APP" - rm -R -f ./tmp ./*~ - fi - notify-send "$APP is updated!" - fi + echo "Update not needed!" fi EOF chmod a+x "/opt/$APP/AM-updater" # LAUNCHER & ICON cd "/opt/$APP" || exit 1 -./"$APP" --appimage-extract .DirIcon 1>/dev/null -mv ./squashfs-root/.DirIcon ./DirIcon -./"$APP" --appimage-extract *.desktop 1>/dev/null -mv ./squashfs-root/*.desktop ./"$APP".desktop -./"$APP" --appimage-extract share/applications/*.desktop 1>/dev/null -mv ./squashfs-root/share/applications/*.desktop ./"$APP".desktop -./"$APP" --appimage-extract usr/share/applications/*.desktop 1>/dev/null -mv ./squashfs-root/usr/share/applications/*.desktop ./"$APP".desktop -if [ -L ./DirIcon ]; then - LINKPATH=$(readlink ./DirIcon) - ./"$APP" --appimage-extract "$LINKPATH" - mv ./squashfs-root/"$LINKPATH" ./DirIcon -fi +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop -mv ./DirIcon ./icons/"$APP" 2>/dev/null +mv ./"$APP".desktop /usr/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null rm -R -f ./squashfs-root diff --git a/programs/x86_64/psi+ b/programs/x86_64/psi+ index b6d315459..8ee92d725 100644 --- a/programs/x86_64/psi+ +++ b/programs/x86_64/psi+ @@ -1,113 +1,75 @@ #!/bin/sh +# AM INSTALL SCRIPT VERSION 3. +set -u APP=psi+ -SITE="https://psi-plus.com" +SITE="https://sourceforge.net/projects/psiplus" -# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" -# 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=$(echo $( echo $(curl -Ls https://sourceforge.net/projects/psiplus/files/Linux/tehnick/ | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep "AppImage" | head -1) -O $APP.AppImage)) -wget $version -echo "$version" >> /opt/$APP/version +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/projects/psiplus/files/Linux/tehnick/ | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# 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/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$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 >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u APP=psi+ -version0=$(cat /opt/$APP/version) -version=$(echo $( echo $(curl -Ls https://sourceforge.net/projects/psiplus/files/Linux/tehnick/ | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep "AppImage" | head -1) -O $APP.AppImage)) -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="https://sourceforge.net/projects/psiplus" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://sourceforge.net/projects/psiplus/files/Linux/tehnick/ | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$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 "/opt/$APP/AM-updater" # 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 2> /dev/null -mv squashfs-root/share/applications/*.desktop ./$APP.desktop 2> /dev/null -mv squashfs-root/usr/share/applications/*.desktop ./$APP.desktop 2> /dev/null -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 2> /dev/null -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 2> /dev/null -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 2> /dev/null -sed -i "s#AppRun#$APP#g" ./$APP.desktop 2> /dev/null -sed -i "s#Exec=/bin/#Exec=#g" ./$APP.desktop 2> /dev/null -sed -i "s#Exec=/usr/bin/#Exec=#g" ./$APP.desktop 2> /dev/null -CHANGEICON=$(cat ./$APP.desktop | grep Icon= | head -1) -sed -i "s#$CHANGEICON#Icon=/opt/$APP/icons/$APP#g" ./$APP.desktop 2> /dev/null - -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 2> /dev/null - - - - +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root diff --git a/programs/x86_64/qbittorrent b/programs/x86_64/qbittorrent index 7d4bde6e4..07cb273e7 100644 --- a/programs/x86_64/qbittorrent +++ b/programs/x86_64/qbittorrent @@ -1,114 +1,75 @@ #!/bin/sh +# AM INSTALL SCRIPT VERSION 3. +set -u APP=qbittorrent - -# CREATE THE FOLDER -mkdir /opt/$APP -cd /opt/$APP - -# 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 PROGRAM -mkdir tmp -cd ./tmp - -version=$(curl -Ls https://www.qbittorrent.org/download | grep -i appimage | head -1 | grep -o -P '(?<=torrent ).*(?=> /opt/$APP/version - +SITE="https://sourceforge.net/projects/qbittorrent" + +# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" + +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/p/qbittorrent/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded. cd .. -mv ./tmp/download ./$APP -chmod a+x /opt/$APP/$APP -rmdir ./tmp +mv ./tmp/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$APP" || exit 1 -# LINK -cat >> /usr/local/bin/$APP << 'EOF' -#!/bin/sh -QT_STYLE_OVERRIDE=gtk2 /opt/qbittorrent/qbittorrent "$@" -EOF -chmod a+x /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' +cat >> "/opt/$APP/AM-updater" << 'EOF' #!/bin/sh +set -u APP=qbittorrent -version0=$(cat /opt/$APP/version) -version=$(curl -Ls https://www.qbittorrent.org/download | grep -i appimage | head -1 | grep -o -P '(?<=torrent ).*(?=/dev/null || { wget "$version" || exit 1; } + # Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded. + cd .. + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$APP" || exit 1 + echo "$version" > ./version + rm -R -f ./*zs-old ./*.part ./tmp ./*~ + notify-send "$APP is updated!" else - notify-send "A new version of $APP is available, please wait!" - mkdir /opt/$APP/tmp - cd /opt/$APP/tmp - wget --user-agent="X11; Linux x86_64;" https://sourceforge.net/projects/qbittorrent/files/latest/download - cd .. - if test -f /opt/qbittorrent/tmp/download; then rm -R -f /opt/qbittorrent/version - fi - echo $version >> /opt/$APP/version - mv ./tmp/download ./$APP - chmod a+x /opt/$APP/$APP - rmdir ./tmp - notify-send "$APP is updated!" + echo "Update not needed!" fi EOF -chmod a+x /opt/$APP/AM-updater +chmod a+x "/opt/$APP/AM-updater" # 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 2>/dev/null -mv squashfs-root/share/applications/*.desktop ./$APP.desktop 2>/dev/null -mv squashfs-root/usr/share/applications/*.desktop ./$APP.desktop 2>/dev/null -if [ ! -e ./$APP.desktop ]; then - rm ./$APP.desktop; ./$APP --appimage-extract usr/share/applications/*$app*.desktop 1>/dev/null - mv squashfs-root/usr/share/applications/*.desktop ./$APP.desktop 2>/dev/null -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 2>/dev/null -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 -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 - - - - +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root diff --git a/programs/x86_64/qmidictl b/programs/x86_64/qmidictl index 12e55007b..8e4a4a449 100644 --- a/programs/x86_64/qmidictl +++ b/programs/x86_64/qmidictl @@ -1,85 +1,75 @@ #!/bin/sh +# AM INSTALL SCRIPT VERSION 3. +set -u APP=qmidictl SITE="https://sourceforge.net/projects/qmidictl" -# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" -# 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 - -wget --user-agent="X11; Linux x86_64;" https://sourceforge.net/projects/qmidictl/files/latest/download -O $APP.AppImage +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/p/qmidictl/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# 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 -echo "appimage" >> /opt/$APP/version -rmdir ./tmp +mv ./tmp/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$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" -# 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 2> /dev/null -mv squashfs-root/share/applications/*.desktop ./$APP.desktop 2> /dev/null -mv squashfs-root/usr/share/applications/*.desktop ./$APP.desktop 2> /dev/null -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 2> /dev/null -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 2> /dev/null +# SCRIPT TO UPDATE THE PROGRAM +cat >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u +APP=qmidictl +SITE="https://sourceforge.net/projects/qmidictl" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://sourceforge.net/p/qmidictl/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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 .. + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$APP" || exit 1 + echo "$version" > ./version + rm -R -f ./*zs-old ./*.part ./tmp ./*~ + notify-send "$APP is updated!" +else + echo "Update not needed!" 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 2> /dev/null -sed -i "s#AppRun#$APP#g" ./$APP.desktop 2> /dev/null -sed -i "s#Exec=/bin/#Exec=#g" ./$APP.desktop 2> /dev/null -sed -i "s#Exec=/usr/bin/#Exec=#g" ./$APP.desktop 2> /dev/null -CHANGEICON=$(cat ./$APP.desktop | grep Icon= | head -1) -sed -i "s#$CHANGEICON#Icon=/opt/$APP/icons/$APP#g" ./$APP.desktop 2> /dev/null - -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 2> /dev/null - - - +EOF +chmod a+x "/opt/$APP/AM-updater" +# LAUNCHER & ICON +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root diff --git a/programs/x86_64/qmidinet b/programs/x86_64/qmidinet index b4a9547cb..f7ff6c6ef 100644 --- a/programs/x86_64/qmidinet +++ b/programs/x86_64/qmidinet @@ -1,85 +1,75 @@ #!/bin/sh +# AM INSTALL SCRIPT VERSION 3. +set -u APP=qmidinet SITE="https://sourceforge.net/projects/qmidinet" -# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" -# 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 - -wget --user-agent="X11; Linux x86_64;" https://sourceforge.net/projects/qmidinet/files/latest/download -O $APP.AppImage +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/p/qmidinet/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# 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 -echo "appimage" >> /opt/$APP/version -rmdir ./tmp +mv ./tmp/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$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" -# 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 +# SCRIPT TO UPDATE THE PROGRAM +cat >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u +APP=qmidinet +SITE="https://sourceforge.net/projects/qmidinet" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://sourceforge.net/p/qmidinet/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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 .. + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$APP" || exit 1 + echo "$version" > ./version + rm -R -f ./*zs-old ./*.part ./tmp ./*~ + notify-send "$APP is updated!" +else + echo "Update not needed!" 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 - - - +EOF +chmod a+x "/opt/$APP/AM-updater" +# LAUNCHER & ICON +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root diff --git a/programs/x86_64/qtractor b/programs/x86_64/qtractor index 180409506..75959f452 100644 --- a/programs/x86_64/qtractor +++ b/programs/x86_64/qtractor @@ -1,86 +1,75 @@ #!/bin/sh +# AM INSTALL SCRIPT VERSION 3. +set -u APP=qtractor SITE="https://sourceforge.net/projects/qtractor" -# CREATE THE FOLDER -mkdir /opt/$APP -cd /opt/$APP - -# 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 - -wget --user-agent="X11; Linux x86_64;" https://sourceforge.net/projects/$APP/files/latest/download -O $APP.AppImage +# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/p/qtractor/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# 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 -echo "appimage" >> /opt/$APP/version -rmdir ./tmp +mv ./tmp/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$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" -# 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 +# SCRIPT TO UPDATE THE PROGRAM +cat >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u +APP=qtractor +SITE="https://sourceforge.net/projects/qtractor" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://sourceforge.net/p/qtractor/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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 .. + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$APP" || exit 1 + echo "$version" > ./version + rm -R -f ./*zs-old ./*.part ./tmp ./*~ + notify-send "$APP is updated!" +else + echo "Update not needed!" 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 - - - +EOF +chmod a+x "/opt/$APP/AM-updater" +# LAUNCHER & ICON +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root diff --git a/programs/x86_64/qxgedit b/programs/x86_64/qxgedit index 0ce003aa3..c3248fe34 100644 --- a/programs/x86_64/qxgedit +++ b/programs/x86_64/qxgedit @@ -1,99 +1,75 @@ #!/bin/sh +# AM INSTALL SCRIPT VERSION 3. +set -u APP=qxgedit - -# CREATE THE FOLDER -mkdir /opt/$APP -cd /opt/$APP - -# 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 APPIMAGE -mkdir tmp -cd ./tmp - -wget --user-agent="X11; Linux x86_64;" https://sourceforge.net/projects/qxgedit/files/latest/download -O $APP.AppImage - +SITE="https://sourceforge.net/projects/qxgedit" + +# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" + +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/p/qxgedit/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# 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 -echo "appimage" >> /opt/$APP/version +mv ./tmp/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$APP" || exit 1 -cd ./tmp -wget https://github.com/ivan-hc/AppImageUpdate/releases/download/continuous/appimageupdatetool-x86_64.AppImage 2> /dev/null -cd .. -mv ./tmp/appimageupdatetool-x86_64.AppImage ./updater -chmod a+x ./updater - -# 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 -echo '#!/bin/sh -APP='$APP' -cd /opt/$APP -./updater -O ./$APP -chmod a+x /opt/$APP/$APP -rm -R -f /opt/$APP/*zs-old && rm -R -f /opt/$APP/*.part' >> /opt/$APP/AM-updater -chmod a+x /opt/$APP/AM-updater - -# 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 +# SCRIPT TO UPDATE THE PROGRAM +cat >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u +APP=qxgedit +SITE="https://sourceforge.net/projects/qxgedit" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://sourceforge.net/p/qxgedit/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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 .. + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$APP" || exit 1 + echo "$version" > ./version + rm -R -f ./*zs-old ./*.part ./tmp ./*~ + notify-send "$APP is updated!" +else + echo "Update not needed!" 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 2> /dev/null - - - +EOF +chmod a+x "/opt/$APP/AM-updater" +# LAUNCHER & ICON +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root diff --git a/programs/x86_64/scribus b/programs/x86_64/scribus index 9d101da5f..f48994dd8 100644 --- a/programs/x86_64/scribus +++ b/programs/x86_64/scribus @@ -1,110 +1,75 @@ #!/bin/sh +# AM INSTALL SCRIPT VERSION 3. +set -u APP=scribus SITE="https://sourceforge.net/projects/scribus" -# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" -# 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://sourceforge.net/projects/scribus/files/scribus/ | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | sort | grep download | tail -1 | grep -o -P '(?<=files/scribus/).*(?=/download)') -wget https://sourceforge.net/projects/scribus/files/scribus/$version/scribus-$version-linux-x86_64.AppImage -echo "$version" >> /opt/$APP/version +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/p/scribus/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded. cd .. -mv ./tmp/* ./$APP -chmod a+x /opt/$APP/$APP -rmdir ./tmp +mv ./tmp/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$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 >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u APP=scribus -version0=$(cat /opt/$APP/version) -version=$(curl -Ls https://sourceforge.net/projects/scribus/files/scribus/ | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | sort | grep download | tail -1 | grep -o -P '(?<=files/scribus/).*(?=/download)') -if [ $version = $version0 ]; then - echo "Update not needed!" +SITE="https://sourceforge.net/projects/scribus" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://sourceforge.net/p/scribus/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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 .. + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$APP" || exit 1 + echo "$version" > ./version + rm -R -f ./*zs-old ./*.part ./tmp ./*~ + notify-send "$APP is updated!" else - notify-send "A new version of $APP is available, please wait" - mkdir /opt/$APP/tmp - cd /opt/$APP/tmp - wget https://sourceforge.net/projects/scribus/files/scribus/$version/scribus-$version-linux-x86_64.AppImage - cd .. - rm ./version - echo $version >> ./version - mv --backup=t ./tmp/* ./$APP - chmod a+x /opt/$APP/$APP - rm -R -f ./tmp ./*~ - notify-send "$APP is updated!" + echo "Update not needed!" fi EOF -chmod a+x /opt/$APP/AM-updater +chmod a+x "/opt/$APP/AM-updater" # 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 - - - - +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root diff --git a/programs/x86_64/sweethome3d b/programs/x86_64/sweethome3d index b1fd2d35f..b11c07eb6 100644 --- a/programs/x86_64/sweethome3d +++ b/programs/x86_64/sweethome3d @@ -1,34 +1,62 @@ #!/bin/sh +# AM INSTALL SCRIPT VERSION 3. +set -u APP=sweethome3d SITE="https://www.sweethome3d.com" -# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" -# 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 - -wget --user-agent="X11; Linux x86_64;" https://sourceforge.net/projects/sweethome3d/files/latest/download -O "linux-x64.tgz" -tar fx ./*.tgz +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://www.sweethome3d.com/download.jsp | tr "'" '\n' | grep linux-x64.tgz | head -1) +wget "$version" || exit 1 +[ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z +[ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.* +[ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip cd .. -mv ./tmp/*/* ./ -rm -R -f ./tmp -echo "latest" ./version +if [ -d ./tmp/* 2>/dev/null ]; then mv ./tmp/*/* ./; else mv ./tmp/* ./"$APP" 2>/dev/null || mv ./tmp/* ./; fi +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$APP" || exit 1 + +# LINK TO PATH +ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP" -# LINK -ln -s /opt/$APP/SweetHome3D /usr/local/bin/$APP +# SCRIPT TO UPDATE THE PROGRAM +cat >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u +APP=sweethome3d +SITE="https://www.sweethome3d.com" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://www.sweethome3d.com/download.jsp | tr "'" '\n' | grep linux-x64.tgz | head -1) +[ -n "$version" ] || { echo "Error getting link"; exit 1; } +if [ "$version" != "$version0" ]; then + mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1 + notify-send "A new version of $APP is available, please wait" + wget "$version" || exit 1 + [ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z + [ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.* + [ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip + cd .. + if [ -d ./tmp/* 2>/dev/null ]; then mv --backup=t ./tmp/*/* ./; else mv --backup=t ./tmp/* ./"$APP" 2>/dev/null || mv --backup=t ./tmp/* ./; fi + chmod a+x "/opt/$APP/$APP" || exit 1 + echo "$version" > ./version + rm -R -f ./tmp ./*~ + notify-send "$APP is updated!" +else + echo "Update not needed!" +fi +EOF +chmod a+x "/opt/$APP/AM-updater" # ICON mkdir ./icons -cp ./*.png ./icons/$APP +cp ./*.png ./icons/"$APP" # LAUNCHER & ICON echo "[Desktop Entry] @@ -39,8 +67,4 @@ Exec=$APP Icon=/opt/$APP/icons/$APP Terminal=false Type=Application -Categories=Utility;" >> ./$APP.desktop /usr/share/applications/AM-$APP.desktop - - - - +Categories=Utility;" >> /usr/share/applications/AM-"$APP".desktop diff --git a/programs/x86_64/synthv1 b/programs/x86_64/synthv1 index e17271934..87c615942 100644 --- a/programs/x86_64/synthv1 +++ b/programs/x86_64/synthv1 @@ -1,99 +1,75 @@ #!/bin/sh +# AM INSTALL SCRIPT VERSION 3. +set -u APP=synthv1 - -# CREATE THE FOLDER -mkdir /opt/$APP -cd /opt/$APP - -# 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 APPIMAGE -mkdir tmp -cd ./tmp - -wget https://sourceforge.net/projects/synthv1/files/latest/download -O $APP.AppImage - +SITE="https://sourceforge.net/projects/synthv1" + +# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" + +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/p/synthv1/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# 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 -echo "appimage" >> /opt/$APP/version +mv ./tmp/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$APP" || exit 1 -cd ./tmp -wget https://github.com/ivan-hc/AppImageUpdate/releases/download/continuous/appimageupdatetool-x86_64.AppImage 2> /dev/null -cd .. -mv ./tmp/appimageupdatetool-x86_64.AppImage ./updater -chmod a+x ./updater - -# 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 -echo '#!/bin/sh -APP='$APP' -cd /opt/$APP -./updater -O ./$APP -chmod a+x /opt/$APP/$APP -rm -R -f /opt/$APP/*zs-old && rm -R -f /opt/$APP/*.part' >> /opt/$APP/AM-updater -chmod a+x /opt/$APP/AM-updater - -# 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 +# SCRIPT TO UPDATE THE PROGRAM +cat >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u +APP=synthv1 +SITE="https://sourceforge.net/projects/synthv1" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://sourceforge.net/p/synthv1/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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 .. + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$APP" || exit 1 + echo "$version" > ./version + rm -R -f ./*zs-old ./*.part ./tmp ./*~ + notify-send "$APP is updated!" +else + echo "Update not needed!" 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 2> /dev/null - - - +EOF +chmod a+x "/opt/$APP/AM-updater" +# LAUNCHER & ICON +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root diff --git a/programs/x86_64/tagstoo b/programs/x86_64/tagstoo index 11fc2a34a..47c627412 100644 --- a/programs/x86_64/tagstoo +++ b/programs/x86_64/tagstoo @@ -1,86 +1,75 @@ #!/bin/sh +# AM INSTALL SCRIPT VERSION 3. +set -u APP=tagstoo SITE="https://tagstoo.sourceforge.io" -# CREATE THE FOLDER -mkdir /opt/$APP -cd /opt/$APP - -# 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 - -wget https://sourceforge.net/projects/tagstoo/files/Tagstoo%202.0.1%20linux64/Tagstoo.AppImage/download -O $APP.AppImage +# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://tagstoo.sourceforge.io/download.html | tr '"' '\n' | grep http | grep -i appimage | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# 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 -echo "appimage" >> /opt/$APP/version -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 "/opt/$APP/$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" -# 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 +# SCRIPT TO UPDATE THE PROGRAM +cat >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u +APP=tagstoo +SITE="https://tagstoo.sourceforge.io" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://tagstoo.sourceforge.io/download.html | tr '"' '\n' | grep http | grep -i appimage | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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 .. + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/*mage ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$APP" || exit 1 + echo "$version" > ./version + rm -R -f ./*zs-old ./*.part ./tmp ./*~ + notify-send "$APP is updated!" +else + echo "Update not needed!" 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 - - - +EOF +chmod a+x "/opt/$APP/AM-updater" +# LAUNCHER & ICON +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root diff --git a/programs/x86_64/tulip b/programs/x86_64/tulip index f163c339f..ea31b9bc6 100644 --- a/programs/x86_64/tulip +++ b/programs/x86_64/tulip @@ -1,85 +1,75 @@ #!/bin/sh +# AM INSTALL SCRIPT VERSION 3. +set -u APP=tulip -SITE="https://tulip.labri.fr" +SITE="https://sourceforge.net/projects/auber" -# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" -# 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 - -wget --user-agent="X11; Linux x86_64;" https://sourceforge.net/projects/auber/files/latest/download -O $APP.AppImage +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/p/auber/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# 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 -echo "appimage" >> /opt/$APP/version -rmdir ./tmp +mv ./tmp/download ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$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" -# 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 +# SCRIPT TO UPDATE THE PROGRAM +cat >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u +APP=tulip +SITE="https://sourceforge.net/projects/auber" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://sourceforge.net/p/auber/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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 .. + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/download ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$APP" || exit 1 + echo "$version" > ./version + rm -R -f ./*zs-old ./*.part ./tmp ./*~ + notify-send "$APP is updated!" +else + echo "Update not needed!" 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 - - - +EOF +chmod a+x "/opt/$APP/AM-updater" +# LAUNCHER & ICON +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root diff --git a/programs/x86_64/xmedcon b/programs/x86_64/xmedcon index 2195db893..46dcdbabc 100644 --- a/programs/x86_64/xmedcon +++ b/programs/x86_64/xmedcon @@ -1,113 +1,75 @@ #!/bin/sh +# AM INSTALL SCRIPT VERSION 3. +set -u APP=xmedcon SITE="https://xmedcon.sourceforge.io" -# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" -# 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://xmedcon.sourceforge.io/Main/Download | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i appimage | head -1) -wget $version -echo "$version" >> /opt/$APP/version +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/p/xmedcon/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# 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/download ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$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 >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u APP=xmedcon -version0=$(cat /opt/$APP/version) -version=$(curl -Ls https://xmedcon.sourceforge.io/Main/Download | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i appimage | 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="https://xmedcon.sourceforge.io" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://sourceforge.net/p/xmedcon/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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/download ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$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 "/opt/$APP/AM-updater" # 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 - - - - +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root From 7c2b244eac2051f77fa2a554809ca2855e6aec00 Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Thu, 27 Jun 2024 00:44:03 +0200 Subject: [PATCH 05/10] Update tagstoo --- programs/x86_64/tagstoo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/programs/x86_64/tagstoo b/programs/x86_64/tagstoo index 47c627412..8946d10ad 100644 --- a/programs/x86_64/tagstoo +++ b/programs/x86_64/tagstoo @@ -17,7 +17,7 @@ wget "$version" || exit 1 #wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken # Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded. cd .. -mv ./tmp/*mage ./"$APP" +mv ./tmp/* ./"$APP" mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null rm -R -f ./tmp || exit 1 echo "$version" > ./version @@ -41,7 +41,7 @@ if [ "$version" != "$version0" ] || [ -e /opt/"$APP"/*.zsync ]; then [ -e /opt/"$APP"/*.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 .. - mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/*mage ./"$APP" + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/* ./"$APP" [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } chmod a+x "/opt/$APP/$APP" || exit 1 echo "$version" > ./version From acc6f9cdc04d85095344b4745d66aedbbc207869 Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Thu, 27 Jun 2024 00:48:33 +0200 Subject: [PATCH 06/10] Update sweethome3d --- programs/x86_64/sweethome3d | 1 - 1 file changed, 1 deletion(-) diff --git a/programs/x86_64/sweethome3d b/programs/x86_64/sweethome3d index b11c07eb6..9c27e58b8 100644 --- a/programs/x86_64/sweethome3d +++ b/programs/x86_64/sweethome3d @@ -55,7 +55,6 @@ EOF chmod a+x "/opt/$APP/AM-updater" # ICON -mkdir ./icons cp ./*.png ./icons/"$APP" # LAUNCHER & ICON From b2c9804084b2d61b06fcfe39d6f1eb99246d5d88 Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Thu, 27 Jun 2024 00:56:36 +0200 Subject: [PATCH 07/10] Update sweethome3d --- programs/x86_64/sweethome3d | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/programs/x86_64/sweethome3d b/programs/x86_64/sweethome3d index 9c27e58b8..dfd4b0d6f 100644 --- a/programs/x86_64/sweethome3d +++ b/programs/x86_64/sweethome3d @@ -13,18 +13,18 @@ chmod a+x "/opt/$APP/remove" # DOWNLOAD AND PREPARE THE APP, $version is also used for updates version=$(curl -Ls https://www.sweethome3d.com/download.jsp | tr "'" '\n' | grep linux-x64.tgz | head -1) -wget "$version" || exit 1 +wget "$version" -O "$APP.tgz" || exit 1 [ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z -[ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.* +[ -e ./*tgz* ] && tar fx ./*tgz* && rm -f ./*tgz* [ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip cd .. if [ -d ./tmp/* 2>/dev/null ]; then mv ./tmp/*/* ./; else mv ./tmp/* ./"$APP" 2>/dev/null || mv ./tmp/* ./; fi rm -R -f ./tmp || exit 1 echo "$version" > ./version -chmod a+x "/opt/$APP/$APP" || exit 1 +chmod a+x "/opt/$APP/SweetHome3D" || exit 1 # LINK TO PATH -ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP" +ln -s "/opt/$APP/SweetHome3D" "/usr/local/bin/$APP" # SCRIPT TO UPDATE THE PROGRAM cat >> "/opt/$APP/AM-updater" << 'EOF' @@ -38,13 +38,13 @@ version=$(curl -Ls https://www.sweethome3d.com/download.jsp | tr "'" '\n' | grep if [ "$version" != "$version0" ]; then mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1 notify-send "A new version of $APP is available, please wait" - wget "$version" || exit 1 + wget "$version" -O "$APP.tgz" || exit 1 [ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z - [ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.* + [ -e ./*tgz* ] && tar fx ./*tgz* && rm -f ./*tgz* [ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip cd .. if [ -d ./tmp/* 2>/dev/null ]; then mv --backup=t ./tmp/*/* ./; else mv --backup=t ./tmp/* ./"$APP" 2>/dev/null || mv --backup=t ./tmp/* ./; fi - chmod a+x "/opt/$APP/$APP" || exit 1 + chmod a+x "/opt/$APP/SweetHome3D" || exit 1 echo "$version" > ./version rm -R -f ./tmp ./*~ notify-send "$APP is updated!" From 65ca1b8774bdfd36595e6ffd9b7704dac2d785fa Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Thu, 27 Jun 2024 02:29:41 +0200 Subject: [PATCH 08/10] Update speed-dreams --- programs/x86_64/speed-dreams | 156 +++++++++++++---------------------- 1 file changed, 59 insertions(+), 97 deletions(-) diff --git a/programs/x86_64/speed-dreams b/programs/x86_64/speed-dreams index 1a5a33f2b..a5dc44ead 100644 --- a/programs/x86_64/speed-dreams +++ b/programs/x86_64/speed-dreams @@ -1,113 +1,75 @@ #!/bin/sh +# AM INSTALL SCRIPT VERSION 3. +set -u APP=speed-dreams SITE="https://sourceforge.net/projects/speed-dreams" -# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" -# 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 -L -s https://www.speed-dreams.net/en/downloads/ | grep -E "You can download the official AppImage" | head -1) -wget --user-agent="X11; Linux x86_64;" https://sourceforge.net/projects/speed-dreams/files/latest/download -O $APP.AppImage -echo "$version" >> /opt/$APP/version +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -L -s https://www.speed-dreams.net/ | grep -i "https://sourceforge.net/projects/speed-dreams/files/[0-9]*" | tr ' ' '\n' | grep [0-9] | tail -1) +wget --user-agent="X11; Linux x86_64;" https://sourceforge.net/projects/speed-dreams/files/latest/download || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# 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/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$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 >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u APP=speed-dreams -version0=$(cat /opt/$APP/version) -version=$(curl -L -s https://www.speed-dreams.net/en/downloads/ | grep -E "You can download the official AppImage" | 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 --user-agent="X11; Linux x86_64;" https://sourceforge.net/projects/speed-dreams/files/latest/download -O $APP.AppImage 2> /dev/null - if ls . | grep mage; then +SITE="https://sourceforge.net/projects/speed-dreams" +version0=$(cat "/opt/$APP/version") +version=$(curl -L -s https://www.speed-dreams.net/ | grep -i "https://sourceforge.net/projects/speed-dreams/files/[0-9]*" | tr ' ' '\n' | grep [0-9] | tail -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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.zsync ] && wget "$version.zsync" 2>/dev/null || { wget --user-agent="X11; Linux x86_64;" https://sourceforge.net/projects/speed-dreams/files/latest/download || 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/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$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 "/opt/$APP/AM-updater" # 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 2> /dev/null -mv squashfs-root/share/applications/*.desktop ./$APP.desktop 2> /dev/null -mv squashfs-root/usr/share/applications/*.desktop ./$APP.desktop 2> /dev/null -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 2> /dev/null -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 2> /dev/null -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 2> /dev/null -sed -i "s#AppRun#$APP#g" ./$APP.desktop 2> /dev/null -sed -i "s#Exec=/bin/#Exec=#g" ./$APP.desktop 2> /dev/null -sed -i "s#Exec=/usr/bin/#Exec=#g" ./$APP.desktop 2> /dev/null -CHANGEICON=$(cat ./$APP.desktop | grep Icon= | head -1) -sed -i "s#$CHANGEICON#Icon=/opt/$APP/icons/$APP#g" ./$APP.desktop 2> /dev/null - -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 2> /dev/null - - - - +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root From 09972fb241e0006455ab2147cc7bf0689255088e Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Thu, 27 Jun 2024 02:49:45 +0200 Subject: [PATCH 09/10] Update template.am: improved sourceforge support for alternative URLs --- modules/template.am | 52 ++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/modules/template.am b/modules/template.am index 94af3ea7f..8909f2806 100644 --- a/modules/template.am +++ b/modules/template.am @@ -114,6 +114,22 @@ function _template_then_github_source() { esac } +function _template_custom_download_url() { + # IF YOU CAN, USE A ONE-LINE COMMAND TO DOWNLOAD THE PROGRAM + read -r -ep " USE A ONE-LINE SHELL COMMAND TO CHECK ONLY THE URL TO THE PROGRAM $(echo -e '\n\n if the URL is fixed, simply add the "echo" command at the beginning\n\n :') " DOWNLOADURL + case "$DOWNLOADURL" in + *) + mv ./am-scripts/"$arch"/"$arg" ./am-scripts/"$arch"/"$arg".old + sed -n '1,14p' ./am-scripts/"$arch"/"$arg".old >> ./am-scripts/"$arch"/"$arg" + echo 'version=$('$DOWNLOADURL')' >> ./am-scripts/"$arch"/"$arg" + sed -n '16,35p' ./am-scripts/"$arch"/"$arg".old >> ./am-scripts/"$arch"/"$arg" + echo 'version=$('$DOWNLOADURL')' >> ./am-scripts/"$arch"/"$arg" + sed -n '37,132p' ./am-scripts/"$arch"/"$arg".old >> ./am-scripts/"$arch"/"$arg" + rm -f ./am-scripts/"$arch"/"$arg".old + ;; + esac +} + function _template_if_sourceforge() { sed -i "s#REPLACETHIS#$RESPONSE#g" ./am-scripts/"$arch"/"$arg" # ADD PROJECTNAME @@ -144,16 +160,20 @@ function _template_if_sourceforge() { ;; esac echo "-----------------------------------------------------------------------" - mv ./am-scripts/"$arch"/"$arg" ./am-scripts/"$arch"/"$arg".old - sed -n '1,14p' ./am-scripts/"$arch"/"$arg".old >> ./am-scripts/"$arch"/"$arg" - echo "version=\$(curl -Ls $SOURCEFORGE | grep -Eo \"(http|https)://[a-zA-Z0-9./?=_%:-]*\" | grep -i \"$filetype\" | grep -v '%' | head -1)" >> ./am-scripts/"$arch"/"$arg" - sed -n '16,35p' ./am-scripts/"$arch"/"$arg".old >> ./am-scripts/"$arch"/"$arg" - echo "version=\$(curl -Ls $SOURCEFORGE | grep -Eo \"(http|https)://[a-zA-Z0-9./?=_%:-]*\" | grep -i \"$filetype\" | grep -v '%' | head -1)" >> ./am-scripts/"$arch"/"$arg" - sed -n '37,132p' ./am-scripts/"$arch"/"$arg".old >> ./am-scripts/"$arch"/"$arg" - rm -f ./am-scripts/"$arch"/"$arg".old - curl -Ls $SOURCEFORGE | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "$filetype" | grep -v '%' | head -1 + if curl --head --silent --fail $(curl -Ls $SOURCEFORGE | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "$filetype" | grep -v '%' | head -1) 1> /dev/null; then + mv ./am-scripts/"$arch"/"$arg" ./am-scripts/"$arch"/"$arg".old + sed -n '1,14p' ./am-scripts/"$arch"/"$arg".old >> ./am-scripts/"$arch"/"$arg" + echo "version=\$(curl -Ls $SOURCEFORGE | grep -Eo \"(http|https)://[a-zA-Z0-9./?=_%:-]*\" | grep -i \"$filetype\" | grep -v '%' | head -1)" >> ./am-scripts/"$arch"/"$arg" + sed -n '16,35p' ./am-scripts/"$arch"/"$arg".old >> ./am-scripts/"$arch"/"$arg" + echo "version=\$(curl -Ls $SOURCEFORGE | grep -Eo \"(http|https)://[a-zA-Z0-9./?=_%:-]*\" | grep -i \"$filetype\" | grep -v '%' | head -1)" >> ./am-scripts/"$arch"/"$arg" + sed -n '37,132p' ./am-scripts/"$arch"/"$arg".old >> ./am-scripts/"$arch"/"$arg" + rm -f ./am-scripts/"$arch"/"$arg".old + curl -Ls $SOURCEFORGE | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "$filetype" | grep -v '%' | head -1 + echo -e "\n The URL above is an example of what both\n the install and update scripts will point to.\n" + else + _template_custom_download_url + fi sed -i 's/*mage/*/g' ./am-scripts/"$arch"/"$arg" - echo -e "\n The URL above is an example of what both\n the install and update scripts will point to.\n" } function _template_if_hosted_elsewhere() { @@ -170,19 +190,7 @@ function _template_if_hosted_elsewhere() { ;; esac echo "-----------------------------------------------------------------------" - # IF YOU CAN, USE A ONE-LINE COMMAND TO DOWNLOAD THE PROGRAM - read -r -ep " USE A ONE-LINE SHELL COMMAND TO CHECK ONLY THE URL TO THE PROGRAM $(echo -e '\n\n if the URL is fixed, simply add the "echo" command at the beginning\n\n :') " DOWNLOADURL - case "$DOWNLOADURL" in - *) - mv ./am-scripts/"$arch"/"$arg" ./am-scripts/"$arch"/"$arg".old - sed -n '1,14p' ./am-scripts/"$arch"/"$arg".old >> ./am-scripts/"$arch"/"$arg" - echo 'version=$('$DOWNLOADURL')' >> ./am-scripts/"$arch"/"$arg" - sed -n '16,35p' ./am-scripts/"$arch"/"$arg".old >> ./am-scripts/"$arch"/"$arg" - echo 'version=$('$DOWNLOADURL')' >> ./am-scripts/"$arch"/"$arg" - sed -n '37,132p' ./am-scripts/"$arch"/"$arg".old >> ./am-scripts/"$arch"/"$arg" - rm -f ./am-scripts/"$arch"/"$arg".old - ;; - esac + _template_custom_download_url } # Function to add a generic .desktop file and an icon to the installation script (option 2) From f50726435927710a20105ce8023e1d4bcc6ff43a Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Thu, 27 Jun 2024 02:52:01 +0200 Subject: [PATCH 10/10] Add files via upload Fix https://github.com/ivan-hc/AM/issues/724 --- programs/x86_64-apps | 7 +++ programs/x86_64/jdappstreamedit | 75 +++++++++++++++++++++++++++++ programs/x86_64/jddesktopentryedit | 75 +++++++++++++++++++++++++++++ programs/x86_64/jdminecraftlauncher | 75 +++++++++++++++++++++++++++++ programs/x86_64/jdmrpackinstaller | 75 +++++++++++++++++++++++++++++ programs/x86_64/jdnbtexplorer | 75 +++++++++++++++++++++++++++++ programs/x86_64/jdreplace | 75 +++++++++++++++++++++++++++++ programs/x86_64/jdtextedit | 75 +++++++++++++++++++++++++++++ 8 files changed, 532 insertions(+) create mode 100644 programs/x86_64/jdappstreamedit create mode 100644 programs/x86_64/jddesktopentryedit create mode 100644 programs/x86_64/jdminecraftlauncher create mode 100644 programs/x86_64/jdmrpackinstaller create mode 100644 programs/x86_64/jdnbtexplorer create mode 100644 programs/x86_64/jdreplace create mode 100644 programs/x86_64/jdtextedit diff --git a/programs/x86_64-apps b/programs/x86_64-apps index 49171ac50..bfb31f446 100644 --- a/programs/x86_64-apps +++ b/programs/x86_64-apps @@ -848,6 +848,13 @@ ◆ james : HTTP/HTTPS proxy built in Electron and React. ◆ jan : FOSS Alternative to ChatGPT that runs 100% offline on your computer. ◆ jazz2 : Open-source reimplementation of Jazz Jackrabbit 2. +◆ jdappstreamedit : A graphical Program to create and edit AppStream files. +◆ jddesktopentryedit : A graphical Program to create and edit Desktop Entries. +◆ jdminecraftlauncher : Unofficial classic styled Minecraft Launcher. +◆ jdmrpackinstaller : Install Modrinth modpacks. +◆ jdnbtexplorer : A Editor for Minecraft NBT files. +◆ jdreplace : With jdReplace you can replace a text in all files of a directory. +◆ jdtextedit : jdTextEdit is a powerful texteditor with a lot of features. ◆ jellyamp-appimage : A client for listening to music from a Jellyfin server. ◆ jetbrains-toolbox : Essential tools for software developers and teams. ◆ jexiftoolgui : Java/Swing graphical frontend for ExifTool. diff --git a/programs/x86_64/jdappstreamedit b/programs/x86_64/jdappstreamedit new file mode 100644 index 000000000..45776fee4 --- /dev/null +++ b/programs/x86_64/jdappstreamedit @@ -0,0 +1,75 @@ +#!/bin/sh + +# AM INSTALL SCRIPT VERSION 3. +set -u +APP=jdappstreamedit +SITE="https://sourceforge.net/projects/jdappstreamedit" + +# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" + +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/p/jdappstreamedit/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded. +cd .. +mv ./tmp/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$APP" || exit 1 + +# LINK TO PATH +ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP" + +# SCRIPT TO UPDATE THE PROGRAM +cat >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u +APP=jdappstreamedit +SITE="https://sourceforge.net/projects/jdappstreamedit" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://sourceforge.net/p/jdappstreamedit/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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 .. + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$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" + +# LAUNCHER & ICON +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root diff --git a/programs/x86_64/jddesktopentryedit b/programs/x86_64/jddesktopentryedit new file mode 100644 index 000000000..d151f1ce6 --- /dev/null +++ b/programs/x86_64/jddesktopentryedit @@ -0,0 +1,75 @@ +#!/bin/sh + +# AM INSTALL SCRIPT VERSION 3. +set -u +APP=jddesktopentryedit +SITE="https://sourceforge.net/projects/jddesktopentryedit" + +# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" + +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/p/jddesktopentryedit/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded. +cd .. +mv ./tmp/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$APP" || exit 1 + +# LINK TO PATH +ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP" + +# SCRIPT TO UPDATE THE PROGRAM +cat >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u +APP=jddesktopentryedit +SITE="https://sourceforge.net/projects/jddesktopentryedit" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://sourceforge.net/p/jddesktopentryedit/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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 .. + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$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" + +# LAUNCHER & ICON +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root diff --git a/programs/x86_64/jdminecraftlauncher b/programs/x86_64/jdminecraftlauncher new file mode 100644 index 000000000..f132e5cb0 --- /dev/null +++ b/programs/x86_64/jdminecraftlauncher @@ -0,0 +1,75 @@ +#!/bin/sh + +# AM INSTALL SCRIPT VERSION 3. +set -u +APP=jdminecraftlauncher +SITE="https://sourceforge.net/projects/jdminecraftlauncher" + +# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" + +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/p/jdminecraftlauncher/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded. +cd .. +mv ./tmp/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$APP" || exit 1 + +# LINK TO PATH +ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP" + +# SCRIPT TO UPDATE THE PROGRAM +cat >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u +APP=jdminecraftlauncher +SITE="https://sourceforge.net/projects/jdminecraftlauncher" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://sourceforge.net/p/jdminecraftlauncher/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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 .. + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$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" + +# LAUNCHER & ICON +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root diff --git a/programs/x86_64/jdmrpackinstaller b/programs/x86_64/jdmrpackinstaller new file mode 100644 index 000000000..95914d586 --- /dev/null +++ b/programs/x86_64/jdmrpackinstaller @@ -0,0 +1,75 @@ +#!/bin/sh + +# AM INSTALL SCRIPT VERSION 3. +set -u +APP=jdmrpackinstaller +SITE="https://sourceforge.net/projects/jdmrpackinstaller/" + +# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" + +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/p/jdmrpackinstaller/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded. +cd .. +mv ./tmp/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$APP" || exit 1 + +# LINK TO PATH +ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP" + +# SCRIPT TO UPDATE THE PROGRAM +cat >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u +APP=jdmrpackinstaller +SITE="https://sourceforge.net/projects/jdmrpackinstaller/" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://sourceforge.net/p/jdmrpackinstaller/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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 .. + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$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" + +# LAUNCHER & ICON +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root diff --git a/programs/x86_64/jdnbtexplorer b/programs/x86_64/jdnbtexplorer new file mode 100644 index 000000000..d3316d770 --- /dev/null +++ b/programs/x86_64/jdnbtexplorer @@ -0,0 +1,75 @@ +#!/bin/sh + +# AM INSTALL SCRIPT VERSION 3. +set -u +APP=jdnbtexplorer +SITE="https://sourceforge.net/projects/jdnbtexplorer" + +# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" + +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/p/jdnbtexplorer/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded. +cd .. +mv ./tmp/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$APP" || exit 1 + +# LINK TO PATH +ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP" + +# SCRIPT TO UPDATE THE PROGRAM +cat >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u +APP=jdnbtexplorer +SITE="https://sourceforge.net/projects/jdnbtexplorer" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://sourceforge.net/p/jdnbtexplorer/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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 .. + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$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" + +# LAUNCHER & ICON +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root diff --git a/programs/x86_64/jdreplace b/programs/x86_64/jdreplace new file mode 100644 index 000000000..605657d0b --- /dev/null +++ b/programs/x86_64/jdreplace @@ -0,0 +1,75 @@ +#!/bin/sh + +# AM INSTALL SCRIPT VERSION 3. +set -u +APP=jdreplace +SITE="https://sourceforge.net/projects/jdreplace/" + +# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" + +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/p/jdreplace/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded. +cd .. +mv ./tmp/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$APP" || exit 1 + +# LINK TO PATH +ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP" + +# SCRIPT TO UPDATE THE PROGRAM +cat >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u +APP=jdreplace +SITE="https://sourceforge.net/projects/jdreplace/" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://sourceforge.net/p/jdreplace/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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 .. + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$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" + +# LAUNCHER & ICON +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root diff --git a/programs/x86_64/jdtextedit b/programs/x86_64/jdtextedit new file mode 100644 index 000000000..ea68aeba6 --- /dev/null +++ b/programs/x86_64/jdtextedit @@ -0,0 +1,75 @@ +#!/bin/sh + +# AM INSTALL SCRIPT VERSION 3. +set -u +APP=jdtextedit +SITE="https://sourceforge.net/projects/jdtextedit" + +# 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" > "/opt/$APP/remove" +printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove" +chmod a+x "/opt/$APP/remove" + +# DOWNLOAD AND PREPARE THE APP, $version is also used for updates +version=$(curl -Ls https://sourceforge.net/p/jdtextedit/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | head -1) +wget "$version" || exit 1 +#wget "$version.zsync" 2> /dev/null # Comment out this line if you want to use zsync, warning that more often than not it is broken +# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded. +cd .. +mv ./tmp/* ./"$APP" +mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null +rm -R -f ./tmp || exit 1 +echo "$version" > ./version +chmod a+x "/opt/$APP/$APP" || exit 1 + +# LINK TO PATH +ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP" + +# SCRIPT TO UPDATE THE PROGRAM +cat >> "/opt/$APP/AM-updater" << 'EOF' +#!/bin/sh +set -u +APP=jdtextedit +SITE="https://sourceforge.net/projects/jdtextedit" +version0=$(cat "/opt/$APP/version") +version=$(curl -Ls https://sourceforge.net/p/jdtextedit/activity/feed | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i "appimage" | grep -v '%' | 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 /opt/"$APP"/*.zsync ] || notify-send "A new version of $APP is available, please wait" + [ -e /opt/"$APP"/*.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 .. + mv ./tmp/*.zsync ./"$APP".zsync 2>/dev/null || mv --backup=t ./tmp/* ./"$APP" + [ -e /opt/"$APP"/*.zsync ] && { zsync "/opt/$APP/$APP.zsync" || notify-send -u critical "zsync failed to update $APP"; } + chmod a+x "/opt/$APP/$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" + +# LAUNCHER & ICON +cd "/opt/$APP" || exit 1 +./"$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" && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop + fi + if [ -L ./DirIcon ]; then + LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" + ./"$APP" --appimage-extract "$LINKPATH" && 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/share/applications/AM-"$APP".desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null +rm -R -f ./squashfs-root