[Grml-devel] Patch to grml-crypt
Thomas Köhler
jean-luc at picard.franken.de
Thu Nov 10 17:22:52 CET 2011
Hello all,
grml-crypt allows to run fsck before mounting a filesystem using
the -F option. Given twice, fsck will be forced to run, even if
the filesystem seems to be clean.
Attached patch will add another feature to this if there is a
third -F option: It will get the next commandline option and
passes it to fsck as additional options.
For example
grml-crypt -FFF "-y -T" /dev/ice
will pass "-y -T" to the (forced) fsck.
Kind regards,
Thomas Köhler
--
Thomas Köhler Email: jean-luc at picard.franken.de
<>< WWW: http://gott-gehabt.de
IRC: tkoehler Freenode: thkoehler
PGP public key available from Homepage!
-------------- next part --------------
From 00882c92a69b405752b08d00a815cab39a63fd05 Mon Sep 17 00:00:00 2001
From: Thomas Koehler <jean-luc at picard.franken.de>
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://ml.grml.org/pipermail/grml-devel/attachments/20111110/c837a747/attachment.pgp>
More information about the Grml-devel
mailing list