From 3d3c192621861bb82966369d74300c504f6d786f Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 30 Jul 2012 22:27:53 +0200
Subject: [PATCH] crypt/crypt-run-generator.sh: check if crypttab exists
---
modules.d/90crypt/crypt-run-generator.sh | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/modules.d/90crypt/crypt-run-generator.sh b/modules.d/90crypt/crypt-run-generator.sh
index cb3aedc..f2f2da1 100755
--- a/modules.d/90crypt/crypt-run-generator.sh
+++ b/modules.d/90crypt/crypt-run-generator.sh
@@ -5,10 +5,11 @@
dev=$1
luks=$2
-while read l rest; do
- strstr "${l##luks-}" "${luks##luks-}" && exit 0
-done < /etc/crypttab
-
+if [ -f /etc/crypttab ]; then
+ while read l rest; do
+ strstr "${l##luks-}" "${luks##luks-}" && exit 0
+ done < /etc/crypttab
+fi
echo "$luks $dev" >> /etc/crypttab
/lib/systemd/system-generators/systemd-cryptsetup-generator