From 38b8076e8460ae5ae7a41643cd693f135b36e8f3 Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Mon, 18 Nov 2024 02:38:43 +0100 Subject: [PATCH 1/5] Option --launcher, fix missing BINDIR message --- modules/management.am | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/management.am b/modules/management.am index 82202081a..11425e389 100644 --- a/modules/management.am +++ b/modules/management.am @@ -182,7 +182,11 @@ function _launcher_appimage_integration() { function _launcher_appimage_bin() { mkdir -p "$HOME"/.local/bin - _check_if_home_local_bin_is_not_in_path + if ! echo "$PATH" | grep "$BINDIR" >/dev/null 2>&1; then + echo "$DIVIDING_LINE" + echo "WARNING: \"$BINDIR\" is not in PATH, apps may not run from command line." | fold -sw 77 | sed 's/^/ /g' + echo "$DIVIDING_LINE" + fi read -r -p " Write a custom command to launch the app, or leave blank: " response if [ -z "$response" ]; then appimage_cmd=$(echo "$appimage" | tr '[:upper:]' '[:lower:]') From 321af4bbff92a89d83ff5904d2494e007eef0529 Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Mon, 18 Nov 2024 03:36:44 +0100 Subject: [PATCH 2/5] Add /run/media support to -c in AppImage launchers removal --- APP-MANAGER | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/APP-MANAGER b/APP-MANAGER index e476f6276..1789adfa4 100755 --- a/APP-MANAGER +++ b/APP-MANAGER @@ -1,6 +1,6 @@ #!/usr/bin/env bash -AMVERSION="9.1.1-4" +AMVERSION="9.1.1-5" # Determine main repository and branch AMREPO="https://raw.githubusercontent.com/ivan-hc/AM/main" @@ -613,30 +613,32 @@ function _clean_all_tmp_directories_from_appspath() { } function _clean_determine_removable_launchers() { - if ! test -f "$APPIMAGENAME" 2>/dev/null; then - if ! test -d "$MOUNTPOINTS" 2>/dev/null; then - if echo "$MOUNTPOINTS" | grep -q "/media/"; then - unmounted_poin="/media" - elif echo "$MOUNTPOINTS" | grep -q "/mnt/"; then - unmounted_poin="/mnt" - fi - echo " ✖ ERROR: cannot remove \"$(basename "$var")\"" - echo " related AppImage is located in an unmounted path of $unmounted_poin" - else - rm -f "$var" - rm -f "$HOME"/.local/bin/"$launcher2del"* - cd "$HOME"/.local/bin && find . -xtype l -delete + if echo "$mountpoint" | grep -q "^/media/\|^/mnt/\|^/run/media/" && ! test -d "$mountpoint"; then + if echo "$mountpoint" | grep -q "^/media/"; then + unmounted_point="/media" + elif echo "$mountpoint" | grep -q "^/mnt/"; then + unmounted_point="/mnt" + elif echo "$mountpoint" | grep -q "^/run/media/"; then + unmounted_point="/run/media" fi + echo " ✖ ERROR: cannot remove \"$(basename "$var")\"" + echo " related AppImage is located in an unmounted path of $unmounted_point" + else + rm -f "$var" + rm -f "$HOME"/.local/bin/"$launcher2del"* + cd "$HOME"/.local/bin && find . -xtype l -delete fi } function _clean_launchers() { - if test -d "$DATADIR"/applications/AppImages 2>/dev/null; then + if test -d "$DATADIR"/applications/AppImages; then for var in "$DATADIR"/applications/AppImages/*.desktop; do - APPIMAGENAME=$(grep "Exec=" 0<"$var" 2>/dev/null | head -1 | cut -c 6- | sed 's/\s.*$//') - launcher2del=$(basename -- "$(echo "$APPIMAGENAME" | tr '[:upper:]' '[:lower:]')") - MOUNTPOINTS=$(echo "$APPIMAGENAME" | cut -d'/' -f1-4) - _clean_determine_removable_launchers + appimagename=$(grep "Exec=" 0<"$var" 2>/dev/null | head -1 | cut -c 6- | sed 's/\s.*$//') # full path to appimage + launcher2del=$(basename -- "$(echo "$appimagename" | tr '[:upper:]' '[:lower:]')") # name of the appimage + mountpoint=$(echo "$appimagename" | cut -d'/' -f1-4) # removable mount point where the appimage may be stored + if ! test -f "$appimagename"; then + _clean_determine_removable_launchers + fi done echo ' ✔ Removed orphaned launchers produced with the "--launcher" option' rmdir "$DATADIR"/applications/AppImages From 24c2af3532fcc705b38accb7afde41c98fe80caf Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Mon, 18 Nov 2024 04:12:10 +0100 Subject: [PATCH 3/5] Option -c, launchers, don't remove dead links if mountpoint is detected --- APP-MANAGER | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/APP-MANAGER b/APP-MANAGER index 1789adfa4..356c6a769 100755 --- a/APP-MANAGER +++ b/APP-MANAGER @@ -1,6 +1,6 @@ #!/usr/bin/env bash -AMVERSION="9.1.1-5" +AMVERSION="9.1.1-6" # Determine main repository and branch AMREPO="https://raw.githubusercontent.com/ivan-hc/AM/main" @@ -626,7 +626,6 @@ function _clean_determine_removable_launchers() { else rm -f "$var" rm -f "$HOME"/.local/bin/"$launcher2del"* - cd "$HOME"/.local/bin && find . -xtype l -delete fi } @@ -640,8 +639,12 @@ function _clean_launchers() { _clean_determine_removable_launchers fi done + grep -q "^Exec=/media/\|^^Exec=/mnt/\|^^Exec=/run/media/" "$DATADIR"/applications/AppImages/* && mountpoint_enabled=1 + [ -z "$mountpoint_enabled" ] && cd "$HOME"/.local/bin && find . -xtype l -delete echo ' ✔ Removed orphaned launchers produced with the "--launcher" option' rmdir "$DATADIR"/applications/AppImages + else + cd "$HOME"/.local/bin && find . -xtype l -delete fi } From 41e137f2a852853e64a4f7059c08c2e81ab7ee46 Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Mon, 18 Nov 2024 04:22:47 +0100 Subject: [PATCH 4/5] Use one function to clean launchers (option -c) --- APP-MANAGER | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/APP-MANAGER b/APP-MANAGER index 356c6a769..50c8c5538 100755 --- a/APP-MANAGER +++ b/APP-MANAGER @@ -612,23 +612,6 @@ function _clean_all_tmp_directories_from_appspath() { done } -function _clean_determine_removable_launchers() { - if echo "$mountpoint" | grep -q "^/media/\|^/mnt/\|^/run/media/" && ! test -d "$mountpoint"; then - if echo "$mountpoint" | grep -q "^/media/"; then - unmounted_point="/media" - elif echo "$mountpoint" | grep -q "^/mnt/"; then - unmounted_point="/mnt" - elif echo "$mountpoint" | grep -q "^/run/media/"; then - unmounted_point="/run/media" - fi - echo " ✖ ERROR: cannot remove \"$(basename "$var")\"" - echo " related AppImage is located in an unmounted path of $unmounted_point" - else - rm -f "$var" - rm -f "$HOME"/.local/bin/"$launcher2del"* - fi -} - function _clean_launchers() { if test -d "$DATADIR"/applications/AppImages; then for var in "$DATADIR"/applications/AppImages/*.desktop; do @@ -636,7 +619,20 @@ function _clean_launchers() { launcher2del=$(basename -- "$(echo "$appimagename" | tr '[:upper:]' '[:lower:]')") # name of the appimage mountpoint=$(echo "$appimagename" | cut -d'/' -f1-4) # removable mount point where the appimage may be stored if ! test -f "$appimagename"; then - _clean_determine_removable_launchers + if echo "$mountpoint" | grep -q "^/media/\|^/mnt/\|^/run/media/" && ! test -d "$mountpoint"; then + if echo "$mountpoint" | grep -q "^/media/"; then + unmounted_point="/media" + elif echo "$mountpoint" | grep -q "^/mnt/"; then + unmounted_point="/mnt" + elif echo "$mountpoint" | grep -q "^/run/media/"; then + unmounted_point="/run/media" + fi + echo " ✖ ERROR: cannot remove \"$(basename "$var")\"" + echo " related AppImage is located in an unmounted path of $unmounted_point" + else + rm -f "$var" + rm -f "$HOME"/.local/bin/"$launcher2del"* + fi fi done grep -q "^Exec=/media/\|^^Exec=/mnt/\|^^Exec=/run/media/" "$DATADIR"/applications/AppImages/* && mountpoint_enabled=1 From 6ee5d9dc0f5e7a90d5e998ffcf2e386f0a4d04c9 Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Mon, 18 Nov 2024 04:24:36 +0100 Subject: [PATCH 5/5] Update APP-MANAGER --- APP-MANAGER | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/APP-MANAGER b/APP-MANAGER index 50c8c5538..085cbb85b 100755 --- a/APP-MANAGER +++ b/APP-MANAGER @@ -615,9 +615,12 @@ function _clean_all_tmp_directories_from_appspath() { function _clean_launchers() { if test -d "$DATADIR"/applications/AppImages; then for var in "$DATADIR"/applications/AppImages/*.desktop; do - appimagename=$(grep "Exec=" 0<"$var" 2>/dev/null | head -1 | cut -c 6- | sed 's/\s.*$//') # full path to appimage - launcher2del=$(basename -- "$(echo "$appimagename" | tr '[:upper:]' '[:lower:]')") # name of the appimage - mountpoint=$(echo "$appimagename" | cut -d'/' -f1-4) # removable mount point where the appimage may be stored + # full path to appimage + appimagename=$(grep "Exec=" 0<"$var" 2>/dev/null | head -1 | cut -c 6- | sed 's/\s.*$//') + # name of the appimage + launcher2del=$(basename -- "$(echo "$appimagename" | tr '[:upper:]' '[:lower:]')") + # removable mount point where the appimage may be stored + mountpoint=$(echo "$appimagename" | cut -d'/' -f1-4) if ! test -f "$appimagename"; then if echo "$mountpoint" | grep -q "^/media/\|^/mnt/\|^/run/media/" && ! test -d "$mountpoint"; then if echo "$mountpoint" | grep -q "^/media/"; then