From 00882c92a69b405752b08d00a815cab39a63fd05 Mon Sep 17 00:00:00 2001 From: Thomas Koehler Date: Thu, 10 Nov 2011 17:19:28 +0100 Subject: [PATCH] If given a third time, -F will pass the next argument as additional arguments to fsck. --- grml-crypt | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/grml-crypt b/grml-crypt index 7722474..3e740f1 100755 --- a/grml-crypt +++ b/grml-crypt @@ -36,6 +36,7 @@ ACTION_="" DM_PREFIX_="grml-crypt_" FORCE_='false' FSCK_='false' +FSCK_EXTRA_OPTS_="" ENTROPY_SOURCE_='/dev/urandom' OPTIMIZED_MODE_SET_='false' OPTIMIZING_LEVEL_=0 @@ -67,7 +68,10 @@ OPTIONS: -o optimised initialisation mode (should be as secure as the default but faster) -y verifies the passphrase by asking for it twice -f force file overwriting in format mode and/or disable confirmation dialog - -F only for action start: run fsck before mounting the filesystem. Use fsck's -f option if given twice. + -F only for action start: run fsck before mounting the filesystem. + Use fsck's -f option if given twice. + Read next argument as a list of options to pass to fsck if given three times: + 'grml-crypt -FFF "-y -T" start /dev/ice' will run fsck with options -y and -T. -m additional arguments to mount -v verbose (show what is going on, v++) -h this help text @@ -194,7 +198,7 @@ function actionStart if [[ "$FSCK_" == "true" ]] ; then execute "fsck -C $DM_PATH_" || die "fsck failed on $DM_PATH_" elif [[ "$FSCK_" == "trueforce" ]] ; then - execute "fsck -f -C $DM_PATH_" || die "fsck failed on $DM_PATH_" + execute "fsck -f $FSCK_EXTRA_OPTS_ -C $DM_PATH_" || die "fsck failed on $DM_PATH_" fi margs_="" $READONLY_SET_ && margs_='-r' @@ -389,7 +393,12 @@ while getopts "s:t:rzoyfFm:hvS:C:I:A:" opt; do F) if [[ "$FSCK_" == "true" ]] ; then FSCK_='trueforce' else - FSCK_='true' + if [[ "$FSCK_" == "trueforce" ]] ; then + FSCK_EXTRA_OPTS_="$2" + shift + else + FSCK_='true' + fi fi ;; m) ADDITIONAL_MOUNT_ARGS_="$OPTARG" ;; -- 1.7.2.3