Skip to contentSkip to conversation

deal common part of etc passwd in 99base

PATCH In review Dave Young 2 participants 5 messages Dec 23, 2011 – Dec 26, 2011 2 messages not in the archive

lore
Share & tools
lore

Dave Young

author
#0 lore raw

PATCH 1/4 deal common part of etc passwd in 99base

ssh module will need root user in /etc/passwd, so add root and nobody to /etc/passwd in 99base instead of nfs module

---
 modules.d/95nfs/module-setup.sh  |    2 --
 modules.d/99base/module-setup.sh |    4 ++++
 2 files changed, 4 insertions(+), 2 deletions(-)
modules.d/95nfs/module-setup.sh +0 -2
index bb3b793..674a438 100755
@@ -65,8 +65,6 @@ install() {
 
     # Rather than copy the passwd file in, just set a user for rpcbind
     # We'll save the state and restart the daemon from the root anyway
-    egrep '^root:' "$initdir/etc/passwd" 2>/dev/null || echo  'root:x:0:0::/:/bin/sh' >> "$initdir/etc/passwd"
-    egrep '^nobody:' /etc/passwd >> "$initdir/etc/passwd"
     egrep '^nfsnobody:' /etc/passwd >> "$initdir/etc/passwd"
     egrep '^rpc:' /etc/passwd >> "$initdir/etc/passwd"
     egrep '^rpcuser:' /etc/passwd >> "$initdir/etc/passwd"
modules.d/99base/module-setup.sh +4 -0
index 5297a9d..f6c1209 100755
@@ -20,6 +20,10 @@ install() {
         dracut_install bash
         (ln -s bash "${initdir}/bin/sh" || :)
     fi
+
+    #add common users in /etc/passwd, it will be used by nfs/ssh currently
+    egrep '^root:' "$initdir/etc/passwd" 2>/dev/null || echo  'root:x:0:0::/:/bin/sh' >> "$initdir/etc/passwd"
+    egrep '^nobody:' /etc/passwd >> "$initdir/etc/passwd"
     # install our scripts and hooks
     inst "$moddir/init" "/init"
     inst "$moddir/initqueue" "/sbin/initqueue"
Signature · 1 line
1.7.1
#1 lore raw
Quoted 2 lines · Dave Young

ssh module will need root user in /etc/passwd, so add root and nobody to /etc/passwd in 99base instead of nfs module

Huh? Even for who don't use either ssh module or nfs module??

I think you just need to copy these two lines into your ssh module...

author
#2 lore raw
Quoted 7 lines · Cong Wang
Quoted 2 lines · Dave Young

ssh module will need root user in /etc/passwd, so add root and nobody to /etc/passwd in 99base instead of nfs module

Huh? Even for who don't use either ssh module or nfs module??

I think you just need to copy these two lines into your ssh module...

Thanks for your review.

in 90mdraid module there's words in its comments about passwd, so there might be more modules need passwd.

Dealing with same thing in multi module is not good, not only duplicate code, but also they could cause conflict. Ie. nfs set root home dir to / but we need /root, if nfs module added after ssh-client the home dir of root will be /.

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Thanks
Dave

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 8 lines · Dave Young
Quoted 6 lines · Cong Wang
Quoted 2 lines · Dave Young

ssh module will need root user in /etc/passwd, so add root and nobody to /etc/passwd in 99base instead of nfs module

Huh? Even for who don't use either ssh module or nfs module??

Quoted 7 lines
Quoted 1 line

I think you just need to copy these two lines into your ssh module...

Thanks for your review.

in 90mdraid module there's words in its comments about passwd, so there might be more modules need passwd.

But there are still more modules that don't need passwd, right?

Quoted 5 lines

Dealing with same thing in multi module is not good, not only duplicate code, but also they could cause conflict. Ie. nfs set root home dir to / but we need /root, if nfs module added after ssh-client the home dir of root will be /.

If you don't want to duplicate the code, make it a function (maybe in dracut-function?),
putting it in base module is confusing.

A message that is not in the archive (sent off-list or not yet received): CAM_iQpW2FH_ob3u22nii3tAe-yUX-iPctDb2KEPwptrugdQbsw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#6 lore raw
Quoted 22 lines · Cong Wang
Quoted 8 lines · Dave Young
Quoted 6 lines · Cong Wang
Quoted 2 lines · Dave Young

ssh module will need root user in /etc/passwd, so add root and nobody to /etc/passwd in 99base instead of nfs module

Huh? Even for who don't use either ssh module or nfs module??

Quoted 7 lines
Quoted 1 line

I think you just need to copy these two lines into your ssh module...

Thanks for your review.

in 90mdraid module there's words in its comments about passwd, so there might be more modules need passwd.

But there are still more modules that don't need passwd, right?

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

Dealing with same thing in multi module is not good, not only duplicate code, but also they could cause conflict. Ie. nfs set root home dir to / but we need /root, if nfs module added after ssh-client the home dir of root will be /.

If you don't want to duplicate the code, make it a function (maybe in dracut-function?),
putting it in base module is confusing.

Scratching head.. I'm feeling bad to add same user multi-times, Yes not all modules need passwd, but I still think it is a base thing.

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Thanks
Dave