mkinitrd unification across distributions
 help / color / mirror / Atom feed
* [PATCH 1/5 branch usrmove v2] deal common part of etc passwd in 99base
@ 2011-12-26  6:29 Dave Young
  2011-12-27 11:44 ` Cong Wang
       [not found] ` <20111226062910.GA3141-4/PLUo9XfK+sDdueE5tM26fLeoKvNuZc@public.gmane.org>
  0 siblings, 2 replies; 10+ messages in thread
From: Dave Young @ 2011-12-26  6:29 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA, soltys-R61QfzASbfY

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

Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 modules.d/95nfs/module-setup.sh  |    2 --
 modules.d/99base/module-setup.sh |    4 ++++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
index bb3b793..674a438 100755
--- a/modules.d/95nfs/module-setup.sh
+++ b/modules.d/95nfs/module-setup.sh
@@ -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"
diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh
index 5297a9d..f6c1209 100755
--- a/modules.d/99base/module-setup.sh
+++ b/modules.d/99base/module-setup.sh
@@ -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"
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/5 branch usrmove v2] deal common part of etc passwd in 99base
  2011-12-26  6:29 [PATCH 1/5 branch usrmove v2] deal common part of etc passwd in 99base Dave Young
@ 2011-12-27 11:44 ` Cong Wang
  2011-12-29  3:03   ` Dave Young
       [not found] ` <20111226062910.GA3141-4/PLUo9XfK+sDdueE5tM26fLeoKvNuZc@public.gmane.org>
  1 sibling, 1 reply; 10+ messages in thread
From: Cong Wang @ 2011-12-27 11:44 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

On Mon, 26 Dec 2011 at 06:29 GMT, Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> ssh module will need root user in /etc/passwd, so add root and nobody
> to /etc/passwd in 99base instead of nfs module
>

Sorry, for people who don't use nfs/ssh module,
this is totally unnecessary.

And, I don't think duplicating 2 lines of code is a problem here...

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/5 branch usrmove v2] deal common part of etc passwd in 99base
  2011-12-27 11:44 ` Cong Wang
@ 2011-12-29  3:03   ` Dave Young
  2011-12-29  9:27     ` Cong Wang
  0 siblings, 1 reply; 10+ messages in thread
From: Dave Young @ 2011-12-29  3:03 UTC (permalink / raw)
  To: Cong Wang; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

On 12/27/2011 07:44 PM, Cong Wang wrote:

> On Mon, 26 Dec 2011 at 06:29 GMT, Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
>> ssh module will need root user in /etc/passwd, so add root and nobody
>> to /etc/passwd in 99base instead of nfs module
>>
> 
> Sorry, for people who don't use nfs/ssh module,
> this is totally unnecessary.


I dont think so, but if you insist I can add an dracut function like
inst_root_user

> 
> And, I don't think duplicating 2 lines of code is a problem here...
> 
> --
> To unsubscribe from this list: send the line "unsubscribe initramfs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks
Dave

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/5 branch usrmove v2] deal common part of etc passwd in 99base
  2011-12-29  3:03   ` Dave Young
@ 2011-12-29  9:27     ` Cong Wang
  2011-12-29  9:40       ` Cong Wang
  2011-12-29  9:45       ` Dave Young
  0 siblings, 2 replies; 10+ messages in thread
From: Cong Wang @ 2011-12-29  9:27 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

On Thu, 29 Dec 2011 at 03:03 GMT, Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> On 12/27/2011 07:44 PM, Cong Wang wrote:
>
>> On Mon, 26 Dec 2011 at 06:29 GMT, Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
>>> ssh module will need root user in /etc/passwd, so add root and nobody
>>> to /etc/passwd in 99base instead of nfs module
>>>
>> 
>> Sorry, for people who don't use nfs/ssh module,
>> this is totally unnecessary.
>
>
> I dont think so, but if you insist I can add an dracut function like
> inst_root_user
>

I cooked the following patch.

The nfs module still uses "/" as home of root, while ssh module uses
"/root". With you patches, you changed to "/root" for both nfs and
ssh, which *maybe* a problem for nfs module since you didn't test it.


