From 97af6e6002d928eaf869a1cb41d0fd75bc45ca09 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 9 Jan 2010 01:28:25 -0500 Subject: Split off directory structure creation to its own function --- squashfu | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/squashfu b/squashfu index acb7e74..0b81238 100755 --- a/squashfu +++ b/squashfu @@ -19,6 +19,11 @@ CONFIG=/etc/squashfu.conf source $CONFIG [[ $? -gt 0 ]] && die "Syntax error in config file." +create_directory_structure () { + cd "${BKUP_ROOT}" + mkdir -p {ro,rw,bins/{1..7}} +} + create_new_seed () { # Create a new squashfs based on the contents of the union # It's okay if we make an empty squash, we'll tell the user @@ -48,7 +53,7 @@ do_backup () { unmount_all - cd "$BKUP_ROOT" && mkdir -p {rw,ro,bins/{1,2,3,4,5,6,7}} + create_directory_structure ################################ @@ -84,14 +89,14 @@ do_backup () { [[ $KEEP_LAST_WEEK ]] && { save_old_tree; } || { - rm $SEED; + rm "$SEED"; + rm -r "${BKUP_ROOT}/bins" } mv "$SEED.replace" "$SEED" + create_directory_structure } - cd "$BKUP_ROOT" && mkdir -p {rw,ro,bins/{1,2,3,4,5,6,7}} - unmount_all [[ $REPORT ]] && query_usage full -- cgit v1.2.3