aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2010-01-08 21:14:46 -0500
committerDave Reisner <d@falconindy.com>2010-01-08 21:14:46 -0500
commitcf5ce398434e19708bfa989eef020e0d69ff490e (patch)
tree78d2cffc695ecda6e4559229b4a828c71495c564
parent29c1bf01c73e9234dc39aa551aac32bf5fa6c1a4 (diff)
downloadsquashfu-cf5ce398434e19708bfa989eef020e0d69ff490e.tar.gz
Add parsing and skeleton for query dispatcher
-rwxr-xr-xsquashfu23
1 files changed, 17 insertions, 6 deletions
diff --git a/squashfu b/squashfu
index 3c14197..b37c341 100755
--- a/squashfu
+++ b/squashfu
@@ -134,6 +134,7 @@ query_usage () {
bin_size=$(du -s ${BKUP_ROOT}/bins 2>/dev/null | awk '{print $1}')
sfs_size=$(stat -c %s $SEED 2>/dev/null)
+ # Basic query
info "Usage report (in mb):\n"
printf "%30s %10.2f\n" "Seed size:" "`echo "scale=2;$sfs_size / 1024 / 1024" | bc`"
printf "%30s %10.2f\n" "Total incremental size:" "`echo "scale=2;$bin_size / 1024 / 1024" | bc`"
@@ -142,7 +143,10 @@ query_usage () {
info "Your incrementals are larger than your seed! You might consider resquashing your backup with $0 --resquash"
fi
- #unmount_all
+ # Full query
+ [[ $1 == "full" ]] && {
+ debug "There should be stuff here about individual bin size";
+ }
}
run_rsync() {
@@ -193,7 +197,9 @@ OPERATIONS
otherwise specified with the -c option.
-Q
- Displays the size of the seed, the incrementals, and the actual backup.
+ 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 <day> [mount]
Rollback to the day described by the following argument. 'day' needs to be
@@ -237,9 +243,14 @@ dispatch_backup () {
}
dispatch_query () {
- # Don't check anything, just run the query.
- # TODO: Add levels of querying
- query_usage
+ # If no arg supplied, no need to parse
+ [[ -z $1 ]] && query_usage
+
+ # Check for valid arg
+ case $1 in
+ "full") query_usage full ;;
+ *) die "Invalid query option"; usage ;;
+ esac
}
dispatch_rollback () {
@@ -273,7 +284,7 @@ dispatch_rollback () {
while [[ $# -gt 0 ]]; do
case $1 in
"-B") shift; dispatch_backup $* ;;
- "-Q") shift; dispatch_query ;;
+ "-Q") shift; dispatch_query $1 ;;
"-R") shift; dispatch_rollback $* ;;
*) usage ;;
esac