Files
clearpilot/update.sh
Your Name 68c29c6842 wip
2024-04-29 00:23:31 -05:00

35 lines
726 B
Bash

#!/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