This commit is contained in:
Your Name
2024-02-13 01:21:51 -06:00
parent 3fc6fa0b52
commit 50dd50f0a7
5 changed files with 33 additions and 20 deletions

View File

@@ -17,7 +17,6 @@ while ! ping -c 1 google.com &> /dev/null; do
break
fi
done
if [ "$timeout" -gt 0 ]; then
echo "Internet connection established, proceeding with update."
@@ -27,30 +26,38 @@ if [ "$timeout" -gt 0 ]; then
# Fetch the latest changes from the remote repository for the target branch
git fetch origin "$branch"
# Checkout the target branch forcefully, ignoring submodules as in the Python example
git checkout --force --no-recurse-submodules -B "$branch"
# Check if the local branch is behind the remote branch
LOCAL=$(git rev-parse "@{0}")
REMOTE=$(git rev-parse "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
git submodule update --init --recursive
git submodule foreach --recursive git reset --hard
if [ "$LOCAL" != "$REMOTE" ]; then
echo "Local branch is behind; updating."
echo "Repository and submodules have been updated and cleaned."
# Checkout the target branch forcefully, ignoring submodules as in the Python example
git checkout --force --no-recurse-submodules -B "$branch" "origin/$branch"
# Assuming AGNOS and finalize_update steps are specific and detailed,
# the shell equivalent might require custom scripts or commands.
# For AGNOS update, you'd handle it based on your specific needs.
# 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
git submodule update --init --recursive
git submodule foreach --recursive git reset --hard
# Run git cleanup in the finalized update directory
git gc
git lfs prune
echo "Repository and submodules have been updated and cleaned."
echo "Finalized update directory has been prepared."
# Run git cleanup in the repository directory
git gc
git lfs prune
echo "Repository cleanup has been completed."
else
echo "Already at the latest version; no update needed."
fi
fi
sudo bash /data/openpilot/shell/start_service.sh
# Blank the UI (assuming framebuffer device is /dev/fb0)
# This command clears the framebuffer, effectively blanking the screen