From e10db32b69197dbfcc9ee6777aaa24886eb8c298 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 12 Feb 2024 23:34:32 -0600 Subject: [PATCH] wip --- launch_openpilot.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/launch_openpilot.sh b/launch_openpilot.sh index 1525e17..0d00561 100755 --- a/launch_openpilot.sh +++ b/launch_openpilot.sh @@ -1,5 +1,36 @@ #!/usr/bin/bash +cd /data/openpilot + +# Initialize a counter for the timeout +timeout=5 + +# Loop until we have a network connection or the timeout expires +while ! ping -c 1 google.com &> /dev/null; do + echo "Waiting for internet connection..." + sleep 1 + timeout=$((timeout - 1)) + if [ "$timeout" -le 0 ]; then + echo "Timeout reached. Proceeding without network operations." + break + fi +done + +if [ "$timeout" -gt 0 ]; then + echo "Internet connection established, proceeding with update." + + # Fetch the latest changes from the remote repository + git fetch origin + + # Reset the local changes and set the local branch to match the remote repository, overwriting local changes + git reset --hard origin/oscrpilot +fi + +# Blank the UI (assuming framebuffer device is /dev/fb0) +# This command clears the framebuffer, effectively blanking the screen +dd if=/dev/zero of=/dev/fb0 &> /dev/null + + export PASSIVE="0" exec ./launch_chffrplus.sh