]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
chore(base): do not output root entry while installing base
authorLaszlo Gombos <laszlo.gombos@gmail.com>
Sun, 28 Aug 2022 13:35:36 +0000 (13:35 +0000)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Thu, 29 Sep 2022 05:14:52 +0000 (05:14 +0000)
Silence the printing out root entry of passwd file
while including base module.

dracut: *** Including module: base ***
root:x:0:0:root:/root:/bin/bash
dracut: *** Including module: fs-lib ***

modules.d/99base/module-setup.sh

index 10a44d91ee5f5a597c31d36d2005418d697b07cc..427cccb5a8d4e8c40771ad0c6fc0ed73c47cb601 100755 (executable)
@@ -32,7 +32,7 @@ install() {
     # add common users in /etc/passwd, it will be used by nfs/ssh currently
     # use password for hostonly images to facilitate secure sulogin in emergency console
     [[ $hostonly ]] && pwshadow='x'
-    grep '^root:' "$initdir/etc/passwd" 2> /dev/null || echo "root:$pwshadow:0:0::/root:/bin/sh" >> "$initdir/etc/passwd"
+    grep '^root:' "$initdir/etc/passwd" > /dev/null 2>&1 || echo "root:$pwshadow:0:0::/root:/bin/sh" >> "$initdir/etc/passwd"
     grep '^nobody:' "$dracutsysrootdir"/etc/passwd >> "$initdir/etc/passwd"
 
     [[ $hostonly ]] && grep '^root:' "$dracutsysrootdir"/etc/shadow >> "$initdir/etc/shadow"