From 1f96ce1e0c64aec0458e1c2e374cd627d7a89931 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Tue, 12 Jan 2010 18:47:46 -0500 Subject: Add usage function and mount checking (and unmounting) in rollback function --- squashfu | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/squashfu b/squashfu index a73e85b..f0ff9f5 100755 --- a/squashfu +++ b/squashfu @@ -230,6 +230,34 @@ create_new_incremental () { return $? } +usage () { + info "SquashFu: a backup solution hewn out of boredom" + cat < [options] + +OPERATIONS + -B + Runs a regular backup, using the config file at /etc/squashfu, unless + otherwise specified with the -c option. + + -Q + Displays the size of the seed, the incrementals, and the actual backup. If + you provide no additional options, a basic report will be given. Specifying + "full" will give more detail about individual bins. + + -R + Rollback specified number of backups and mount union for browsing. The rolled + back data will be mounted at $UNION_MOUNT. + + -U + Unmount squash and union. Although SquashFu will always check and unmount as + necessary before an operation, this is provided as a safeguard. +HELP + exit 0 +} + action_backup () { # Args: options array squashfu was invoked with, shifted 1 # Returns: none @@ -291,6 +319,8 @@ action_rollback () { local num_to_mount=$[ ${#bin_list[@]} - $1 ] + mountpoint "$UNION_MOUNT" || mountpoint "$SQUASH_MOUNT" && unmount_all + mount_squash mount_union_with_bins ${bin_list[@]:(-$num_to_mount)} -- cgit v1.2.3