11#! /usr/bin/env bash
22
3- AMVERSION=" 9.4.4 "
3+ AMVERSION=" 9.5 "
44
55# Determine main repository and branch
66AMREPO=" https://raw.githubusercontent.com/ivan-hc/AM/main"
@@ -57,8 +57,14 @@ _create_cache_dir() {
5757}
5858
5959_clean_amcachedir () {
60- [ " $AMCLI " = am ] && [ -d " $CACHEDIR " /am ] && rm -f " $CACHEDIR " /am/*
61- [ -d " $CACHEDIR " /appman ] && rm -f " $CACHEDIR " /appman/*
60+ if [ " $AMCLI " = am ] && [ -d " $CACHEDIR " /am ]; then
61+ rm -f " $CACHEDIR " /am/* rm -f " $CACHEDIR " /am/* /* 2> /dev/null
62+ rmdir " $CACHEDIR " /am/* 2> /dev/null
63+ fi
64+ if [ -d " $CACHEDIR " /appman ]; then
65+ rm -f " $CACHEDIR " /appman/* " $CACHEDIR " /appman/* /* 2> /dev/null
66+ rmdir " $CACHEDIR " /appman/* 2> /dev/null
67+ fi
6268}
6369
6470# Fit texts to an acceptable width
@@ -99,9 +105,9 @@ sed() {
99105 fi
100106}
101107
102- # ###############################################################################
108+ # ###############################################################################################################################################################
103109# AM/APPMAN
104- # ###############################################################################
110+ # ###############################################################################################################################################################
105111
106112# "APPMAN" CORE VARIABLES AND FUNCTIONS
107113APPMAN_SETUP_MSG=" Before proceeding with any task, where do you want to install apps?
@@ -241,9 +247,9 @@ _icon_theme_export_to_datadir() {
241247 [ -n " $APPMAN_APPSPATH " ] && ln -s " $APPMAN_APPSPATH " /* /icons/* .* " $DATADIR " /icons/hicolor/scalable/apps
242248}
243249
244- # ###############################################################################
250+ # ###############################################################################################################################################################
245251# FINALIZE
246- # ###############################################################################
252+ # ###############################################################################################################################################################
247253
248254AMCLIUPPER=$( echo " $AMCLI " | tr ' [:lower:]' ' [:upper:]' )
249255
@@ -264,17 +270,17 @@ _betatester_message_on() {
264270 fi
265271}
266272
267- # ###############################################################################
273+ # ###############################################################################################################################################################
268274# APPS DATABASE
269- # ###############################################################################
275+ # ###############################################################################################################################################################
270276
271277# Apps database in use
272278APPSDB=" ${APPSDB:- $AMREPO / programs/ $ARCH } "
273279APPSLISTDB=" ${APPSLISTDB:- $AMREPO / programs/ $ARCH -apps} "
274280
275- # ###############################################################################
281+ # ###############################################################################################################################################################
276282# SECURITY
277- # ###############################################################################
283+ # ###############################################################################################################################################################
278284
279285# SAFETY CHECKS
280286_am_dependences_check () {
@@ -352,9 +358,9 @@ elif command -v appimagelauncherd &>/dev/null; then
352358 _blacklisted_file
353359fi
354360
355- # ###############################################################################
361+ # ###############################################################################################################################################################
356362# 3RD PARTY
357- # ###############################################################################
363+ # ###############################################################################################################################################################
358364
359365_use_newrepo () {
360366 [ -z " $2 " ] && echo " USAGE: $AMCLI $1 [ARGUMENT]" && exit 1
@@ -413,72 +419,90 @@ _am_newrepo_check() {
413419
414420_am_newrepo_check " $@ "
415421
416- # ###############################################################################
422+ # ###############################################################################################################################################################
417423# 3RD PARTY SOURCES
418- # ###############################################################################
424+ # ###############################################################################################################################################################
419425
420426third_party_flags_message=" "
421427
422- # APPBUNDLEHUB
423- export appbundle_repo=" https://github.com/xplshn/AppBundleHUB"
424- appbundle_readme=" https://raw.githubusercontent.com/xplshn/dbin-metadata/refs/heads/master/misc/cmd/AM-support/AM.txt"
425-
426- _sync_appbundle_list () {
427- rm -f " $AMDATADIR /$ARCH -appbundle"
428- [ -n " $appbundle_readme " ] && curl -Ls " $appbundle_readme " | grep -v " \.appimage \|?" | grep " \.appbundle " | cut -d" :" -f1 | cut -d" @" -f2 \
429- | sed ' s/^| /◆ /g; s/ https$//g; s/ :$//g; s/ | / : /g; s/ |$/./g; s/\.\.$/./g;' | sort > " $AMDATADIR /$ARCH -appbundle" \
430- || touch " $AMDATADIR /$ARCH -appbundle"
428+ _third_party_lsts_filter () {
429+ grep -v -- " ---\|^| appname" | awk -F' |' ' {print $2, $3}' | sed ' s/^/◆/g; s/ / : /g; s/ $//g'
431430}
432431
433- # TOOLPACKS
434- toolpack_repo=" https://github.com/Azathothas/Toolpacks"
435- toolpack_readme=" https://bin.pkgforge.dev/${ARCH} /AM.txt"
432+ # ################################
433+ # APPBUNDLEHUB
434+ # ################################
435+ export appbundle_repo=" https://github.com/xplshn/AppBundleHUB"
436+ # export appbundle_readme="https://raw.githubusercontent.com/xplshn/dbin-metadata/master/misc/cmd/AM-support/AM.txt"
437+ # [ -n "$appbundle_readme" ] && third_party_flags="$third_party_flags --appbundle"
438+
439+ # ################################
440+ # TOOLPACKS/SOARPKGS
441+ # ################################
442+ export toolpack_repo=" https://github.com/pkgforge/soarpkgs (ex toolpacks)"
443+ export toolpack_readme=" https://raw.githubusercontent.com/ivan-hc/am-extras/main/soarpkgs-toolpacks/${ARCH} .md"
436444[ -n " $toolpack_readme " ] && third_party_flags=" $third_party_flags --toolpack"
437- [ -n " $toolpack_readme " ] && third_party_flags_message=" $third_party_flags_message \n
438- ${Gold} --toolpack\033[0m
439-
440- ${LightBlue} $AMCLI -i --toolpack {PROGRAM}\033[0m
441- ${LightBlue} am -i --toolpack --user {PROGRAM}\033[0m
442- ${LightBlue} $AMCLI -l --toolpack\033[0m
443- ${LightBlue} $AMCLI -q --toolpack {KEYWORD}\033[0m
444445
445- Description: This is a flag to use in \" -i\" to install Toolpack programs, in \" -l\" to list all available \
446- Toolpacks, and \" -q\" to search the Toolpack list. Toolpack is a collection of programs external to the \" AM\" \
447- database. Visit $toolpack_repo to learn more.
446+ export toolpack_missing_file_msg=" \nIt appears that the selected file is not available.\n\nThis happens due to pkgforge's mirror Issue.\nLearn more: https://docs.pkgforge.dev/repositories/bincache/cache\n\nAlternatively, install \" soar\" or \" dbin\" and use those.\n\n"
448447
449- NOTE, for installations you can use \" .toolpack\" as the package extension instead of using the flag.
450- "
451-
452- _sync_toolpacks_list () {
453- rm -f " $AMDATADIR /$ARCH -toolpack"
454- [ -n " $toolpack_readme " ] && curl -Ls " $toolpack_readme " | grep -v " \.appimage \|.appbundle \|?" | cut -d" :" -f1 | cut -d" @" -f2 \
455- | sed ' s/^| /◆ /g; s/ | https$/. To install it use the "--toolpack" flag./g; s/ | / : /g' | sort > " $AMDATADIR /$ARCH -toolpack" \
456- || touch " $AMDATADIR /$ARCH -toolpack"
457- }
458-
459- # ###############################
448+ # ################################
460449# ALL THE ABOVE
461- # ###############################
450+ # ################################
451+ third_party_lists=" appbundle toolpack"
462452
463- export third_party_lists=" appbundle toolpack"
453+ _remove_known_third_party_extensions () {
454+ sed ' s/\.toolpack//g; s/\.dwfs.appbundle$//g; s/\.appbundle$//g'
455+ }
464456
465- _completion_list_third_party () {
466- [ -f " $AMDATADIR " /" $ARCH " -appbundle ] && awk ' {print $2}' " $AMDATADIR " /" $ARCH " -appbundle >> " $AMDATADIR " /list
467- [ -f " $AMDATADIR " /" $ARCH " -toolpack ] && awk ' {print $2}' " $AMDATADIR " /" $ARCH " -toolpack | sed -e ' s/$/.toolpack/' >> " $AMDATADIR " /list
457+ _files_db_third_party () {
458+ for tp_list in $third_party_lists ; do
459+ if test -f " $APPSPATH " /" $arg " /.am-installer/* ." $tp_list " ; then
460+ export DB=" $tp_list "
461+ fi
462+ done
468463}
469464
470465_sync_third_party_lists () {
471- _sync_appbundle_list
472- # _sync_toolpacks_list
466+ for tp_list in $third_party_lists ; do
467+ rm -f " $AMDATADIR " /" $ARCH " -" $tp_list "
468+ tprepo_readme=" ${tp_list} _readme"
469+ if [ -n " ${! tprepo_readme} " ]; then
470+ curl -Ls " ${! tprepo_readme} " | _third_party_lsts_filter \
471+ | sed " s/$/. To install it use the --$tp_list flag or the .$tp_list extension./g" | sort > " $AMDATADIR " /" $ARCH " -" $tp_list " \
472+ || touch " $AMDATADIR " /" $ARCH " -" $tp_list "
473+ fi
474+ done
475+ }
476+
477+ _completion_list_third_party () {
478+ for tp_list in $third_party_lists ; do
479+ [ -f " $AMDATADIR " /" $ARCH " -" $tp_list " ] && awk ' {print $2}' " $AMDATADIR " /" $ARCH " -" $tp_list " >> " $AMDATADIR " /list && awk ' {print $2}' " $AMDATADIR " /" $ARCH " -" $tp_list " | sed -e " s/$/.$tp_list /" >> " $AMDATADIR " /list
480+ done
473481}
474482
475483export awk_name=" 1" awk_description=" 2" awk_site=" 3" awk_dl=" 4" awk_ver=" 5" # Numbers to use in "awk" to determine columns
476484
485+ if [ -n " $third_party_flags " ]; then
486+ for flag in $third_party_flags ; do
487+ tpflag_name=$( echo " $flag " | tr ' -' ' \n ' | grep .)
488+ tprepo_name=" ${tpflag_name} _repo"
489+ third_party_flags_message=" $third_party_flags_message \n
490+ ${Gold} --$tpflag_name \033[0m
491+
492+ ${LightBlue} $AMCLI -i --$tpflag_name {PROGRAM}\033[0m
493+ ${LightBlue} am -i --$tpflag_name --user {PROGRAM}\033[0m
494+ ${LightBlue} $AMCLI -l --$tpflag_name \033[0m
495+
496+ Description: This is a flag to use in \" -i\" and \" -l\" to install/list ${tpflag_name^} s from ${! tprepo_name} . You can also use it in \" -q\" as a keyword. For installations you can use .$tpflag_name as the package extension instead of using the flag.
497+ "
498+ done
499+ fi
500+
477501[ -z " $third_party_flags_message " ] && third_party_flags_message=" none\n"
478502
479- # ###############################################################################
503+ # ###############################################################################################################################################################
480504# UTILITIES
481- # ###############################################################################
505+ # ###############################################################################################################################################################
482506
483507# COMPLETION LIST
484508available_options=" about add apikey backup clean config disable downgrade download enable extra files hide home icons info \
@@ -623,9 +647,9 @@ _remove_info_files() {
623647 rm -f " $AMCACHEDIR " /version-args
624648}
625649
626- # ###############################################################################
650+ # ###############################################################################################################################################################
627651# APIKEY
628- # ###############################################################################
652+ # ###############################################################################################################################################################
629653
630654ghapikey_file=" $AMDATADIR /ghapikey.txt"
631655# Set header authorization if GitHub API key file exists
@@ -666,9 +690,9 @@ _update_github_api_key_in_the_updater_files() {
666690 fi
667691}
668692
669- # ###############################################################################
693+ # ###############################################################################################################################################################
670694# APPMAN MODE
671- # ###############################################################################
695+ # ###############################################################################################################################################################
672696
673697APPMAN_MSG=" $DIVIDING_LINE \n \" AM\" is running as \" AppMan\" , use ${Green} am --system\033[0m to switch it back to \" AM\" \n$DIVIDING_LINE \n"
674698APPMAN_MSG_OFF=" $DIVIDING_LINE \n \" AppMan Mode\" disabled! \n$DIVIDING_LINE \n"
@@ -704,9 +728,9 @@ if [ "$AMCLI" = am ]; then
704728 fi
705729fi
706730
707- # ###############################################################################
731+ # ###############################################################################################################################################################
708732# CLEAN
709- # ###############################################################################
733+ # ###############################################################################################################################################################
710734
711735_clean_amcachedir_message () {
712736 _clean_amcachedir
@@ -801,9 +825,9 @@ _use_clean() {
801825 _clean_old_modules
802826}
803827
804- # ###############################################################################
828+ # ###############################################################################################################################################################
805829# HIDE/UNHIDE
806- # ###############################################################################
830+ # ###############################################################################################################################################################
807831
808832_use_hide_unhide () {
809833 entries=" $( echo " $@ " | cut -f2- -d ' ' ) "
@@ -824,9 +848,9 @@ _use_hide_unhide() {
824848 fi
825849}
826850
827- # ###############################################################################
851+ # ###############################################################################################################################################################
828852# SYNC
829- # ###############################################################################
853+ # ###############################################################################################################################################################
830854
831855_sync_installation_scripts () {
832856 printf " %b\n Checking for changes of the installation scripts in the online database...\n" " $DIVIDING_LINE "
@@ -921,9 +945,9 @@ _use_sync() {
921945 echo " $DIVIDING_LINE "
922946}
923947
924- # ###############################################################################
948+ # ###############################################################################################################################################################
925949# UPDATE
926- # ###############################################################################
950+ # ###############################################################################################################################################################
927951
928952_update_updatable_apps_msg_head () {
929953 printf " \" %b\" CAN MANAGE UPDATES FOR THE FOLLOWING PROGRAMS:\n%b\n\n" " $AMCLIUPPER " " $DIVIDING_LINE "
@@ -1145,9 +1169,9 @@ _use_force_latest() {
11451169 done
11461170}
11471171
1148- # ###############################################################################
1172+ # ###############################################################################################################################################################
11491173# USAGE
1150- # ###############################################################################
1174+ # ###############################################################################################################################################################
11511175
11521176# HANDLE ALL THE EXTERNAL MODULES
11531177_use_module () {
@@ -1256,9 +1280,9 @@ case "$1" in
12561280 for n in $ARGPATHS ; do sed -e ' /notify-send/ s/^#*//' -i " $n /AM-updater" 2> /dev/null; done
12571281 ;;
12581282 ' help' |' -h' )
1259- # ###############################################################################
1283+ # ###############################################################################################################################################################
12601284 # HELP
1261- # ###############################################################################
1285+ # ###############################################################################################################################################################
12621286
12631287 _use_help () {
12641288 [ " $CLI " = am ] && [ -f " $APPMANCONFIG " /appman-mode ] && printf " %b" " $APPMAN_MSG "
@@ -1418,9 +1442,9 @@ case "$1" in
14181442 ${LightBlue} $AMCLI -q {KEYWORD}
14191443 ${LightBlue} $AMCLI -q --all {KEYWORD}
14201444 ${LightBlue} $AMCLI -q --appimages {KEYWORD}
1421- ${LightBlue} $AMCLI -q --pkg {PROGRAM1} {PROGRAM2}[0m
1445+ ${LightBlue} $AMCLI -q --pkg {PROGRAM1} {PROGRAM2}\033 [0m
14221446
1423- Description: Search for keywords in the list of available applications, add the \" --appimages\" option to list only the AppImages or add \" --pkg\" to list multiple programs at once. It can also be extended with additional flags, the \" --all\" flag allows you to consult the set of all supported databases (see third-party flags, at the bottom of this message) .
1447+ Description: Search for keywords in the list of available applications, add the \" --appimages\" option to list only the AppImages or add \" --pkg\" to list multiple programs at once. The \" --all\" flag allows you to consult the set of all supported databases.
14241448
14251449 ${Gold} remove, -r\033[0m
14261450
0 commit comments