From c307f2fd98a246bb0f8c810d0556b310f2b63f15 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Thu, 14 Jan 2010 22:41:28 -0500 Subject: Make initial squash directly from sources --- squashfu | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/squashfu b/squashfu index 1dcbf41..105d0f3 100755 --- a/squashfu +++ b/squashfu @@ -24,9 +24,10 @@ create_new_squash () { # Args: number of bins to be squashed (as determined by check_for_resquash), -1 on initial creation # Returns: 0 on success, non-zero on failure - # If making first seed, create it empty and return + # If making first seed, create it directly from source if [[ $1 -eq -1 ]]; then - mksquashfs "$UNION_MOUNT" "$SEED" -b 65536 >/dev/null + mksquashfs $(for incl in ${INCLUDES[@]};do echo "$incl";done) "$SEED" -b 65536 \ + -ef $(for excl in ${EXCLUDES[@]};do echo "$excl";done) >/dev/null return $? fi @@ -243,7 +244,7 @@ action_backup () { mkdir -p "${BINS_DIR}" touch "$BINVENTORY" create_new_squash -1 - FIRST_RUN=1 + exit 0 fi info "Backup requested at $(date --rfc-3339=seconds)" @@ -257,8 +258,6 @@ action_backup () { check_for_resquash if [[ val=$? -gt 0 ]]; then create_new_squash $val - elif [[ $FIRST_RUN -eq 1 ]]; then - create_new_squash 1 fi # TODO: Report if requested -- cgit v1.2.3 From 908a308db05b3d10f55a58a0898e26f9fb3a7af0 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 15 Jan 2010 11:03:55 -0500 Subject: Use quoted @ syntax for arrays, don't manually insert quotes --- squashfu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/squashfu b/squashfu index 105d0f3..de50c80 100755 --- a/squashfu +++ b/squashfu @@ -26,8 +26,8 @@ create_new_squash () { # If making first seed, create it directly from source if [[ $1 -eq -1 ]]; then - mksquashfs $(for incl in ${INCLUDES[@]};do echo "$incl";done) "$SEED" -b 65536 \ - -ef $(for excl in ${EXCLUDES[@]};do echo "$excl";done) >/dev/null + info "Creating seed (this may take a while)" + mksquashfs "${INCLUDES[@]}" "$SEED" -b 65536 -e "${EXCLUDES[@]}" >/dev/null return $? fi -- cgit v1.2.3 From faf2c7501bd4052e0781b803e0acc219bac95b6a Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 15 Jan 2010 11:06:44 -0500 Subject: Be a little more verbose about creating initial squash --- squashfu | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/squashfu b/squashfu index de50c80..c959bde 100755 --- a/squashfu +++ b/squashfu @@ -28,7 +28,13 @@ create_new_squash () { if [[ $1 -eq -1 ]]; then info "Creating seed (this may take a while)" mksquashfs "${INCLUDES[@]}" "$SEED" -b 65536 -e "${EXCLUDES[@]}" >/dev/null - return $? + if [[ $? -eq 0 ]]; + mount_squash + info "Seed creation finished. It has been mounted at "$SQUASH_MOUNT" \ + if you would like to make sure the proper files are included" + else + die "There was an error creating the initial squash." + fi fi # Determine oldest $1 bins and mount them with the current squash -- cgit v1.2.3 From 4028b77ac73533bb8d916244d8a7254466e261af Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 15 Jan 2010 11:07:46 -0500 Subject: Fix if/then block in create_new_squash --- squashfu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squashfu b/squashfu index c959bde..ce05ffe 100755 --- a/squashfu +++ b/squashfu @@ -28,7 +28,7 @@ create_new_squash () { if [[ $1 -eq -1 ]]; then info "Creating seed (this may take a while)" mksquashfs "${INCLUDES[@]}" "$SEED" -b 65536 -e "${EXCLUDES[@]}" >/dev/null - if [[ $? -eq 0 ]]; + if [[ $? -eq 0 ]]; then mount_squash info "Seed creation finished. It has been mounted at "$SQUASH_MOUNT" \ if you would like to make sure the proper files are included" -- cgit v1.2.3 From dfc5d5529599deade026c350b5bb3b612e0b7925 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 15 Jan 2010 11:10:39 -0500 Subject: Return after success in initial seed creation --- squashfu | 1 + 1 file changed, 1 insertion(+) diff --git a/squashfu b/squashfu index ce05ffe..195bb39 100755 --- a/squashfu +++ b/squashfu @@ -32,6 +32,7 @@ create_new_squash () { mount_squash info "Seed creation finished. It has been mounted at "$SQUASH_MOUNT" \ if you would like to make sure the proper files are included" + return 0; else die "There was an error creating the initial squash." fi -- cgit v1.2.3 From 16851c48d41fc4931317ad3764116993fc8adda8 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 15 Jan 2010 11:14:59 -0500 Subject: Refine output for initial squash --- squashfu | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/squashfu b/squashfu index 195bb39..f57b520 100755 --- a/squashfu +++ b/squashfu @@ -26,12 +26,11 @@ create_new_squash () { # If making first seed, create it directly from source if [[ $1 -eq -1 ]]; then - info "Creating seed (this may take a while)" + info "Creating seed from sources (this may take a while)" mksquashfs "${INCLUDES[@]}" "$SEED" -b 65536 -e "${EXCLUDES[@]}" >/dev/null if [[ $? -eq 0 ]]; then mount_squash - info "Seed creation finished. It has been mounted at "$SQUASH_MOUNT" \ - if you would like to make sure the proper files are included" + info "Seed creation finished. It has been mounted at "$SQUASH_MOUNT" if you would like to make sure the proper files are included" return 0; else die "There was an error creating the initial squash." -- cgit v1.2.3