----
diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
index 6778f28..c97dea3 100755
--- a/modules.d/95nfs/module-setup.sh
+++ b/modules.d/95nfs/module-setup.sh
@@ -65,8 +65,8 @@ 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 -q '^root:' "$initdir/etc/passwd" 2>/dev/null || echo  'root:x:0:0::/:/bin/sh' >> "$initdir/etc/passwd"
+    egrep -q '^nobody:' "$initdir/etc/passwd" 2>/dev/null || 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"
diff --git a/modules.d/95ssh-client/module-setup.sh b/modules.d/95ssh-client/module-setup.sh
index 0ffc298..ef8effe 100644
--- a/modules.d/95ssh-client/module-setup.sh
+++ b/modules.d/95ssh-client/module-setup.sh
@@ -56,5 +56,8 @@ install() {
     inst ssh
     inst scp
     inst_sshenv
+
+    egrep -q '^root:' "$initdir/etc/passwd" 2>/dev/null || echo  'root:x:0:0::/root:/bin/sh' >> "$initdir/etc/passwd"
+    egrep -q '^nobody:' "$initdir/etc/passwd" 2>/dev/null || egrep '^nobody:' /etc/passwd >> "$initdir/etc/passwd"
 }
 

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/5 branch usrmove v2] deal common part of etc passwd in 99base
  2011-12-29  9:27     ` Cong Wang
@ 2011-12-29  9:40       ` Cong Wang
  2011-12-29  9:45       ` Dave Young
  1 sibling, 0 replies; 10+ messages in thread
From: Cong Wang @ 2011-12-29  9:40 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA


Hi, Dave,

I merged four patches into my tree:

https://github.com/congwang/dracut/commits/kdump

patch 1/5 and 3/5 are merged and fixed as one by myself.

Please check if they are okay for you.

Thanks.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/5 branch usrmove v2] deal common part of etc passwd in 99base
  2011-12-29  9:27     ` Cong Wang
  2011-12-29  9:40       ` Cong Wang
@ 2011-12-29  9:45       ` Dave Young
       [not found]         ` <4EFC36CD.8040205-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  1 sibling, 1 reply; 10+ messages in thread
From: Dave Young @ 2011-12-29  9:45 UTC (permalink / raw)
  To: Cong Wang; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

On 12/29/2011 05:27 PM, Cong Wang wrote:

> On Thu, 29 Dec 2011 at 03:03 GMT, Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
>> On 12/27/2011 07:44 PM, Cong Wang wrote:
>>
>>> On Mon, 26 Dec 2011 at 06:29 GMT, Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
>>>> ssh module will need root user in /etc/passwd, so add root and nobody
>>>> to /etc/passwd in 99base instead of nfs module
>>>>
>>>
>>> Sorry, for people who don't use nfs/ssh module,
>>> this is totally unnecessary.
>>
>>
>> I dont think so, but if you insist I can add an dracut function like
>> inst_root_user
>>
> 
> I cooked the following patch.


Thanks.

> 
> The nfs module still uses "/" as home of root, while ssh module uses
> "/root". With you patches, you changed to "/root" for both nfs and
> ssh, which *maybe* a problem for nfs module since you didn't test it.


I tested nfs boot as well, it works ok with $HOME=/root

Also if you add both ssh-client and nfs, what's the result of /etc/passwd?

> 
> 
> ----
> diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
> index 6778f28..c97dea3 100755
> --- a/modules.d/95nfs/module-setup.sh
> +++ b/modules.d/95nfs/module-setup.sh
> @@ -65,8 +65,8 @@ 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 -q '^root:' "$initdir/etc/passwd" 2>/dev/null || echo  'root:x:0:0::/:/bin/sh' >> "$initdir/etc/passwd"
> +    egrep -q '^nobody:' "$initdir/etc/passwd" 2>/dev/null || 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"
> diff --git a/modules.d/95ssh-client/module-setup.sh b/modules.d/95ssh-client/module-setup.sh
> index 0ffc298..ef8effe 100644
> --- a/modules.d/95ssh-client/module-setup.sh
> +++ b/modules.d/95ssh-client/module-setup.sh
> @@ -56,5 +56,8 @@ install() {
>      inst ssh
>      inst scp
>      inst_sshenv
> +
> +    egrep -q '^root:' "$initdir/etc/passwd" 2>/dev/null || echo  'root:x:0:0::/root:/bin/sh' >> "$initdir/etc/passwd"
> +    egrep -q '^nobody:' "$initdir/etc/passwd" 2>/dev/null || egrep '^nobody:' /etc/passwd >> "$initdir/etc/passwd"
>  }
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe initramfs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks
Dave

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/5 branch usrmove v2] deal common part of etc passwd in 99base
       [not found]         ` <4EFC36CD.8040205-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2011-12-29  9:48           ` Cong Wang
       [not found]             ` <CAM_iQpX6kWGPB_mGUWOaywQgxeWEC+Og6WjOZmknS+FPGuA0xQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Cong Wang @ 2011-12-29  9:48 UTC (permalink / raw)
  To: Dave Young; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

On Thu, Dec 29, 2011 at 5:45 PM, Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> On 12/29/2011 05:27 PM, Cong Wang wrote:
>> The nfs module still uses "/" as home of root, while ssh module uses
>> "/root". With you patches, you changed to "/root" for both nfs and
>> ssh, which *maybe* a problem for nfs module since you didn't test it.
>
>
> I tested nfs boot as well, it works ok with $HOME=/root

Ok, will change to "/root" too.

>
> Also if you add both ssh-client and nfs, what's the result of /etc/passwd?

If the line "root:" exists before,

 egrep -q '^root:' "$initdir/etc/passwd" 2>/dev/null || echo
'root:x:0:0::/:/bin/sh' >> "$initdir/etc/passwd"

