From 6730280c5b71c73ed419d68f3a19820cb4b1bf05 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 7 Apr 2011 14:59:08 +0200 Subject: [PATCH] crypt/parse-crypt.sh: fixed rule creation "\n" was missing create rules file on tmp file and rename it later --- modules.d/90crypt/parse-crypt.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/modules.d/90crypt/parse-crypt.sh b/modules.d/90crypt/parse-crypt.sh index a63b62d2..1ff7cacf 100755 --- a/modules.d/90crypt/parse-crypt.sh +++ b/modules.d/90crypt/parse-crypt.sh @@ -8,7 +8,7 @@ else { echo 'SUBSYSTEM!="block", GOTO="luks_end"' echo 'ACTION!="add|change", GOTO="luks_end"' - } > /etc/udev/rules.d/70-luks.rules + } > /etc/udev/rules.d/70-luks.rules.new LUKS=$(getargs rd.luks.uuid rd_LUKS_UUID) @@ -21,7 +21,7 @@ else printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue) printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask) printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID}"\n' - } >> /etc/udev/rules.d/70-luks.rules + } >> /etc/udev/rules.d/70-luks.rules.new printf -- '[ -e /dev/disk/by-uuid/*%s* ]\n' $luksid \ >> $hookdir/initqueue/finished/90-crypt.sh @@ -31,12 +31,13 @@ else } >> $hookdir/emergency/90-crypt.sh done else - printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s' \ - '--unique --onetime --name cryptroot-ask-%k' \ - '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"' \ - $(command -v initqueue) $(command -v cryptroot-ask) \ - >> /etc/udev/rules.d/70-luks.rules + { + printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue) + printf -- '--unique --onetime --name cryptroot-ask-%%k ' + printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' $(command -v cryptroot-ask) + } >> /etc/udev/rules.d/70-luks.rules.new fi - echo 'LABEL="luks_end"' >> /etc/udev/rules.d/70-luks.rules + echo 'LABEL="luks_end"' >> /etc/udev/rules.d/70-luks.rules.new + mv /etc/udev/rules.d/70-luks.rules.new /etc/udev/rules.d/70-luks.rules fi