[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: why are init's arguments wiped ?
From: Isaac Dunham <ibid.ag () gmail ! com>
Date: 2016-01-30 1:23:06
Message-ID: 20160130012304.GA12312 () newbook
[Download RAW message or body]
On Fri, Jan 29, 2016 at 06:10:10PM +0100, Didier Kryn wrote:
> Le 29/01/2016 17:32, Isaac Dunham a écrit :
> >for opt in $#; do
> > case "$opt" in
> > (*=*) eval "$opt"
> > ;;
> > esac
> >done
> >
> >exec busybox init $@
>
> Isaac,
>
> I understand what that the loop sets environment variables that init
> will inherit, but what's the purpose of the $@ at the end. It's now useless
> and init is going to wipe it out anyway. Did I miss something?
That "-s"/"single" or other runlevels (when supported) are specified thus:
init <runlevel>
>
> Le 29/01/2016 17:50, Nicolas CARRIER a écrit :
> >Is it even possible ? Won't it suffer from the lack of proc / sys and dev
> >? Environment variables setup by init ?
> >What's more, there is a risk to spawn multiple processes (eval ?) before
eval is a shell builtin; "export" should function equivalently for this
purpose.
Unless you start this like:
init.sh single 'foo=`command`'
you aren't going to spawn any processes by using eval.
> >init is launched and the previous questions do apply.
>
> The first command in your script may be 'busybox mount -t proc proc
> /proc' . I don't think you need /sys and /dev. Mounting /sys is as easy as
> 'busybox mount -t sysfs sys /sys'.
In fact, init does not mount any filesystems itself (it will run swapon if
ram gets too low, but otherwise your rc script handles mount and swapon.)
> The processes created in the mean time have no consequence: you
> terminate your script with 'exec init'; this does not cause any fork. It is
> the same process which continues with the new init, and still pid1.
Correct.
HTH,
Isaac Dunham
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic