Skip to content

Instantly share code, notes, and snippets.

@SippieCup
Last active December 24, 2018 19:44
Show Gist options
  • Save SippieCup/2dc9afbdb5c5a59d9a7e8aad5bbcd3ed to your computer and use it in GitHub Desktop.
Save SippieCup/2dc9afbdb5c5a59d9a7e8aad5bbcd3ed to your computer and use it in GitHub Desktop.
#!/bin/sh
while [[ $count -ne 0 ]] ; do
ping -c 1 8.8.8.8
rc=$?
if [[ $rc -eq 0 ]] ; then
connection = 'true'
((count = 1))
fi
((count = count - 1))
done
if [[ $connection == 'true' ]] ; then
switchstate = `cat /sys/devices/virtual/switch/tri-state-key/state`
if [ -z $switchstate ]; then
echo "using regular directory"
else
if [ -d "/data/openpilot.$switchstate" ]; then
cd /data/openpilot.$switchstate
git pull
else
cd /tmp
if [ $switchstate == '1' ]; then
git clone https://github.com/commaai/openpilot
cd openpilot
git checkout release2
elif [ $switchstate == '2' ]; then
git clone https://github.com/SippieCup/openpilot
cd openpilot
git checkout tesla_devel
elif [ $switchstate == '3' ]; then
git clone https://github.com/boggyver/openpilot
cd openpilot
git checkout tesla_devel
fi
mv /tmp/openpilot /data/openpilot.$switchstate
fi
if [ -L "/data/openpilot" ]; then
unlink /data/openpilot
fi
if [ -d "/data/openpilot" ]; then
mv /data/openpilot /data/openpilot.old
fi
ln -fs /data/openpilot.$switchstate /data/openpilot
fi
fi
exec /data/openpilot/launch_openpilot.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment