From 28badb75b5d6127aba02be96f553b94be760701b Mon Sep 17 00:00:00 2001 From: "Christos.K" Date: Sat, 26 Aug 2017 15:11:10 +0300 Subject: Moved backup sync to cinit_pre-mount.sh --- config.d/controller/modules/functions/ct_prelim.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/config.d/controller/modules/functions/ct_prelim.sh b/config.d/controller/modules/functions/ct_prelim.sh index 16ffbda..4db040b 100755 --- a/config.d/controller/modules/functions/ct_prelim.sh +++ b/config.d/controller/modules/functions/ct_prelim.sh @@ -112,9 +112,12 @@ _mount_target() { unset _fscheck + echo "Attempting to mount $3 at $1" if eval mount -t "$2" -o rw -L "$3" "$1"; then + echo "Mounted successfully" return 0 else + echo "Failed mounting" return 1 fi } @@ -144,7 +147,7 @@ _mount_pseudos() { } _sync_backupfs() { - if rsync -aAXrhq --exclude={"/proc","/dev","/sys"} "/mnt/rfs/" "/mnt/bfs/"; then + if rsync -aAXrhqc --exclude={"/proc","/dev","/sys"} "/mnt/rfs/" "/mnt/bfs/" --delete; then mkdir -p "/mnt/bfs/proc" mkdir -p "/mnt/bfs/sys" mkdir -p "/mnt/bfs/dev" @@ -206,16 +209,21 @@ _check_rbfs() { unset _rfs_check unset _bfs_check - # SYNC SYSFS TO BACKUPFS - if [[ "${_ctflag_setup}" == 2 ]]; then - _sync_backupfs - fi - _unmount "/mnt/rfs" _unmount "/mnt/bfs" _unmount "/mnt/workdir" } +_sync_targets() { + _mount_target "/mnt/rfs" "${SYSFS}" "SYSFS" + _mount_target "/mnt/bfs" "${BACKUPFS}" "BACKUPFS" + + _sync_backupfs + + _unmount "/mnt/rfs" + _unmount "/mnt/bfs" +} + _unset_ct() { unset _ctflag_switch unset _ctflag_net -- cgit v1.2.3-65-gdbad