From 79b737fed8437d7ac6632dcebde2eaadf22aeb45 Mon Sep 17 00:00:00 2001 From: Penelope Gwen Date: Wed, 27 Mar 2024 13:01:59 -0600 Subject: [PATCH] loose ends --- debian/changelog | 3 ++- debian/install | 1 - usr/bin/.sapphrc_restore.swp | Bin 1024 -> 0 bytes usr/bin/sapphrc_push | 7 +++++++ usr/bin/sapphrc_restore | 3 +++ usr/bin/sapphrc_updown | 18 +++++++++++++++++- 6 files changed, 29 insertions(+), 3 deletions(-) delete mode 100644 usr/bin/.sapphrc_restore.swp create mode 100644 usr/bin/sapphrc_push mode change 100644 => 100755 usr/bin/sapphrc_updown 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 9caec2f689baf0d40caf818482e2784af92d3536..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1024 zcmYc?$V<%2S1{KzVn6}L(M${l`RTd&xw(}n5?DAeb-IZK1v#m@iAKi8=2(<56a(cm pijwt9i;MJ=GV}DI{P?2O;*$KLRBT#C#YRJ5Gz6#@0-@+e0RT2`8pZ$s 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