37 lines
969 B
Bash
Executable File
37 lines
969 B
Bash
Executable File
#!/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
|
|
|