mkinitrd unification across distributions
 help / color / mirror / Atom feed
From: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: "Amadeusz Żołnowski" <aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>
Cc: "initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] 99base/init: honor env. vars provided by kernel (PATH, HOME and TERM)
Date: Fri, 01 Oct 2010 11:39:02 +0200	[thread overview]
Message-ID: <4CA5AC36.8080907@redhat.com> (raw)
In-Reply-To: <4c9e7524.9804cc0a.3175.65a0-ATjtLOhZ0NVl57MIdRCFDg@public.gmane.org>

On 09/26/2010 12:06 AM, Amadeusz Żołnowski wrote:
> Let take a look at Linux sources, /usr/src/linux-2.6.35/init/main.c:
>
>    204: char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };
>
>    857: run_init_process("/sbin/init");
>
>    817: static void run_init_process(char *init_filename)
>    818: {
>    819:        argv_init[0] = init_filename;
>    820:        kernel_execve(init_filename, argv_init, envp_init);
>    821: }
>
> As we can see HOME=/ and TERM=linux are provided for init and this might be
> expected on some systems (Gentoo comes to my mind, here ;-)).  That's why we
> should give to init the same set of env. vars as Linux kernel does.
> ---
>   modules.d/99base/init |    6 +++---
>   1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/modules.d/99base/init b/modules.d/99base/init
> index 5a02ade..dc0a0df 100755
> --- a/modules.d/99base/init
> +++ b/modules.d/99base/init
> @@ -59,8 +59,8 @@ emergency_shell()
>       fi
>   }
>
> +OLD_PATH="$PATH"
>   export PATH=/sbin:/bin:/usr/sbin:/usr/bin
> -export TERM=linux
>   NEWROOT="/sysroot"
>
>   trap "emergency_shell Signal caught!" 0
> @@ -327,8 +327,8 @@ info "Switching root"
>   wait_for_loginit
>
>   umask $OLD_UMASK
> -unset HOME
> -unset TERM
> +export PATH="$OLD_PATH"
> +
>   exec switch_root "$NEWROOT" "$INIT" $initargs || {
>       echo "Something went very badly wrong in the initramfs.  Please "
>       echo "file a bug against dracut."

pushed

      parent reply	other threads:[~2010-10-01  9:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-25 22:06 [PATCH] 99base/init: honor env. vars provided by kernel (PATH, HOME and TERM) Amadeusz Żołnowski
     [not found] ` <4c9e7524.9804cc0a.3175.65a0-ATjtLOhZ0NVl57MIdRCFDg@public.gmane.org>
2010-10-01  9:39   ` Harald Hoyer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CA5AC36.8080907@redhat.com \
    --to=harald-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org \
    --cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox