wip
This commit is contained in:
16
update.sh
16
update.sh
@@ -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}")
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user