diff --git a/launch_chffrplus.sh b/launch_chffrplus.sh index ae1660411b..1a1c41706f 100755 --- a/launch_chffrplus.sh +++ b/launch_chffrplus.sh @@ -14,12 +14,17 @@ if [ -z "$PASSIVE" ]; then export PASSIVE="1" fi +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + STAGING_ROOT="/data/safe_staging" function launch { # Wifi scan wpa_cli IFNAME=wlan0 SCAN + # Remove orphaned git lock if it exists on boot + [ -f "$DIR/.git/index.lock" ] && rm -f $DIR/.git/index.lock + # Check to see if there's a valid overlay-based update available. Conditions # are as follows: # @@ -75,7 +80,6 @@ function launch { [ -d "/proc/irq/733" ] && echo 3 > /proc/irq/733/smp_affinity_list # USB for LeEco [ -d "/proc/irq/736" ] && echo 3 > /proc/irq/736/smp_affinity_list # USB for OP3T - DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" # Remove old NEOS update file # TODO: move this code to the updater diff --git a/selfdrive/manager.py b/selfdrive/manager.py index 62d4827ca7..9e08bece59 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -389,6 +389,14 @@ def cleanup_all_processes(signal, frame): kill_managed_process(name) cloudlog.info("everything is dead") + +def send_managed_process_signal(name, sig): + if name not in running or name not in managed_processes: + return + cloudlog.info(f"sending signal {sig} to {name}") + os.kill(running[name].pid, sig) + + # ****************** run loop ****************** def manager_init(should_register=True): @@ -457,6 +465,7 @@ def manager_thread(): for k in os.getenv("BLOCK").split(","): del managed_processes[k] + started_prev = False logger_dead = False while 1: @@ -496,6 +505,12 @@ def manager_thread(): else: kill_managed_process(p) + # trigger an update after going offroad + if started_prev: + send_managed_process_signal("updated", signal.SIGHUP) + + started_prev = msg.thermal.started + # check the status of all processes, did any of them die? running_list = ["%s%s\u001b[0m" % ("\u001b[32m" if running[p].is_alive() else "\u001b[31m", p) for p in running] cloudlog.debug(' '.join(running_list)) diff --git a/selfdrive/updated.py b/selfdrive/updated.py index e8ed98a15b..21c0ec9806 100755 --- a/selfdrive/updated.py +++ b/selfdrive/updated.py @@ -263,7 +263,7 @@ def main(): # Check for internet every 30s time_wrong = datetime.datetime.utcnow().year < 2019 - ping_failed = subprocess.call(["ping", "-W", "4", "-c", "1", "8.8.8.8"]) + ping_failed = os.system("git ls-remote --tags --quiet") != 0 if ping_failed or time_wrong: wait_helper.sleep(30) continue