This commit is contained in:
Your Name
2024-04-29 00:23:31 -05:00
parent e3eeb293db
commit 68c29c6842
7 changed files with 67 additions and 14 deletions

View File

@@ -44,6 +44,7 @@ function launch {
# 2. The FINALIZED consistent file has to exist, indicating there's an update
# that completed successfully and synced to disk.
# CLEARPILOT
# if [ -f "${BASEDIR}/.overlay_init" ]; then
# find ${BASEDIR}/.git -newer ${BASEDIR}/.overlay_init | grep -q '.' 2> /dev/null
# if [ $? -eq 0 ]; then

View File

@@ -13,12 +13,18 @@
# sudo apt-get install -y nodejs
# fi
apt-get update
apt-get install -y nodejs npm python3-pyqt5 pywayland python3-pyqt5.qtwebengine imagemagick
pip3 install termqt
# Todo: update the crash screen to have an option to restore previous version if one exists. (/data/openpilot_failsafe)
# If no previous version, present an option to check out updated release.
# Todo: Detect if provisioned for current version. If not, start qt_shell subshell for provision.
apt-get update
apt-get install -y nodejs npm python3-pyqt5 pywayland imagemagick
# apt-get install -y python3-pyqt5.qtwebengine
# Detect if libyuv is installed. If it is, nothing to do.
cd /data/openpilot/third_party/libyuv
bash build.sh
cd libyuv && make && make install
pip install PyQt5-sip
# pip install PyQt5-sip

View File

@@ -2,7 +2,8 @@
set -x
# Test: sudo mount -o remount,rw /; cp /usr/comma/bg.org /usr/comma/bg.jpg; bash shell/set_logo.sh
# Todo: Put stock image in the repo, so we can reset the stock with it if some other
# fork changed it and failed to restore it on uninstall
# Check if md5sum of /usr/comma/bg.jpg is not equal to md5sum of /data/openpilot/system/clearpilot/startup_logo/bg.jpg
if [ "$(md5sum /usr/comma/bg.jpg | awk '{print $1}')" != "$(md5sum /data/openpilot/system/clearpilot/startup_logo/bg.jpg | awk '{print $1}')" ]; then

View File

@@ -0,0 +1,2 @@
# Starts networking. Prompts user to connect to network if networking offline.

View File

@@ -0,0 +1,13 @@
#!/bin/bash
# Start update_subshell.sh
# Terminate openpilot
pkill -f 'manager.py'
/data/openpilot/system/clearpilot/tools/qt_shell \
"bash /data/openpilot/system/clearpilot/update_subshell.sh"\
--title="Updating ClearPilot to new version"
# We shouldn't get here
reboot

View File

@@ -0,0 +1,32 @@
#!/bin/bash
echo Bringing up networking...
bash /data/openpilot/system/clearpilot/tools/start_networking.sh
echo Done.
echo
echo Backing up current release...
cd /data
sudo rm -rf openpilot_failsafe
sudo chmod -R 777 openpilot
cp -r openpilot openpilot_failsafe
cd /data/openpilot
echo Done.
bash update.sh
echo
if bash update.sh ; then
echo "Update succeeded, rebooting..."
reboot
sleep 30;
else
echo "Update failed, reverting to last version..."
cd /data
rm -rf openpilot
mv openpilot_failsafe openpilot
/data/openpilot/system/clearpilot/tools/prompt "Updating ClearPilot failed. The previous version has been restored." "Restart"
echo "Update succeeded, rebooting..."
reboot
sleep 30;
fi

View File

@@ -1,23 +1,20 @@
#!/bin/bash
set -e
sudo chmod -R 777 /data/openpilot
# Set branch to your target branch
branch="clearpilot"
# Fetch the latest changes from the remote repository for the target branch
git fetch origin "$branch"
# Check if the local branch is behind the remote branch
LOCAL=$(git rev-parse "@{0}")
REMOTE=$(git rev-parse "origin/$branch")
if [ "$LOCAL" != "$REMOTE" ]; then
echo "Local branch is behind; updating."
# Checkout the target branch forcefully, ignoring submodules as in the Python example
git checkout --force --no-recurse-submodules -B "$branch" "origin/$branch"
# Reset the local changes hard, clean the directory including untracked files and directories,
# and ensure submodules are in sync, updated, and also reset hard
git reset --hard
git clean -xdff
git submodule sync
@@ -26,7 +23,6 @@ if [ "$LOCAL" != "$REMOTE" ]; then
echo "Repository and submodules have been updated and cleaned."
# Run git cleanup in the repository directory
git gc
git lfs prune
@@ -34,3 +30,5 @@ if [ "$LOCAL" != "$REMOTE" ]; then
else
echo "Already at the latest version; no update needed."
fi
exit 0