@@ -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
0 commit comments