diff --git a/debian/changelog b/debian/changelog index 84f4548..dcc4566 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ -sapphrc (1.0) UNRELEASED; urgency=medium +sapphrc (1.0) unstable; urgency=medium * Initial release. + * -- Penelope Gwen Fri, 08 Mar 2024 11:49:45 -0700 diff --git a/debian/install b/debian/install index 653948f..41aa780 100644 --- a/debian/install +++ b/debian/install @@ -1,4 +1,3 @@ -etc/bash_completion.d/spm etc/bash_completion.d/ lib/sapphrc/* lib/sapphrc/ usr/bin/* usr/bin/ usr/share/doc/sapphrc/* usr/share/doc/sapphrc/ diff --git a/usr/bin/.sapphrc_restore.swp b/usr/bin/.sapphrc_restore.swp deleted file mode 100644 index 9caec2f..0000000 Binary files a/usr/bin/.sapphrc_restore.swp and /dev/null differ diff --git a/usr/bin/sapphrc_push b/usr/bin/sapphrc_push new file mode 100644 index 0000000..397a247 --- /dev/null +++ b/usr/bin/sapphrc_push @@ -0,0 +1,7 @@ +#!/bin/bash + +cd "$HOME/.config/sapphrc/backups" +git add .; +git add -u; +git commit -m "New backup `date +'%Y-%m-%d %H:%M:%S'`"; +git push origin main diff --git a/usr/bin/sapphrc_restore b/usr/bin/sapphrc_restore index 3d8800e..ec6fdd1 100755 --- a/usr/bin/sapphrc_restore +++ b/usr/bin/sapphrc_restore @@ -1,5 +1,8 @@ #!/bin/bash +cd "$HOME/.config/sapphrc/backups" +git pull --no-edit + sapphrc_config="$HOME/.config/sapphrc" cat "${sapphrc_config}/active_profiles" | while read profile_name diff --git a/usr/bin/sapphrc_updown b/usr/bin/sapphrc_updown old mode 100644 new mode 100755 index 300f5c0..fb2b687 --- a/usr/bin/sapphrc_updown +++ b/usr/bin/sapphrc_updown @@ -1,4 +1,20 @@ #!/bin/bash -sapphrc_restore +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