egrep will succeed and echo will not be executed...

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/5 branch usrmove v2] deal common part of etc passwd in 99base
       [not found]             ` <CAM_iQpX6kWGPB_mGUWOaywQgxeWEC+Og6WjOZmknS+FPGuA0xQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-12-29 10:00               ` Dave Young
       [not found]                 ` <4EFC3A2E.6020606-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Dave Young @ 2011-12-29 10:00 UTC (permalink / raw)
  To: Cong Wang; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

On 12/29/2011 05:48 PM, Cong Wang wrote:

> On Thu, Dec 29, 2011 at 5:45 PM, Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
>> On 12/29/2011 05:27 PM, Cong Wang wrote:
>>> The nfs module still uses "/" as home of root, while ssh module uses
>>> "/root". With you patches, you changed to "/root" for both nfs and
>>> ssh, which *maybe* a problem for nfs module since you didn't test it.
>>
>>
>> I tested nfs boot as well, it works ok with $HOME=/root
> 
> Ok, will change to "/root" too.
> 
>>
>> Also if you add both ssh-client and nfs, what's the result of /etc/passwd?
> 
> If the line "root:" exists before,
> 
>  egrep -q '^root:' "$initdir/etc/passwd" 2>/dev/null || echo
> 'root:x:0:0::/:/bin/sh' >> "$initdir/etc/passwd"
> 
> egrep will succeed and echo will not be executed...



Yes, but who knows which module will be added firstly, maybe there's
other module do this in future.

But if nfs also use /root as HOME it will be ok currently


-- 
Thanks
Dave

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/5 branch usrmove v2] deal common part of etc passwd in 99base
       [not found]                 ` <4EFC3A2E.6020606-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2011-12-29 10:04                   ` Cong Wang
  0 siblings, 0 replies; 10+ messages in thread
From: Cong Wang @ 2011-12-29 10:04 UTC (permalink / raw)
  To: Dave Young; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

On Thu, Dec 29, 2011 at 6:00 PM, Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> On 12/29/2011 05:48 PM, Cong Wang wrote:
>
>> On Thu, Dec 29, 2011 at 5:45 PM, Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
>>> On 12/29/2011 05:27 PM, Cong Wang wrote:
>>>> The nfs module still uses "/" as home of root, while ssh module uses
>>>> "/root". With you patches, you changed to "/root" for both nfs and
>>>> ssh, which *maybe* a problem for nfs module since you didn't test it.
>>>
>>>
>>> I tested nfs boot as well, it works ok with $HOME=/root
>>
>> Ok, will change to "/root" too.
>>
>>>
>>> Also if you add both ssh-client and nfs, what's the result of /etc/passwd?
>>
>> If the line "root:" exists before,
>>
>>  egrep -q '^root:' "$initdir/etc/passwd" 2>/dev/null || echo
>> 'root:x:0:0::/:/bin/sh' >> "$initdir/etc/passwd"
>>
>> egrep will succeed and echo will not be executed...
>
>
>
> Yes, but who knows which module will be added firstly, maybe there's
> other module do this in future.
>
> But if nfs also use /root as HOME it will be ok currently
>

Yeah, it is in git now.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/5 branch usrmove v2] deal common part of etc passwd in 99base
       [not found] ` <20111226062910.GA3141-4/PLUo9XfK+sDdueE5tM26fLeoKvNuZc@public.gmane.org>
@ 2012-01-23 11:03   ` Harald Hoyer
  0 siblings, 0 replies; 10+ messages in thread
From: Harald Hoyer @ 2012-01-23 11:03 UTC (permalink / raw)
  To: Dave Young; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, soltys-R61QfzASbfY

Am 26.12.2011 07:29, schrieb 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
> 
> Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  modules.d/95nfs/module-setup.sh  |    2 --
>  modules.d/99base/module-setup.sh |    4 ++++
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
> index bb3b793..674a438 100755
> --- a/modules.d/95nfs/module-setup.sh
> +++ b/modules.d/95nfs/module-setup.sh
> @@ -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"
> diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh
> index 5297a9d..f6c1209 100755
> --- a/modules.d/99base/module-setup.sh
> +++ b/modules.d/99base/module-setup.sh
> @@ -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"

pushed

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-01-23 11:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-26  6:29 [PATCH 1/5 branch usrmove v2] deal common part of etc passwd in 99base Dave Young
2011-12-27 11:44 ` Cong Wang
2011-12-29  3:03   ` Dave Young
2011-12-29  9:27     ` Cong Wang
2011-12-29  9:40       ` Cong Wang
2011-12-29  9:45       ` Dave Young
     [not found]         ` <4EFC36CD.8040205-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-12-29  9:48           ` Cong Wang
     [not found]             ` <CAM_iQpX6kWGPB_mGUWOaywQgxeWEC+Og6WjOZmknS+FPGuA0xQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-12-29 10:00               ` Dave Young
     [not found]                 ` <4EFC3A2E.6020606-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-12-29 10:04                   ` Cong Wang
     [not found] ` <20111226062910.GA3141-4/PLUo9XfK+sDdueE5tM26fLeoKvNuZc@public.gmane.org>
2012-01-23 11:03   ` Harald Hoyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox