Files
clearpilot/update.sh
Comma Device 1ff14d346f wip
2024-05-14 08:21:27 +00:00

35 lines
726 B
Bash
Executable File

#!/bin/bash
set -e
sudo chmod -R 777 /data/openpilot
branch="clearpilot"
git fetch origin "$branch"
LOCAL=$(git rev-parse "@{0}")
REMOTE=$(git rev-parse "origin/$branch")
if [ "$LOCAL" != "$REMOTE" ]; then
echo "Local branch is behind; updating."
git checkout --force --no-recurse-submodules -B "$branch" "origin/$branch"
git reset --hard
git clean -xdff
git submodule sync
git submodule update --init --recursive
git submodule foreach --recursive git reset --hard
echo "Repository and submodules have been updated and cleaned."
git gc
git lfs prune
echo "Repository cleanup has been completed."
else
echo "Already at the latest version; no update needed."
fi
exit 0