Skip to content

Commit 619a533

Browse files
authored
"AM" 9.6: Add new option "reinstall" (#1387)
* Update APP-MANAGER - add option "reinstall" - add a message in "-s" to suggest using the new "reinstall" option, it will appear only if there are scripts with modifications * Update install.am - add new option "reinstall" to remove and reinstall the app - option "reinstall", add messages * Update README.md
1 parent 7e2ac54 commit 619a533

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed

APP-MANAGER

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

3-
AMVERSION="9.5-7"
3+
AMVERSION="9.6"
44

55
# Determine main repository and branch
66
AMREPO="https://raw.githubusercontent.com/ivan-hc/AM/main"
@@ -507,7 +507,7 @@ fi
507507

508508
# COMPLETION LIST
509509
available_options="about add apikey backup clean config disable downgrade download enable extra files hide home icons info \
510-
install install-appimage launcher list lock neodb newrepo nolibfuse off on overwrite purge query remove sandbox \
510+
install install-appimage launcher list lock neodb newrepo nolibfuse off on overwrite purge query reinstall remove sandbox \
511511
select sync template test unhide unlock update --all --appimages --apps --byname --config --convert --debug \
512512
--devmode-disable --devmode-enable --disable-notifications --enable-notifications --force-latest --home --icons \
513513
-ias --launcher --less --pkg --rollback --disable-sandbox --sandbox --system --user $third_party_flags"
@@ -876,6 +876,7 @@ _sync_installation_scripts() {
876876
echo -ne "\r" 2>/dev/null
877877
else
878878
printf " ◆ %b%b\033[0m has changed, you may need to reinstall it, see\n https://github.com/ivan-hc/AM/blob/main/programs/%b/%b\n" "${RED}" "$scriptname" "$ARCH" "$scriptname"
879+
to_reinstall_true=1
879880
fi
880881
else
881882
if curl --output /dev/null --silent --head --fail "$APPSDB"/"$arg" 1>/dev/null; then
@@ -886,6 +887,7 @@ _sync_installation_scripts() {
886887
fi
887888
fi
888889
done
890+
[ -n "$to_reinstall_true" ] && printf "\n To fix the above, just run \"%b%b reinstall\033[0m\", without arguments\n" "${Green}" "$AMCLI"
889891
}
890892

891893
_sync_appimages_list() {
@@ -1235,7 +1237,8 @@ case "$1" in
12351237
'download'|'-d'|\
12361238
'extra'|'-e'|\
12371239
'install'|'-i'|'-ias'|\
1238-
'install-appimage'|'-ia')
1240+
'install-appimage'|'-ia'|\
1241+
'reinstall')
12391242
MODULE="install.am"
12401243
_online_check
12411244
[ "$CLI" = am ] && [ -f "$APPMANCONFIG"/appman-mode ] && printf "%b" "$APPMAN_MSG"
@@ -1457,6 +1460,12 @@ case "$1" in
14571460
14581461
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.
14591462
1463+
${Gold}reinstall\033[0m
1464+
1465+
${LightBlue}$AMCLI reinstall\033[0m
1466+
1467+
Description: Reinstall only programs whose installation script has been modified in AM's online database.
1468+
14601469
${Gold}remove, -r\033[0m
14611470
14621471
${LightBlue}$AMCLI -r {PROGRAM}\033[0m

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,15 @@ Overwrite apps with snapshots saved previously (see "`-b`").
522522

523523
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.
524524

525+
------------------------------------------------------------------------
526+
### `reinstall`
527+
528+
am reinstall
529+
530+
**Description**:
531+
532+
Reinstall only programs whose installation script has been modified in AM's online database.
533+
525534
------------------------------------------------------------------------
526535
### `remove`, `-r`
527536

modules/install.am

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,4 +591,30 @@ case "$1" in
591591
|| "$AMCLIPATH_ORIGIN" -i "$CACHEDIR/extra/$EXTERNAL_APP_NAME"
592592
exit 1
593593
;;
594+
595+
'reinstall')
596+
printf "%b\n Checking for changes of the installation scripts in the online database...\n%b\n" "$DIVIDING_LINE" "$DIVIDING_LINE"
597+
_determine_args
598+
for arg in $ARGS; do
599+
argpath=$(echo "$ARGPATHS" | grep "/$arg$")
600+
if [ -f "$argpath"/AM-updater ]; then
601+
mkdir -p "$argpath"/.am-installer
602+
scriptname=$(ls "$argpath/.am-installer/" | head -1)
603+
if [ -n "$scriptname" ]; then
604+
CURRENT=$(cat "$argpath"/.am-installer/"$scriptname")
605+
SOURCE=$(curl -Ls "$APPSDB"/"$scriptname")
606+
if [ "$CURRENT" != "$SOURCE" ]; then
607+
reinstall_true=1
608+
"$AMCLIPATH_ORIGIN" -R "$arg"
609+
if [ "$AMCLI" = "am" ] && ! echo "$argpath" | grep -q "^/opt"; then
610+
"$AMCLIPATH_ORIGIN" -i --user "$scriptname"
611+
else
612+
"$AMCLIPATH_ORIGIN" -i "$scriptname"
613+
fi
614+
fi
615+
fi
616+
fi
617+
done
618+
[ -n "$reinstall_true" ] && printf " App removal and reinstallation complete! \n%b\n" "$DIVIDING_LINE" || printf " Nothing to do here! \n%b\n" "$DIVIDING_LINE"
619+
;;
594620
esac

0 commit comments

Comments
 (0)