Skip to content

Commit

Permalink
Use BINDIR instead of ~/.local/bin
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-hc authored Nov 18, 2024
1 parent 184fed4 commit 9e06d68
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
8 changes: 4 additions & 4 deletions APP-MANAGER
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

AMVERSION="9.1.1-6"
AMVERSION="9.1.1-7"

# Determine main repository and branch
AMREPO="https://raw.githubusercontent.com/ivan-hc/AM/main"
Expand Down Expand Up @@ -634,16 +634,16 @@ function _clean_launchers() {
echo " related AppImage is located in an unmounted path of $unmounted_point"
else
rm -f "$var"
rm -f "$HOME"/.local/bin/"$launcher2del"*
[ -n "$BINDIR" ] && rm -f "$BINDIR"/"$launcher2del"*
fi
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
[ -z "$mountpoint_enabled" ] && [ -n "$BINDIR" ] && cd "$BINDIR" && 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
[ -n "$BINDIR" ] && cd "$BINDIR" && find . -xtype l -delete
fi
}

Expand Down
6 changes: 3 additions & 3 deletions modules/install.am
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ _convert_to_appman_compatible_script() {
_detect_appman_apps
_appman
if [ -d "$APPMAN_APPSPATH" ]; then
sed -i "s# /usr/local/bin# $HOME/.local/bin#g" ./"$arg"
sed -i "s# /usr/local/bin# $BINDIR#g" ./"$arg"
sed -i "s# /usr/local/share/applications# $DATADIR/applications#g" ./"$arg"
sed -i "s# /opt# $APPMAN_APPSPATH#g" ./"$arg"
sed -i "s# https://api.github.com#$HeaderAuthWithGITPAT https://api.github.com#g" ./"$arg"
cat <<-HEREDOC >> ./"$arg"
# POST INSTALLATION PATCH FOR ALL LAUNCHERS
sed -i "s#Exec=\$APP#Exec=$HOME/.local/bin/$APP#g" $DATADIR/applications/*-AM.desktop
sed -i "s#Exec=/usr/bin/#Exec=$HOME/.local/bin/#g" $DATADIR/applications/*-AM.desktop
sed -i "s#Exec=\$APP#Exec=$BINDIR/$APP#g" $DATADIR/applications/*-AM.desktop
sed -i "s#Exec=/usr/bin/#Exec=$BINDIR/#g" $DATADIR/applications/*-AM.desktop
sed -i "s#Exec=/opt/#Exec=$HOME/$APPSDIR#g" $DATADIR/applications/*-AM.desktop
sed -i "s#Icon=/opt/#Icon=$HOME/$APPSDIR#g" $DATADIR/applications/*-AM.desktop
Expand Down
12 changes: 5 additions & 7 deletions modules/management.am
Original file line number Diff line number Diff line change
Expand Up @@ -191,18 +191,16 @@ function _launcher_appimage_bin() {
if [ -z "$response" ]; then
appimage_cmd=$(echo "$appimage" | tr '[:upper:]' '[:lower:]')
if ! echo "$appimage" | grep -q -i ".appimage"; then
printf '#!/bin/sh\n%s' "$arg" >> "$HOME"/.local/bin/"$appimage_cmd".appimage
chmod a+x "$HOME"/.local/bin/"$appimage_cmd".appimage
echo " New command: \"$appimage_cmd.appimage\" in ~/.local/bin"
[ -n "$BINDIR" ] && printf '#!/bin/sh\n%s' "$arg" >> "$BINDIR"/"$appimage_cmd".appimage \
&& chmod a+x "$BINDIR"/"$appimage_cmd".appimage && echo " New command: \"$appimage_cmd.appimage\" in $BINDIR"
else
printf '#!/bin/sh\n%s' "$arg" >> "$HOME"/.local/bin/"$appimage_cmd"
chmod a+x "$HOME"/.local/bin/"$appimage_cmd"
echo " New command: \"$appimage_cmd\" in ~/.local/bin"
[ -n "$BINDIR" ] && printf '#!/bin/sh\n%s' "$arg" >> "$BINDIR"/"$appimage_cmd" \
&& chmod a+x "$BINDIR"/"$appimage_cmd" && echo " New command: \"$appimage_cmd\" in $BINDIR"
fi
elif command -v "$response" 1>/dev/null; then
echo " ERROR: the \"$response\" command alredy exists, retry!"
else
ln -s "$arg" "$HOME"/.local/bin/"$response"
[ -n "$BINDIR" ] && ln -s "$arg" "$BINDIR"/"$response"
fi
}

Expand Down

0 comments on commit 9e06d68

Please sign in to comment.