From: Petr Tesarik Date: Thu, 14 Nov 2019 18:06:08 +0000 (+0100) Subject: 95ssh-client: improve nsswitch.conf parser X-Git-Tag: 050~80 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7d47d1c423cabfd125a2bf15c5d72732a6334024;p=thirdparty%2Fdracut.git 95ssh-client: improve nsswitch.conf parser The actual syntax of nsswitch.conf is slightly different from the current regular expression: - A comment can appear anywhere, not just at the beginning of a line. - Action items take the general form [STATUS=ACTION] or [!STATUS=ACTION] (with some optional whitespace). - A service name cannot include a colon. This is a nitpick, because there should never be more than a single colon per line. Signed-off-by: Petr Tesarik --- diff --git a/modules.d/95ssh-client/module-setup.sh b/modules.d/95ssh-client/module-setup.sh index c6d26d9db..ffdc8a93d 100755 --- a/modules.d/95ssh-client/module-setup.sh +++ b/modules.d/95ssh-client/module-setup.sh @@ -68,7 +68,9 @@ install() { inst_multiple ssh scp inst_sshenv - _nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' $dracutsysrootdir/etc/nsswitch.conf \ + _nsslibs=$( + sed -e 's/#.*//; s/^[^:]*://; s/\[[^]]*\]//' \ + $dracutsysrootdir/etc/nsswitch.conf \ | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|') _nsslibs=${_nsslibs#|} _nsslibs=${_nsslibs%|}