Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 29 additions & 18 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-10"
AMVERSION="9.1.2"

# Determine main repository and branch
AMREPO="https://raw.githubusercontent.com/ivan-hc/AM/main"
Expand Down Expand Up @@ -804,6 +804,7 @@ function _update_list_updatable_apps() {
}

function _update_determine_apps_version_changes() {
[ -z "$debug_update" ] && echo "$DIVIDING_LINE"
if test -f "$AMCACHEDIR"/updatable-args-list; then
mv "$AMCACHEDIR"/updatable-args-list "$AMCACHEDIR"/updatable-args-list-old
_update_list_updatable_apps
Expand All @@ -826,20 +827,20 @@ function _update_run_updater() {
GH_API_ALLOWED=$(curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/ivan-hc/AM/releases/latest | sed 's/[()",{} ]/\n/g' | grep "^ivan-hc" | head -1)
if [ -z "$GH_API_ALLOWED" ]; then
if command -v torsocks 1>/dev/null; then
torsocks "$argpath"/AM-updater >/dev/null 2>&1
[ -z "$debug_update" ] && torsocks "$argpath"/AM-updater >/dev/null 2>&1 || torsocks "$argpath"/AM-updater
else
echo " ✖ $APPNAME cannot be updated, you have reached GitHub API limit. Install \"torsocks\" from your system package manager and retry!" \
| fold -sw 72 | sed 's/^/ /g; s/ ✖/✖/g'
fi
else
"$argpath"/AM-updater >/dev/null 2>&1
[ -z "$debug_update" ] && "$argpath"/AM-updater >/dev/null 2>&1 || "$argpath"/AM-updater
fi
else
"$argpath"/AM-updater >/dev/null 2>&1
[ -z "$debug_update" ] && "$argpath"/AM-updater >/dev/null 2>&1 || "$argpath"/AM-updater
fi
end=$(date +%s)
echo " ◆ $APPNAME is updated, $((end - start)) seconds elapsed!"
echo "$DIVIDING_LINE"
[ -n "$debug_update" ] && echo "$DIVIDING_LINE"
}

function _update_app() {
Expand Down Expand Up @@ -871,24 +872,32 @@ function _use_update() {
_online_check
_update_github_api_key_in_the_updater_files
_clean_all_tmp_directories_from_appspath >/dev/null
case $2 in
''|'--apps')

ENTRIES="$(echo "$@" | cut -f2- -d ' ' | tr ' ' '\n' | grep -v -- "^-\|^$1$")"
FLAGS=$(echo "$@" | tr ' ' '\n' | grep -- "--" | tr '\n ' ' ')
if echo "$FLAGS" | grep -q -- "--debug"; then
debug_update="1"
fi
if [ -z "$ENTRIES" ]; then
_clean_amcachedir
_update_list_updatable_apps
echo -e "$DIVIDING_LINE\n \"$AMCLIUPPER\" CAN MANAGE UPDATES FOR THE FOLLOWING PROGRAMS:\n"
[ -f "$AMCACHEDIR/updatable-args-list" ] && grep "◆" "$AMCACHEDIR/updatable-args-list" | sort || echo " None"
echo -e "\n All self-updatable programs are excluded"
echo -e "$DIVIDING_LINE\n >> START OF ALL PROCESSES <<\n$DIVIDING_LINE"
_update_all_apps
[ -z "$2" ] && echo "$DIVIDING_LINE" && _use_sync
echo -e "$DIVIDING_LINE\n >> END OF ALL PROCESSES << \n$DIVIDING_LINE"
sleep 0.2
exit 0
;;
*)
echo "$DIVIDING_LINE"
if ! echo "$FLAGS" | grep -q -- "--apps"; then
echo "$DIVIDING_LINE"
_use_sync
echo -e " >> END OF ALL PROCESSES << \n$DIVIDING_LINE"
sleep 0.2
exit 0
else
echo "$DIVIDING_LINE"
fi
else
[ -n "$debug_update" ] && echo "$DIVIDING_LINE"
_determine_args
ENTRIES="$(echo "$@" | cut -f2- -d ' ')"
for arg in $ENTRIES; do
argpath=$(echo "$ARGPATHS" | grep "/$arg$")
if test -f "$argpath"/AM-updater; then
Expand All @@ -902,8 +911,7 @@ function _use_update() {
done
wait
exit 0
;;
esac
fi
}

function _use_force_latest() {
Expand Down Expand Up @@ -1235,9 +1243,12 @@ case "$1" in

${LightBlue}$AMCLI -u
${LightBlue}$AMCLI -u --apps
${LightBlue}$AMCLI -u --debug
${LightBlue}$AMCLI -u --apps --debug
${LightBlue}$AMCLI -u {PROGRAM}\033[0m
${LightBlue}$AMCLI -u --debug {PROGRAM}\033[0m

Description: Update everything. Add \"--apps\" to update only the apps or write only the apps you want to update by adding their names.
Description: Update everything. Add \"--apps\" to update only the apps or write only the apps you want to update by adding their names. Add the \"--debug\" flag to view the output of AM-updater scripts.

${Gold}version, -v\033[0m

Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ Option `-u` or `update` updates all the installed apps and keeps "AM"/"AppMan" i
3. To update all the programs and "AM"/"AppMan" itself, just run the command`am -u` / `appman -u`
4. To update only "AM"/"AppMan" and the modules use the option `-s` instead, `am -s` / `appman -s`

The `-u` option can also be combined with the `--debug` flag to show the output of installed application updates.

### How to update everything using Topgrade
Keeping your system up to date usually involves invoking multiple package managers. This results in big, non-portable shell one-liners saved in your shell. To remedy this, Topgrade detects which tools you use and runs the appropriate commands to update them.

Expand Down Expand Up @@ -541,13 +543,16 @@ Unlock updates for the selected program (nulls "`lock`").
------------------------------------------------------------------------
### `update`, `-u`, `-U`

am -u
am -u --apps
am -u {PROGRAM}
am -u
am -u --apps
am -u --debug
am -u --apps --debug
am -u {PROGRAM}
am -u --debug {PROGRAM}

**Description**:

Update everything. Add "`--apps`" to update only the apps or write only the apps you want to update by adding their names.
Update everything. Add "`--apps`" to update only the apps or write only the apps you want to update by adding their names. Add the "`--debug`" flag to view the output of AM-updater scripts.

------------------------------------------------------------------------
### `version`, `-v`
Expand Down