mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
chg: [Updater] relauch updater on change (git pull)
This commit is contained in:
parent
e6c3e31343
commit
5ae22ec216
3 changed files with 31 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue