diff --git a/bin/LAUNCH.sh b/bin/LAUNCH.sh index 6970787e..b20153cf 100755 --- a/bin/LAUNCH.sh +++ b/bin/LAUNCH.sh @@ -447,6 +447,16 @@ function update() { bash -c "python3 $bin_dir/Update.py $1" exitStatus=$? + if [ $exitStatus -ge 3 ]; then + echo -e "\t* Update..." + bash -c "python3 $bin_dir/Update.py $1" + exitStatus=$? + if [ $exitStatus -ge 1 ]; then + echo -e $RED"\t* Update Error"$DEFAULT + exit + fi + fi + if [ $exitStatus -ge 1 ]; then echo -e $RED"\t* Update Error"$DEFAULT exit diff --git a/bin/Update.py b/bin/Update.py index 2060a68c..51c835ee 100755 --- a/bin/Update.py +++ b/bin/Update.py @@ -16,6 +16,10 @@ import argparse import subprocess +UPDATER_FILENAME = os.path.join(os.environ['AIL_BIN'], 'Update.py') + +UPDATER_LAST_MODIFICATION = float(os.stat(UPDATER_FILENAME).st_mtime) + def auto_update_enabled(cfg): auto_update = cfg.get('Update', 'auto_update') if auto_update == 'True' or auto_update == 'true': @@ -230,6 +234,12 @@ def update_ail(current_tag, list_upper_tags_remote, current_version_path, is_for output = process.stdout.decode() print(output) + # CHECK IF UPDATER Update + if float(os.stat(UPDATER_FILENAME).st_mtime) > UPDATER_LAST_MODIFICATION: + # request updater relauch + print('{}{}{}'.format(TERMINAL_RED, ' Relaunch Launcher ', TERMINAL_DEFAULT)) + sys.exit(3) + if len(list_upper_tags_remote) == 1: # additional update (between 2 commits on the same version) additional_update_path = os.path.join(os.environ['AIL_HOME'], 'update', current_tag, 'additional_update.sh') diff --git a/update/v1.0/Update.sh b/update/v1.0/Update.sh index c65dadde..1d3691d0 100755 --- a/update/v1.0/Update.sh +++ b/update/v1.0/Update.sh @@ -1,4 +1,15 @@ #!/bin/bash +YELLOW="\\033[1;33m" +DEFAULT="\\033[0;39m" + +echo -e $YELLOW"\t" +echo -e "* ------------------------------------------------------------------" +echo -e "\t" +echo -e " - - - - - - - - PLEASE RELAUNCH AIL - - - - - - - - " +echo -e "\t" +echo -e "* ------------------------------------------------------------------" +echo -e "\t" +echo -e "\t"$DEFAULT # fix invalid Updater version (kill parent): kill -SIGUSR1 `ps --pid $$ -oppid=`; exit