Skip to content

Commit d4f77fb

Browse files
authored
Merge pull request #726 from ivan-hc/dev
"AM" 6.15.1
2 parents 2ecfb2f + b4b4dff commit d4f77fb

File tree

6 files changed

+51
-85
lines changed

6 files changed

+51
-85
lines changed

APP-MANAGER

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

3-
AMVERSION="6.15"
3+
AMVERSION="6.15.1"
44

55
# Determine main repository and branch
66
AMREPO="https://raw.githubusercontent.com/ivan-hc/AM/main"
@@ -288,13 +288,15 @@ function _online_check() {
288288
function _prevent_apps_from_being_removed_by_third_parties() {
289289
# Add a security layer to scripts named "remove" of installed apps to prevent file removal by non-privileged users
290290
if [ "$AMCLI" == am ] 2>/dev/null; then
291-
if ! grep -q '"$SUDO_COMMAND"' /opt/*/remove 2> /dev/null; then
292-
for r in /opt/*/; do
293-
if test -f "$r"/remove; then
294-
sed -i '1 a if [ -z "$SUDO_COMMAND" ]; then echo "Permission denied"; exit 1; fi' "$r"/remove 2> /dev/null
291+
for r in /opt/*/; do
292+
if test -f "$r"/remove; then
293+
if ! grep -q '"$SUDO_COMMAND"' "$r"/remove 2> /dev/null; then
294+
if [[ "$r" != "/opt/am/" ]]; then
295+
sed -i '1 a if [ -z "$SUDO_COMMAND" ]; then echo "Permission denied"; exit 1; fi' "$r"/remove 2> /dev/null
296+
fi
295297
fi
296-
done
297-
fi
298+
fi
299+
done
298300
fi
299301
}
300302

@@ -389,7 +391,7 @@ function _check_version_if_firefox_webapp() {
389391
}
390392

391393
function _check_version_if_library() {
392-
APPVERSION=$(find "$(cat "$APPSPATH"/"$arg"/remove | tr ' ' '\n' | grep "usr/local/lib")" -type f | sed 's:.*.so.::' | tail -1)
394+
APPVERSION=$(find $(cat "$APPSPATH"/"$arg"/remove | tr ' ' '\n' | grep "usr/local/lib") -type f | sed 's:.*.so.::' | tail -1)
393395
}
394396

395397
function _check_version_if_no_version_found() {

INSTALL

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ mkdir -p /opt/am/.cache /opt/am/modules || exit 1
2525
cd /opt/am || exit 1
2626

2727
# CREATE THE SCRIPT NEEDED TO UNINSTALL "AM"
28-
rm -f /opt/am/remove
29-
echo '#!/bin/sh
30-
if [ -z "$SUDO_COMMAND" ]; then echo "Permission denied"; exit 1; fi
31-
rm -R -f /usr/local/bin/am /opt/am /etc/bash_completion.d/am-completion.sh' >> /opt/am/remove
28+
printf '#!/bin/sh\n\nset -e\n' > /opt/am/remove
29+
printf '\n%s\n' 'if [ "$(id -u)" -ne 0 ]; then echo "Permission denied"; exit 1; fi' >> /opt/am/remove
30+
printf '%s\n' 'rm -f /usr/local/bin/am /etc/bash_completion.d/am-completion.sh' >> /opt/am/remove
31+
printf '%s\n' 'rm -R -f /opt/am' >> /opt/am/remove
3232
chmod a+x /opt/am/remove || exit 1
3333

3434
# DOWNLOAD THE MAIN SCRIPT

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# "AM" Application Manager
22
### Database & solutions for all AppImages and portable apps for GNU/Linux!
33

4-
![Istantanea_2024-06-17_16-23-49 png](https://github.com/ivan-hc/AM/assets/88724353/ff4709c8-a3b2-4a1e-84ab-72700934809f)
4+
![Istantanea_2024-06-26_17-00-46 png](https://github.com/ivan-hc/AM/assets/88724353/671f5eb0-6fb6-4392-b45e-af0ea9271d9b)
55

66
"AM"/"AppMan" is a set of scripts and modules for installing, updating, and managing AppImage packages and other portable formats, in the same way that APT manages DEBs packages, DNF the RPMs, and so on... using a large database of Shell scripts inspired by the Arch User Repository, each dedicated to an app or set of applications.
77

modules/files.am

Lines changed: 31 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -27,49 +27,43 @@ _files_sizes() {
2727
echo "$arg | $SIZE" >> "$AMCACHEDIR"/files-sizes
2828
}
2929
30-
_files_if_binary_executable() {
31-
echo "$arg | binary" >> "$AMCACHEDIR"/files-type
32-
}
33-
34-
_files_if_unknown() {
35-
echo "$arg | unknown" >> "$AMCACHEDIR"/files-type
36-
}
37-
38-
_files_if_other() {
39-
echo "$arg | other" >> "$AMCACHEDIR"/files-type
40-
}
41-
42-
_files_if_launcher() {
43-
echo "$arg | launcher" >> "$AMCACHEDIR"/files-type
44-
}
45-
46-
_files_if_set_tools() {
47-
echo "$arg | set/tools" >> "$AMCACHEDIR"/files-type
30+
_files_if_binary() {
31+
if file ./"$arg"/* | grep "static" >/dev/null 2>&1; then
32+
echo "$arg | static-binary" >> "$AMCACHEDIR"/files-type
33+
else
34+
echo "$arg | dynamic-binary" >> "$AMCACHEDIR"/files-type
35+
fi
4836
}
4937
5038
_files_if_library() {
5139
echo "$arg | library" >> "$AMCACHEDIR"/files-type
5240
}
5341
5442
_files_if_script() {
55-
if test -f $APPSPATH/$arg/bin/$arg; then
56-
_files_if_binary_executable
57-
elif test -f $APPSPATH/$arg/$arg-bin; then
58-
_files_if_binary_executable
43+
if grep "/ffwa" "${LINK:-$FILE}" >/dev/null 2>&1; then
44+
echo "$arg | launcher" >> "$AMCACHEDIR"/files-type
45+
elif grep '#!.*bash' "${LINK:-$FILE}" >/dev/null 2>&1; then
46+
echo "$arg | bash-script" >> "$AMCACHEDIR"/files-type
47+
elif grep '#!.*dash' "${LINK:-$FILE}" >/dev/null 2>&1; then
48+
echo "$arg | dash-script" >> "$AMCACHEDIR"/files-type
49+
elif grep '#!.*bin.*sh' "${LINK:-$FILE}" >/dev/null 2>&1; then
50+
echo "$arg | posix-script" >> "$AMCACHEDIR"/files-type
51+
elif grep '#!.*awk' "${LINK:-$FILE}" >/dev/null 2>&1; then
52+
echo "$arg | awk-script" >> "$AMCACHEDIR"/files-type
5953
else
6054
echo "$arg | script" >> "$AMCACHEDIR"/files-type
6155
fi
6256
}
6357
6458
_files_if_appimage() {
65-
if ! strings -d "./$arg/$arg" | grep 'AppImages require FUSE to run' >/dev/null 2>&1; then
66-
if grep "aisap-am" "$(command -v "$arg")" >/dev/null 2>&1; then
59+
if ! echo "$string" | grep 'AppImages require FUSE to run' >/dev/null 2>&1; then
60+
if grep "SANDBOXDIR" "$FILE" >/dev/null 2>&1; then
6761
echo "$arg | appimage3🔒" >> "$AMCACHEDIR"/files-type
6862
else
6963
echo "$arg | appimage3" >> "$AMCACHEDIR"/files-type
7064
fi
7165
else
72-
if grep "aisap-am" "$(command -v "$arg")" >/dev/null 2>&1; then
66+
if grep "SANDBOXDIR" "$(command -v "$arg")" >/dev/null 2>&1; then
7367
echo "$arg | appimage2🔒" >> "$AMCACHEDIR"/files-type
7468
else
7569
echo "$arg | appimage2" >> "$AMCACHEDIR"/files-type
@@ -79,50 +73,19 @@ _files_if_appimage() {
7973
8074
_files_type() {
8175
APPVERSION=$(cat "$AMCACHEDIR"/version-args | grep -w "$arg |" | sed 's:.*| ::')
82-
if [ -z "$(strings -d "./$arg/$arg" 2>/dev/null | grep -F 'if you run it with the --appimage-extract option')" ] 2>/dev/null; then
83-
string=$(strings -d "./$arg/$arg" 2>/dev/null | head -1 )
84-
if grep -q "usr/local/lib" ./$arg/remove; then
85-
_files_if_library
86-
elif echo "$string" | grep -q "ld-linux"; then
87-
_files_if_binary_executable
88-
elif echo "$string" | grep -q "#!"; then
89-
_files_if_script
90-
elif ! test -f "./$arg/$arg"; then
91-
link_in_path=$(cat "./$arg/remove" | tr " " "\n" | grep 'local/bin' | tail -1)
92-
realpath=$(realpath "$link_in_path")
93-
realstring=$(strings -d "$realpath" 2>/dev/null | head -1 )
94-
if [ -L "$link_in_path" ]; then
95-
if echo "$realstring" | grep -q "ld-linux"; then
96-
_files_if_binary_executable
97-
elif echo "$realstring" | grep -q "#!"; then
98-
_files_if_script
99-
else
100-
_files_if_unknown
101-
fi
102-
elif cat "./$arg/remove" | tail -1 | grep -q 'xtype l -exec rm'; then
103-
_files_if_set_tools
104-
elif echo "$realstring" | grep -q "#!"; then
105-
script2path=$(cat "$link_in_path" | tail -1 | sed 's#$APP#'$arg'#g; s#exec ##g')
106-
realrealstring=$(strings -d "$script2path" 2>/dev/null | head -1 )
107-
if echo "$realrealstring" | grep -q "ld-linux"; then
108-
_files_if_binary_executable
109-
elif echo "$realrealstring" | grep -q "#!"; then
110-
_files_if_script
111-
elif [[ $(test -f "$link_in_path") != 0 ]]; then
112-
_files_if_launcher
113-
else
114-
_files_if_unknown
115-
fi
116-
else
117-
_files_if_other
118-
fi
119-
elif test -d ./$arg/bin; then
120-
_files_if_binary_executable
121-
else
122-
_files_if_other
123-
fi
124-
else
76+
string=$(strings -d ./"$arg/$arg" 2>/dev/null)
77+
FILE=$(command -v "$arg" 2>/dev/null)
78+
LINK=$(readlink "$FILE" 2>/dev/null)
79+
if echo "$string" | grep -- '--appimage-extract option' >/dev/null 2>&1; then
12580
_files_if_appimage
81+
elif file ./"$arg"/* | grep -E 'LSB|/bin' >/dev/null 2>&1; then
82+
_files_if_binary
83+
elif grep "#!" "${LINK:-$FILE}" >/dev/null 2>&1; then
84+
_files_if_script
85+
elif grep "usr/local/lib" ./"$arg"/remove >/dev/null 2>&1; then
86+
_files_if_library
87+
else
88+
echo "$arg | other" >> "$AMCACHEDIR"/files-type
12689
fi
12790
}
12891

modules/sandboxes.am

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ case "$1" in
120120
DATADIR="${XDG_DATA_HOME:-$HOME/.local/share}"
121121
CONFIGDIR="${XDG_CONFIG_HOME:-$HOME/.config}"
122122
CACHEDIR="${XDG_CACHE_HOME:-$HOME/.cache}"
123+
DBUS="$(ls /tmp/dbus* 2>/dev/null | head -1)" # Prevents crash if there is multiple dbus
123124
124125
XDG_DESKTOP_DIR="$(xdg-user-dir DESKTOP 2>/dev/null)"
125126
XDG_DOCUMENTS_DIR="$(xdg-user-dir DOCUMENTS 2>/dev/null)"
@@ -182,7 +183,7 @@ case "$1" in
182183
--rm-file "${XDG_PICTURES_DIR:-~/Pictures}" \
183184
--rm-file "${XDG_VIDEOS_DIR:-~/Videos}" \
184185
--add-file /var/lib/dbus \
185-
--add-file /tmp/dbus* \
186+
--add-file "${DBUS:-/tmp/dbus}" \
186187
--add-socket pulseaudio \
187188
--add-socket dbus \
188189
--add-socket network \
@@ -260,7 +261,7 @@ case "$1" in
260261
printf '\n\033[33m%s\n' " Use the --disable-sandbox flag if you want to revert the changes"
261262
printf '\n\033[0m%s' " In this case that is:"
262263
printf '\033[33m%s\033[36m\n\n' " $2 --disable-sandbox"
263-
264+
_remove_info_files
264265
exit 0
265266
done
266267

programs/x86_64/deadbeef

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ read -r -p "
2424
2525
2. DeaDBeeF AppImage
2626
Unofficial AppImage of DeaDBeeF, has the advantace that it is one smaller file
27-
Can also be sandboxed with 'am --sandbox deadbeef' but that prevents DeaDBeeF from launching custom scripts
27+
It can be sandboxed with 'am --sandbox deadbeef' or 'appman --sandbox deadbeef'
2828
Source: https://github.com/Samueru-sama/DeaDBeef-AppImage
2929
3030
3. DeaDBeeF Nightly
@@ -33,7 +33,7 @@ read -r -p "
3333
3434
4. DeaDBeeF Nightly AppImage
3535
Unofficial AppImage of the Nightly version of DeaDBeeF, has the advantace that it is one smaller file
36-
Can also be sandboxed with 'am --sandbox deadbeef' but that prevents DeaDBeeF from launching custom scripts
36+
it can be sandboxed with 'am --sandbox deadbeef' or 'appman --sandbox deadbeef'
3737
Source: https://github.com/Samueru-sama/DeaDBeef-AppImage
3838
3939
Which version you choose (type a number and press ENTER)?: " RESPONSE

0 commit comments

Comments
 (0)