From 87a368fe55efdd2cba599e07f29786a3ad745310 Mon Sep 17 00:00:00 2001 From: danix Date: Thu, 13 Apr 2023 16:16:45 +0200 Subject: git hidden directory is now backed up and restored properly --- notes.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'notes.sh') diff --git a/notes.sh b/notes.sh index cbb34eb..0e56189 100755 --- a/notes.sh +++ b/notes.sh @@ -138,6 +138,9 @@ jq executable: ${JQ} "version": "${VERSION}", "dbversion": "${DBVERSION}" }, + "git": { + "lastpull": "" + }, "notes": [] } __EOL__ @@ -320,9 +323,9 @@ function backup_data() { fi # ok, we have a backup directory if [ -r $RCFILE ]; then - BCKUP_COMM=$(rsync -avz --progress ${RCFILE}* ${BASEDIR}/* ${BACKUPDIR}) + BCKUP_COMM=$(rsync -avz --progress ${RCFILE}* ${BASEDIR}/ ${BACKUPDIR}) else - BCKUP_COMM=$(rsync -avz --progress ${BASEDIR}/* ${BACKUPDIR}) + BCKUP_COMM=$(rsync -avz --progress ${BASEDIR}/ ${BACKUPDIR}) fi # run the command if [ "$BCKUP_COMM" ]; then @@ -365,6 +368,13 @@ function backup_restore() { fi cp --verbose ${BACKUPDIR}/${BACKUPDB} $DB fi + # restoring git repo subdirectory + if [ -d $BACKUPDIR/.git ]; then + if [ /bin/ls -A ${BASEDIR}/.git ]; then + rm -rf ${BASEDIR}/.git + fi + cp -r --verbose ${BACKUPDIR}/.git ${BASEDIR}/ + fi ;; * ) echo "No changes made. Exiting" -- cgit v1.2.3