sapphrc/usr/bin/sapphrc_updown
Penelope Gwen 79b737fed8 loose ends
2024-03-27 13:01:59 -06:00

20 lines
503 B
Bash
Executable file

#!/bin/bash
cd "$HOME/.config/sapphrc/backups"
sapphrc_backup
gs="$(git status | grep -i 'modified')"
git fetch origin
reslog=$(git log HEAD..origin/main --oneline)
if [[ "${gs}" == *"modified"* && "${reslog}" == "" ]];then
#local AND remote changes exist
echo "local backup reposity conflict with remote - please manually fix this!"
exit 1
elif [[ $gs == *"modified"* ]];then
#local changes exist
sapphrc_backup
elif [[ "${reslog}" == "" ]];then
#remote changes exist
sapphrc_restore
fi
exit