diff options
author | Dave Reisner <d@falconindy.com> | 2010-01-08 01:57:16 -0500 |
---|---|---|
committer | Dave Reisner <d@falconindy.com> | 2010-01-08 01:57:16 -0500 |
commit | 553bfcb1b01e36f612e81e62fde23c48f01654ed (patch) | |
tree | f0f3162b6845c3550e0549fafb6254fba5a0de97 | |
parent | 903241c2bf5365327abed950bcf5f774b4795f00 (diff) | |
download | squashfu-553bfcb1b01e36f612e81e62fde23c48f01654ed.tar.gz |
Clean up workflow
-rwxr-xr-x | squashfu | 36 |
1 files changed, 24 insertions, 12 deletions
@@ -108,38 +108,47 @@ usage () { exit } +################################ # Sanity checks +################################ # - Are we root? -[[ $UID -eq 0 ]] || die Must be root! - # - is our BKUP_ROOT valid? (FAIL) +# - Check for pre-existing mounts just in case (and unmount them) +# - do we have a proper (expected) directory structure in place? +# (Use cd to BKUP_ROOT to avoid issues with brace expansion in a quoted path) +[[ $UID -eq 0 ]] || die Must be root! [[ -w "${BKUP_ROOT}" ]] || die "Backup root is not accessible. Please check your setting in /etc/squashfu" - -# Check for pre-existing mounts just in case (and unmount them) unmount_all - -# - do we have a proper (expected) directory structure in place? -# Use cd to BKUP_ROOT to avoid issues with brace expansion in a quoted path cd "$BKUP_ROOT" && mkdir -p {rw,ro,bins/{1,2,3,4,5,6,7}} +################################ + +################################ # Prep work +################################ # - does seed exist? (if not, our backup is creating the seed) +# - Prepare union mount with proper bins [[ -f "$SEED" ]] || { debug "No seed found -- creating a new one..."; create_new_seed; } - -# Prepare union mount with proper bins mount_union_ro $(( $(date +%u) + $MODIFIER )) mount_union_branch_rw $(( $(date +%u) + $MODIFIER )) +################################ + +################################ # Ready for backup! +################################ run_rsync -# 5) Cleanup -# - Is this resquash day? If so, we need a new squash -# - If new squash creation fails, we're in trouble. (by default, keep previous week) + +################################ +# Cleanup +################################ +# - Is this resquash day? If so, we need a new squash +# - If new squash creation fails, we're in trouble. (by default, keep previous week) [[ $(date +%u) -eq $RESQUASH_DAY ]] && { create_new_seed # Set aside last week's tree if user opted to, else delete it all @@ -151,3 +160,6 @@ run_rsync fi } +finish_routine +################################ + |