aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2010-01-09 01:28:25 -0500
committerDave Reisner <d@falconindy.com>2010-01-09 01:28:25 -0500
commit97af6e6002d928eaf869a1cb41d0fd75bc45ca09 (patch)
tree095e4764e789150f5c6c99389d84035b130af279
parentfd822d545c149553fb1f560720bae1fb44098250 (diff)
downloadsquashfu-97af6e6002d928eaf869a1cb41d0fd75bc45ca09.tar.gz
Split off directory structure creation to its own function
-rwxr-xr-xsquashfu13
1 files 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