crypt/crypt-run-generator.sh: check if crypttab exists
authorHarald Hoyer <harald@redhat.com>
Mon, 30 Jul 2012 20:27:53 +0000 (22:27 +0200)
committerHarald Hoyer <harald@redhat.com>
Mon, 30 Jul 2012 20:29:47 +0000 (22:29 +0200)
modules.d/90crypt/crypt-run-generator.sh

index cb3aedc..f2f2da1 100755 (executable)
@@ -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