wip
This commit is contained in:
@@ -2,61 +2,6 @@
|
|||||||
|
|
||||||
cd /data/openpilot
|
cd /data/openpilot
|
||||||
|
|
||||||
# Initialize a counter for the timeout
|
|
||||||
# timeout=5
|
|
||||||
|
|
||||||
# ssh-import-key-gh hansonxyz
|
|
||||||
|
|
||||||
# this code doesnt work
|
|
||||||
# # Loop until we have a network connection or the timeout expires
|
|
||||||
# while ! ping -c 1 google.com &> /dev/null; do
|
|
||||||
# echo "Waiting for internet connection..."
|
|
||||||
# sleep 1
|
|
||||||
# timeout=$((timeout - 1))
|
|
||||||
# if [ "$timeout" -le 0 ]; then
|
|
||||||
# echo "Timeout reached. Proceeding without network operations."
|
|
||||||
# break
|
|
||||||
# fi
|
|
||||||
# done
|
|
||||||
# if [ "$timeout" -gt 0 ]; then
|
|
||||||
echo "Internet connection established, proceeding with update."
|
|
||||||
|
|
||||||
# Set branch to your target branch
|
|
||||||
branch="oscarpilot"
|
|
||||||
|
|
||||||
# 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}")
|
|
||||||
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
|
|
||||||
git submodule update --init --recursive
|
|
||||||
git submodule foreach --recursive git reset --hard
|
|
||||||
|
|
||||||
echo "Repository and submodules have been updated and cleaned."
|
|
||||||
|
|
||||||
# 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
|
sudo bash /data/openpilot/shell/start_service.sh
|
||||||
|
|
||||||
# Blank the UI (assuming framebuffer device is /dev/fb0)
|
# Blank the UI (assuming framebuffer device is /dev/fb0)
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ if [ "$(md5sum /usr/comma/bg.jpg | awk '{print $1}')" != "$(md5sum /data/openpil
|
|||||||
# Check if the file contains the line before which we want to insert our line.
|
# Check if the file contains the line before which we want to insert our line.
|
||||||
if grep -qF -- "$INSERT_BEFORE" "$FILE_PATH"; then
|
if grep -qF -- "$INSERT_BEFORE" "$FILE_PATH"; then
|
||||||
# Use awk to insert the line before the specified pattern.
|
# Use awk to insert the line before the specified pattern.
|
||||||
cp /usr/comma/comma.sh /tmp/comma.sh
|
sudo cp /usr/comma/comma.sh /tmp/comma.sh
|
||||||
awk -v insert_line="$SEARCH_STRING" -v before_line="$INSERT_BEFORE" \
|
sudo awk -v insert_line="$SEARCH_STRING" -v before_line="$INSERT_BEFORE" \
|
||||||
'BEGIN{found=0}
|
'BEGIN{found=0}
|
||||||
$0 ~ before_line && found == 0 {print insert_line; found=1}
|
$0 ~ before_line && found == 0 {print insert_line; found=1}
|
||||||
{print}' "/tmp/comma.sh" > "/tmp/comma.sh.tmp" && sudo mv "/tmp/comma.sh.tmp" "$FILE_PATH"
|
{print}' "/tmp/comma.sh" > "/tmp/comma.sh.tmp" && sudo mv "/tmp/comma.sh.tmp" "$FILE_PATH"
|
||||||
@@ -44,5 +44,6 @@ if [ "$(md5sum /usr/comma/bg.jpg | awk '{print $1}')" != "$(md5sum /data/openpil
|
|||||||
echo Applied custom logo for comma boot sequence
|
echo Applied custom logo for comma boot sequence
|
||||||
sudo sync
|
sudo sync
|
||||||
sleep 2
|
sleep 2
|
||||||
sudo reboot
|
sudo mount -o remount,ro /
|
||||||
|
sudo sync
|
||||||
fi
|
fi
|
||||||
|
|||||||
38
update_and_launch_openpilot.sh
Normal file
38
update_and_launch_openpilot.sh
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
cd /data/openpilot
|
||||||
|
echo "Internet connection established, proceeding with update."
|
||||||
|
|
||||||
|
# Set branch to your target branch
|
||||||
|
branch="oscarpilot"
|
||||||
|
|
||||||
|
# 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}")
|
||||||
|
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
|
||||||
|
git submodule update --init --recursive
|
||||||
|
git submodule foreach --recursive git reset --hard
|
||||||
|
|
||||||
|
echo "Repository and submodules have been updated and cleaned."
|
||||||
|
|
||||||
|
# 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
|
||||||
|
bash launch_openpilot.sh
|
||||||
Reference in New Issue
Block a user