Blob Blame History Raw
From b70b81f1c4dc0cc13851feefe870788290cff0a7 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 19 Aug 2015 16:18:23 +0200
Subject: [PATCH] crypt/module-setup.sh: fixed parsing crypttab with no ending
 newline

---
 dracut.sh                         | 2 +-
 modules.d/90crypt/module-setup.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dracut.sh b/dracut.sh
index 90ac1fe9..65824ec7 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1045,7 +1045,7 @@ if [[ $hostonly ]]; then
                 [[ "$_d" -ef "$dev" ]] || continue
 
                 if [[ -f /etc/crypttab ]]; then
-                    while read _mapper _a _p _o; do
+                    while read _mapper _a _p _o || [ -n "$_mapper" ]; do
                         [[ $_mapper = \#* ]] && continue
                         [[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue
                         [[ "$_o" ]] || _o="$_p"
diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh
index bd37d9a5..f8422fa9 100755
--- a/modules.d/90crypt/module-setup.sh
+++ b/modules.d/90crypt/module-setup.sh
@@ -63,7 +63,7 @@ install() {
 
     if [[ $hostonly ]] && [[ -f /etc/crypttab ]]; then
         # filter /etc/crypttab for the devices we need
-        while read _mapper _dev _rest; do
+        while read _mapper _dev _rest || [ -n "$_mapper" ]; do
             [[ $_mapper = \#* ]] && continue
             [[ $_dev ]] || continue