[Grml-devel] New patch (grml-crypt)

Thomas Köhler jean-luc at picard.franken.de
Thu Jan 13 13:35:35 CET 2011


Hello all,
Unfortunately, when inserting a USB disk with an encrypted
partition, no mountpoint for that partition is being created.
So in order to run grml-crypt's start action, you either need to
create a new mountpoint manually, or you need to use something
like /mnt/test. But that doesn't scale if you want to use several
encrypted partitions at the same time...
Attached patch allows "grml-crypt start" to be used with only the
device as further command line argument, so the mountpoint can be
ommitted. In that case, the mountpoint is /mnt/$DM_NAME_ (usually
something like /mnt/grml-crypt_sda1). That mountpoint is being
created first, then used for mounting.

Bye,
Thomas

-- 
 Thomas Köhler       Email:       jean-luc at picard.franken.de
     <><             WWW:              http://gott-gehabt.de
                     IRC:                           tkoehler
                     PGP public key available from Homepage!
-------------- next part --------------
From bc3a3b852c2e7dddb0ffe3a6f9650f95b1a15593 Mon Sep 17 00:00:00 2001
From: Thomas Koehler <jean-luc at picard.franken.de>
Date: Thu, 13 Jan 2011 13:12:39 +0100
Subject: [PATCH] when no mountpoint is given for action start, use a default one
 Unfortunately, when you plug in a USB disk with an encrypted
 partition, no mount point for that partition is being created.
 This patch uses a default mountpoint if none is given to action
 "start" so that manual intervention (run mkdir first) is minimized.

---
 grml-crypt       |    9 ++++-----
 grml-crypt.8.txt |    4 ++--
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/grml-crypt b/grml-crypt
index b9f0f26..581925a 100755
--- a/grml-crypt
+++ b/grml-crypt
@@ -83,8 +83,8 @@ ACTIONS:
               Format a device or a file (is created with the given size if it
               does not exist) with the given filesystem and mount it, if a
               mountpoint was given.
-   start  <device/file> <mountpoint>
-              Mount the device/file in the mountpoint.
+   start  <device/file> [mountpoint]
+              Mount the device/file in the mountpoint or to a default mountpoint.
    stop   <mountpoint>
               Umount the given mountpoint (umount, luksClose, losetup -d)
 
@@ -166,10 +166,9 @@ function actionStart
 {
   ret_=0
 
-  # no mountpoint, by-by
   if [[ "$MOUNT_POINT_" == "" ]]; then
-    printUsage
-    die 'no mountpoint given'
+    MOUNT_POINT_="/mnt/$DM_NAME_"
+    mkdir $MOUNT_POINT_
   fi
   if [ ! -d "$MOUNT_POINT_" ]; then
     die "mountpoint $MOUNT_POINT_ does not exist"
diff --git a/grml-crypt.8.txt b/grml-crypt.8.txt
index 1ff290d..43be27d 100644
--- a/grml-crypt.8.txt
+++ b/grml-crypt.8.txt
@@ -32,9 +32,9 @@ ACTIONS
     Commands: [losetup], dd, cryptsetup luksFormat, cryptsetup
     luksOpen, [dd], mkfs, [mount]
 
-*start <device/file> <mountpoint>*::
+*start <device/file> [mountpoint]*::
     Starts an encrypted <device/file> and mounts it to the given
-    mountpoint. Commands: [losetup], cryptsetup luksOpen, mount
+    or a default mountpoint. Commands: [losetup], cryptsetup luksOpen, mount
 
 *stop <mountpoint>*::
     Stops an encrypted filesystem mounted at <mountpoint>. Even the
-- 
1.7.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://ml.grml.org/pipermail/grml-devel/attachments/20110113/6f63c684/attachment.pgp>


More information about the Grml-devel mailing list