From 87a368fe55efdd2cba599e07f29786a3ad745310 Mon Sep 17 00:00:00 2001 From: danix Date: Thu, 13 Apr 2023 16:16:45 +0200 Subject: [PATCH] git hidden directory is now backed up and restored properly --- SOURCE/CORE/core-backup.sh | 11 +++++++++-- SOURCE/head.sh | 3 +++ notes.sh | 14 ++++++++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/SOURCE/CORE/core-backup.sh b/SOURCE/CORE/core-backup.sh index 58a1279..25f67c9 100644 --- a/SOURCE/CORE/core-backup.sh +++ b/SOURCE/CORE/core-backup.sh @@ -26,9 +26,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 @@ -71,6 +71,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" diff --git a/SOURCE/head.sh b/SOURCE/head.sh index 9617ad3..d609726 100644 --- a/SOURCE/head.sh +++ b/SOURCE/head.sh @@ -138,6 +138,9 @@ jq executable: ${JQ} "version": "${VERSION}", "dbversion": "${DBVERSION}" }, + "git": { + "lastpull": "" + }, "notes": [] } __EOL__ 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" -- 2.20.1