From: danix Date: Thu, 13 Apr 2023 14:16:45 +0000 (+0200) Subject: git hidden directory is now backed up and restored properly X-Git-Tag: v0.4~7 X-Git-Url: https://git.danix.xyz/?a=commitdiff_plain;h=87a368fe55efdd2cba599e07f29786a3ad745310;p=bash-notes.git git hidden directory is now backed up and restored properly --- 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"