wip
This commit is contained in:
@@ -44,6 +44,7 @@ function launch {
|
|||||||
# 2. The FINALIZED consistent file has to exist, indicating there's an update
|
# 2. The FINALIZED consistent file has to exist, indicating there's an update
|
||||||
# that completed successfully and synced to disk.
|
# that completed successfully and synced to disk.
|
||||||
|
|
||||||
|
# CLEARPILOT
|
||||||
# if [ -f "${BASEDIR}/.overlay_init" ]; then
|
# if [ -f "${BASEDIR}/.overlay_init" ]; then
|
||||||
# find ${BASEDIR}/.git -newer ${BASEDIR}/.overlay_init | grep -q '.' 2> /dev/null
|
# find ${BASEDIR}/.git -newer ${BASEDIR}/.overlay_init | grep -q '.' 2> /dev/null
|
||||||
# if [ $? -eq 0 ]; then
|
# if [ $? -eq 0 ]; then
|
||||||
|
|||||||
@@ -13,12 +13,18 @@
|
|||||||
# sudo apt-get install -y nodejs
|
# sudo apt-get install -y nodejs
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
apt-get update
|
# Todo: update the crash screen to have an option to restore previous version if one exists. (/data/openpilot_failsafe)
|
||||||
apt-get install -y nodejs npm python3-pyqt5 pywayland python3-pyqt5.qtwebengine imagemagick
|
# If no previous version, present an option to check out updated release.
|
||||||
pip3 install termqt
|
|
||||||
|
|
||||||
|
# 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
|
cd /data/openpilot/third_party/libyuv
|
||||||
bash build.sh
|
bash build.sh
|
||||||
cd libyuv && make && make install
|
cd libyuv && make && make install
|
||||||
|
|
||||||
pip install PyQt5-sip
|
# pip install PyQt5-sip
|
||||||
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
set -x
|
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
|
# 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
|
if [ "$(md5sum /usr/comma/bg.jpg | awk '{print $1}')" != "$(md5sum /data/openpilot/system/clearpilot/startup_logo/bg.jpg | awk '{print $1}')" ]; then
|
||||||
|
|||||||
2
system/clearpilot/tools/start_networking.sh
Normal file
2
system/clearpilot/tools/start_networking.sh
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
# Starts networking. Prompts user to connect to network if networking offline.
|
||||||
13
system/clearpilot/update.sh
Normal file
13
system/clearpilot/update.sh
Normal 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
|
||||||
32
system/clearpilot/update_subshell.sh
Normal file
32
system/clearpilot/update_subshell.sh
Normal 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
|
||||||
14
update.sh
14
update.sh
@@ -1,23 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
sudo chmod -R 777 /data/openpilot
|
sudo chmod -R 777 /data/openpilot
|
||||||
|
|
||||||
# Set branch to your target branch
|
|
||||||
branch="clearpilot"
|
branch="clearpilot"
|
||||||
|
|
||||||
# Fetch the latest changes from the remote repository for the target branch
|
|
||||||
git fetch origin "$branch"
|
git fetch origin "$branch"
|
||||||
|
|
||||||
# Check if the local branch is behind the remote branch
|
|
||||||
LOCAL=$(git rev-parse "@{0}")
|
LOCAL=$(git rev-parse "@{0}")
|
||||||
REMOTE=$(git rev-parse "origin/$branch")
|
REMOTE=$(git rev-parse "origin/$branch")
|
||||||
|
|
||||||
if [ "$LOCAL" != "$REMOTE" ]; then
|
if [ "$LOCAL" != "$REMOTE" ]; then
|
||||||
echo "Local branch is behind; updating."
|
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"
|
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 reset --hard
|
||||||
git clean -xdff
|
git clean -xdff
|
||||||
git submodule sync
|
git submodule sync
|
||||||
@@ -26,7 +23,6 @@ if [ "$LOCAL" != "$REMOTE" ]; then
|
|||||||
|
|
||||||
echo "Repository and submodules have been updated and cleaned."
|
echo "Repository and submodules have been updated and cleaned."
|
||||||
|
|
||||||
# Run git cleanup in the repository directory
|
|
||||||
git gc
|
git gc
|
||||||
git lfs prune
|
git lfs prune
|
||||||
|
|
||||||
@@ -34,3 +30,5 @@ if [ "$LOCAL" != "$REMOTE" ]; then
|
|||||||
else
|
else
|
||||||
echo "Already at the latest version; no update needed."
|
echo "Already at the latest version; no update needed."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user