fix: klipper update function

This commit is contained in:
th33xitus
2020-08-22 09:10:09 +02:00
parent 7dda59649b
commit cc1c804730

View File

@@ -18,15 +18,17 @@ update_klipper(){
status_msg "Updating $GET_BRANCH" status_msg "Updating $GET_BRANCH"
#fetching origin/master -> error #fetching origin/master -> error
#rewriting origin/master to origin #rewriting origin/master to origin
if [ "$GET_BRANCH" == "origin/master" ]; then if [ "$GET_BRANCH" = "origin/master" ]; then
FETCH_BRANCH="origin" FETCH_BRANCH="origin"
else else
FETCH_BRANCH=$(echo "$GET_BRANCH" | cut -d "/" -f1) FETCH_BRANCH=$(echo "$GET_BRANCH" | cut -d "/" -f1)
fi fi
status_msg "Fetching from $FETCH_BRANCH" status_msg "Fetching from $FETCH_BRANCH"
cd $KLIPPER_DIR
git fetch $FETCH_BRANCH -q && ok_msg "Fetch successfull!" git fetch $FETCH_BRANCH -q && ok_msg "Fetch successfull!"
status_msg "Checking out $GET_BRANCH" status_msg "Checking out $FETCH_BRANCH"
git checkout $GET_BRANCH -q && ok_msg "Checkout successfull!" && echo; ok_msg "Update complete!" echo "git checkout $FETCH_BRANCH"
git checkout $FETCH_BRANCH -q && ok_msg "Checkout successfull!" && echo; ok_msg "Update complete!"
fi fi
start_klipper; echo start_klipper; echo
} }