* [Buildroot] [PATCH] Rework of shutdown policy in inittab
@ 2011-09-02 12:25 Maxime Ripard
2011-11-24 8:32 ` Maxime Ripard
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Maxime Ripard @ 2011-09-02 12:25 UTC (permalink / raw)
To: buildroot
This commit follows commit ad501b66. Start up of the busybox logging
daemons were moved to an init script but the shutdown were still
performed in inittab. This commit moves the shutdown policy to an
rcK script that calls the stop function of all the init scripts in
a reversed order.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
fs/skeleton/etc/init.d/rcK | 27 +++++++++++++++++++++++++++
fs/skeleton/etc/inittab | 3 +--
2 files changed, 28 insertions(+), 2 deletions(-)
create mode 100755 fs/skeleton/etc/init.d/rcK
diff --git a/fs/skeleton/etc/init.d/rcK b/fs/skeleton/etc/init.d/rcK
new file mode 100755
index 0000000..59e9c54
--- /dev/null
+++ b/fs/skeleton/etc/init.d/rcK
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+
+# Stop all init scripts in /etc/init.d
+# executing them in reversed numerical order.
+#
+for i in $(ls -r /etc/init.d/S??*) ;do
+
+ # Ignore dangling symlinks (if any).
+ [ ! -f "$i" ] && continue
+
+ case "$i" in
+ *.sh)
+ # Source shell script for speed.
+ (
+ trap - INT QUIT TSTP
+ set stop
+ . $i
+ )
+ ;;
+ *)
+ # No sh extension, so fork subprocess.
+ $i stop
+ ;;
+ esac
+done
+
diff --git a/fs/skeleton/etc/inittab b/fs/skeleton/etc/inittab
index ac410d6..85881f4 100644
--- a/fs/skeleton/etc/inittab
+++ b/fs/skeleton/etc/inittab
@@ -30,8 +30,7 @@ null::sysinit:/bin/hostname -F /etc/hostname
::ctrlaltdel:/sbin/reboot
# Stuff to do before rebooting
-null::shutdown:/usr/bin/killall klogd
-null::shutdown:/usr/bin/killall syslogd
+null::shutdown:/etc/init.d/rcK
null::shutdown:/bin/umount -a -r
null::shutdown:/sbin/swapoff -a
--
1.7.4.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH] Rework of shutdown policy in inittab
2011-09-02 12:25 [Buildroot] [PATCH] Rework of shutdown policy in inittab Maxime Ripard
@ 2011-11-24 8:32 ` Maxime Ripard
2011-12-07 4:31 ` Kelvin Cheung
2011-12-07 6:52 ` Thomas De Schampheleire
2 siblings, 0 replies; 14+ messages in thread
From: Maxime Ripard @ 2011-11-24 8:32 UTC (permalink / raw)
To: buildroot
Ping ?
On 02/09/2011 14:25, Maxime Ripard wrote:
> This commit follows commit ad501b66. Start up of the busybox logging
> daemons were moved to an init script but the shutdown were still
> performed in inittab. This commit moves the shutdown policy to an
> rcK script that calls the stop function of all the init scripts in
> a reversed order.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
> fs/skeleton/etc/init.d/rcK | 27 +++++++++++++++++++++++++++
> fs/skeleton/etc/inittab | 3 +--
> 2 files changed, 28 insertions(+), 2 deletions(-)
> create mode 100755 fs/skeleton/etc/init.d/rcK
>
> diff --git a/fs/skeleton/etc/init.d/rcK b/fs/skeleton/etc/init.d/rcK
> new file mode 100755
> index 0000000..59e9c54
> --- /dev/null
> +++ b/fs/skeleton/etc/init.d/rcK
> @@ -0,0 +1,27 @@
> +#!/bin/sh
> +
> +
> +# Stop all init scripts in /etc/init.d
> +# executing them in reversed numerical order.
> +#
> +for i in $(ls -r /etc/init.d/S??*) ;do
> +
> + # Ignore dangling symlinks (if any).
> + [ ! -f "$i" ] && continue
> +
> + case "$i" in
> + *.sh)
> + # Source shell script for speed.
> + (
> + trap - INT QUIT TSTP
> + set stop
> + . $i
> + )
> + ;;
> + *)
> + # No sh extension, so fork subprocess.
> + $i stop
> + ;;
> + esac
> +done
> +
> diff --git a/fs/skeleton/etc/inittab b/fs/skeleton/etc/inittab
> index ac410d6..85881f4 100644
> --- a/fs/skeleton/etc/inittab
> +++ b/fs/skeleton/etc/inittab
> @@ -30,8 +30,7 @@ null::sysinit:/bin/hostname -F /etc/hostname
> ::ctrlaltdel:/sbin/reboot
>
> # Stuff to do before rebooting
> -null::shutdown:/usr/bin/killall klogd
> -null::shutdown:/usr/bin/killall syslogd
> +null::shutdown:/etc/init.d/rcK
> null::shutdown:/bin/umount -a -r
> null::shutdown:/sbin/swapoff -a
>
--
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH] Rework of shutdown policy in inittab
2011-09-02 12:25 [Buildroot] [PATCH] Rework of shutdown policy in inittab Maxime Ripard
2011-11-24 8:32 ` Maxime Ripard
@ 2011-12-07 4:31 ` Kelvin Cheung
2011-12-07 6:52 ` Thomas De Schampheleire
2 siblings, 0 replies; 14+ messages in thread
From: Kelvin Cheung @ 2011-12-07 4:31 UTC (permalink / raw)
To: buildroot
This policy seems more reasonable.
2011/9/2 Maxime Ripard <maxime.ripard@free-electrons.com>
> This commit follows commit ad501b66. Start up of the busybox logging
> daemons were moved to an init script but the shutdown were still
> performed in inittab. This commit moves the shutdown policy to an
> rcK script that calls the stop function of all the init scripts in
> a reversed order.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
> fs/skeleton/etc/init.d/rcK | 27 +++++++++++++++++++++++++++
> fs/skeleton/etc/inittab | 3 +--
> 2 files changed, 28 insertions(+), 2 deletions(-)
> create mode 100755 fs/skeleton/etc/init.d/rcK
>
> diff --git a/fs/skeleton/etc/init.d/rcK b/fs/skeleton/etc/init.d/rcK
> new file mode 100755
> index 0000000..59e9c54
> --- /dev/null
> +++ b/fs/skeleton/etc/init.d/rcK
> @@ -0,0 +1,27 @@
> +#!/bin/sh
> +
> +
> +# Stop all init scripts in /etc/init.d
> +# executing them in reversed numerical order.
> +#
> +for i in $(ls -r /etc/init.d/S??*) ;do
> +
> + # Ignore dangling symlinks (if any).
> + [ ! -f "$i" ] && continue
> +
> + case "$i" in
> + *.sh)
> + # Source shell script for speed.
> + (
> + trap - INT QUIT TSTP
> + set stop
> + . $i
> + )
> + ;;
> + *)
> + # No sh extension, so fork subprocess.
> + $i stop
> + ;;
> + esac
> +done
> +
> diff --git a/fs/skeleton/etc/inittab b/fs/skeleton/etc/inittab
> index ac410d6..85881f4 100644
> --- a/fs/skeleton/etc/inittab
> +++ b/fs/skeleton/etc/inittab
> @@ -30,8 +30,7 @@ null::sysinit:/bin/hostname -F /etc/hostname
> ::ctrlaltdel:/sbin/reboot
>
> # Stuff to do before rebooting
> -null::shutdown:/usr/bin/killall klogd
> -null::shutdown:/usr/bin/killall syslogd
> +null::shutdown:/etc/init.d/rcK
> null::shutdown:/bin/umount -a -r
> null::shutdown:/sbin/swapoff -a
>
> --
> 1.7.4.1
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
--
Best Regards!
Kelvin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20111207/141e5576/attachment.html>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH] Rework of shutdown policy in inittab
2011-09-02 12:25 [Buildroot] [PATCH] Rework of shutdown policy in inittab Maxime Ripard
2011-11-24 8:32 ` Maxime Ripard
2011-12-07 4:31 ` Kelvin Cheung
@ 2011-12-07 6:52 ` Thomas De Schampheleire
2011-12-07 7:26 ` Kelvin Cheung
` (2 more replies)
2 siblings, 3 replies; 14+ messages in thread
From: Thomas De Schampheleire @ 2011-12-07 6:52 UTC (permalink / raw)
To: buildroot
Hi,
On Fri, Sep 2, 2011 at 2:25 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> This commit follows commit ad501b66. Start up of the busybox logging
> daemons were moved to an init script but the shutdown were still
> performed in inittab. This commit moves the shutdown policy to an
> rcK script that calls the stop function of all the init scripts in
> a reversed order.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
> ?fs/skeleton/etc/init.d/rcK | ? 27 +++++++++++++++++++++++++++
> ?fs/skeleton/etc/inittab ? ?| ? ?3 +--
> ?2 files changed, 28 insertions(+), 2 deletions(-)
> ?create mode 100755 fs/skeleton/etc/init.d/rcK
>
> diff --git a/fs/skeleton/etc/init.d/rcK b/fs/skeleton/etc/init.d/rcK
> new file mode 100755
> index 0000000..59e9c54
> --- /dev/null
> +++ b/fs/skeleton/etc/init.d/rcK
> @@ -0,0 +1,27 @@
> +#!/bin/sh
> +
> +
> +# Stop all init scripts in /etc/init.d
> +# executing them in reversed numerical order.
> +#
> +for i in $(ls -r /etc/init.d/S??*) ;do
> +
> + ? ? # Ignore dangling symlinks (if any).
> + ? ? [ ! -f "$i" ] && continue
> +
> + ? ? case "$i" in
> + ? ? ? *.sh)
> + ? ? ? ? ? # Source shell script for speed.
> + ? ? ? ? ? (
> + ? ? ? ? ? ? ? trap - INT QUIT TSTP
> + ? ? ? ? ? ? ? set stop
> + ? ? ? ? ? ? ? . $i
> + ? ? ? ? ? )
> + ? ? ? ? ? ;;
> + ? ? ? *)
> + ? ? ? ? ? # No sh extension, so fork subprocess.
> + ? ? ? ? ? $i stop
> + ? ? ? ? ? ;;
> + ? ?esac
> +done
> +
> diff --git a/fs/skeleton/etc/inittab b/fs/skeleton/etc/inittab
> index ac410d6..85881f4 100644
> --- a/fs/skeleton/etc/inittab
> +++ b/fs/skeleton/etc/inittab
> @@ -30,8 +30,7 @@ null::sysinit:/bin/hostname -F /etc/hostname
> ?::ctrlaltdel:/sbin/reboot
>
> ?# Stuff to do before rebooting
> -null::shutdown:/usr/bin/killall klogd
> -null::shutdown:/usr/bin/killall syslogd
> +null::shutdown:/etc/init.d/rcK
> ?null::shutdown:/bin/umount -a -r
> ?null::shutdown:/sbin/swapoff -a
This is a different behavior now. Before only the logging daemons were
killed, now all init scripts are run.
For this to work properly, all init scripts that users have in
/etc/init.d should actually have a stop() function. Since this
behavior was not required previously, I expect several users not to
have this.
For such users, a reboot would suddenly trigger several
initializations that are unexpected.
I think there are at least two solutions:
1. Keep the new behavior created with this patch, but make sure that
the release notes clearly state this behavior change and update the
documentation.
2. Adapt the new behavior: currently you are following
/etc/init.d/Sxxxx files/links, while I think that the default policy
on many distributions is to use /etc/init.d/Kxxxx for shutdown (and
Sxxxx only for startup). In this scenario, users who have custom Sxxx
init scripts will not be impacted. Only if they choose to, can they
create appropriate Kxxxx links and provide stop functions.
For scripts present in the buildroot distribution, we can provide
appropriate S and K links immediately.
Best regards,
Thomas
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH] Rework of shutdown policy in inittab
2011-12-07 6:52 ` Thomas De Schampheleire
@ 2011-12-07 7:26 ` Kelvin Cheung
2011-12-07 9:50 ` Gustavo Zacarias
2011-12-07 13:08 ` Maxime Ripard
2011-12-14 16:46 ` Thomas Petazzoni
2 siblings, 1 reply; 14+ messages in thread
From: Kelvin Cheung @ 2011-12-07 7:26 UTC (permalink / raw)
To: buildroot
Pherhaps solution 1 is simple and feasible.
Most Sxxxx scripts under dir 'package' provide stop() function currently.
And by this policy, the programs/daemons are just what should be killed,
which are started at startup.
We do not need to maintain consistency between Sxxxx and Kxxxx.
2011/12/7 Thomas De Schampheleire <patrickdepinguin+buildroot@gmail.com>
> Hi,
>
> On Fri, Sep 2, 2011 at 2:25 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > This commit follows commit ad501b66. Start up of the busybox logging
> > daemons were moved to an init script but the shutdown were still
> > performed in inittab. This commit moves the shutdown policy to an
> > rcK script that calls the stop function of all the init scripts in
> > a reversed order.
> >
> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > ---
> > fs/skeleton/etc/init.d/rcK | 27 +++++++++++++++++++++++++++
> > fs/skeleton/etc/inittab | 3 +--
> > 2 files changed, 28 insertions(+), 2 deletions(-)
> > create mode 100755 fs/skeleton/etc/init.d/rcK
> >
> > diff --git a/fs/skeleton/etc/init.d/rcK b/fs/skeleton/etc/init.d/rcK
> > new file mode 100755
> > index 0000000..59e9c54
> > --- /dev/null
> > +++ b/fs/skeleton/etc/init.d/rcK
> > @@ -0,0 +1,27 @@
> > +#!/bin/sh
> > +
> > +
> > +# Stop all init scripts in /etc/init.d
> > +# executing them in reversed numerical order.
> > +#
> > +for i in $(ls -r /etc/init.d/S??*) ;do
> > +
> > + # Ignore dangling symlinks (if any).
> > + [ ! -f "$i" ] && continue
> > +
> > + case "$i" in
> > + *.sh)
> > + # Source shell script for speed.
> > + (
> > + trap - INT QUIT TSTP
> > + set stop
> > + . $i
> > + )
> > + ;;
> > + *)
> > + # No sh extension, so fork subprocess.
> > + $i stop
> > + ;;
> > + esac
> > +done
> > +
> > diff --git a/fs/skeleton/etc/inittab b/fs/skeleton/etc/inittab
> > index ac410d6..85881f4 100644
> > --- a/fs/skeleton/etc/inittab
> > +++ b/fs/skeleton/etc/inittab
> > @@ -30,8 +30,7 @@ null::sysinit:/bin/hostname -F /etc/hostname
> > ::ctrlaltdel:/sbin/reboot
> >
> > # Stuff to do before rebooting
> > -null::shutdown:/usr/bin/killall klogd
> > -null::shutdown:/usr/bin/killall syslogd
> > +null::shutdown:/etc/init.d/rcK
> > null::shutdown:/bin/umount -a -r
> > null::shutdown:/sbin/swapoff -a
>
> This is a different behavior now. Before only the logging daemons were
> killed, now all init scripts are run.
>
> For this to work properly, all init scripts that users have in
> /etc/init.d should actually have a stop() function. Since this
> behavior was not required previously, I expect several users not to
> have this.
> For such users, a reboot would suddenly trigger several
> initializations that are unexpected.
>
> I think there are at least two solutions:
> 1. Keep the new behavior created with this patch, but make sure that
> the release notes clearly state this behavior change and update the
> documentation.
>
> 2. Adapt the new behavior: currently you are following
> /etc/init.d/Sxxxx files/links, while I think that the default policy
> on many distributions is to use /etc/init.d/Kxxxx for shutdown (and
> Sxxxx only for startup). In this scenario, users who have custom Sxxx
> init scripts will not be impacted. Only if they choose to, can they
> create appropriate Kxxxx links and provide stop functions.
> For scripts present in the buildroot distribution, we can provide
> appropriate S and K links immediately.
>
> Best regards,
> Thomas
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
--
Best Regards!
Kelvin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20111207/a98cdca8/attachment-0001.html>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH] Rework of shutdown policy in inittab
2011-12-07 7:26 ` Kelvin Cheung
@ 2011-12-07 9:50 ` Gustavo Zacarias
0 siblings, 0 replies; 14+ messages in thread
From: Gustavo Zacarias @ 2011-12-07 9:50 UTC (permalink / raw)
To: buildroot
On 07.12.2011 04:26, Kelvin Cheung wrote:
> Pherhaps solution 1 is simple and feasible.
> Most Sxxxx scripts under dir package provide stop() function
> currently.
> And by this policy, the programs/daemons are just what should be
> killed, which are started at startup.
> We do not need to maintain consistency between Sxxxx and Kxxxx.
I'd go for option 2. it results in a saner behaviour if people don't
handle the stop condition as Thomas pointed out.
Otherwise you can get nasty messages from console when people for
example try to mount some filesystem in a custom script that don't make
a disctintion between start/stop and things like that.
Regards.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH] Rework of shutdown policy in inittab
2011-12-07 6:52 ` Thomas De Schampheleire
2011-12-07 7:26 ` Kelvin Cheung
@ 2011-12-07 13:08 ` Maxime Ripard
2011-12-08 9:33 ` Thomas De Schampheleire
2011-12-14 16:46 ` Thomas Petazzoni
2 siblings, 1 reply; 14+ messages in thread
From: Maxime Ripard @ 2011-12-07 13:08 UTC (permalink / raw)
To: buildroot
On 07/12/2011 07:52, Thomas De Schampheleire wrote:
> Hi,
>
> On Fri, Sep 2, 2011 at 2:25 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
>> This commit follows commit ad501b66. Start up of the busybox logging
>> daemons were moved to an init script but the shutdown were still
>> performed in inittab. This commit moves the shutdown policy to an
>> rcK script that calls the stop function of all the init scripts in
>> a reversed order.
>>
>> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
>> ---
>> fs/skeleton/etc/init.d/rcK | 27 +++++++++++++++++++++++++++
>> fs/skeleton/etc/inittab | 3 +--
>> 2 files changed, 28 insertions(+), 2 deletions(-)
>> create mode 100755 fs/skeleton/etc/init.d/rcK
>>
>> diff --git a/fs/skeleton/etc/init.d/rcK b/fs/skeleton/etc/init.d/rcK
>> new file mode 100755
>> index 0000000..59e9c54
>> --- /dev/null
>> +++ b/fs/skeleton/etc/init.d/rcK
>> @@ -0,0 +1,27 @@
>> +#!/bin/sh
>> +
>> +
>> +# Stop all init scripts in /etc/init.d
>> +# executing them in reversed numerical order.
>> +#
>> +for i in $(ls -r /etc/init.d/S??*) ;do
>> +
>> + # Ignore dangling symlinks (if any).
>> + [ ! -f "$i" ] && continue
>> +
>> + case "$i" in
>> + *.sh)
>> + # Source shell script for speed.
>> + (
>> + trap - INT QUIT TSTP
>> + set stop
>> + . $i
>> + )
>> + ;;
>> + *)
>> + # No sh extension, so fork subprocess.
>> + $i stop
>> + ;;
>> + esac
>> +done
>> +
>> diff --git a/fs/skeleton/etc/inittab b/fs/skeleton/etc/inittab
>> index ac410d6..85881f4 100644
>> --- a/fs/skeleton/etc/inittab
>> +++ b/fs/skeleton/etc/inittab
>> @@ -30,8 +30,7 @@ null::sysinit:/bin/hostname -F /etc/hostname
>> ::ctrlaltdel:/sbin/reboot
>>
>> # Stuff to do before rebooting
>> -null::shutdown:/usr/bin/killall klogd
>> -null::shutdown:/usr/bin/killall syslogd
>> +null::shutdown:/etc/init.d/rcK
>> null::shutdown:/bin/umount -a -r
>> null::shutdown:/sbin/swapoff -a
>
> This is a different behavior now. Before only the logging daemons were
> killed, now all init scripts are run.
>
> For this to work properly, all init scripts that users have in
> /etc/init.d should actually have a stop() function. Since this
> behavior was not required previously, I expect several users not to
> have this.
> For such users, a reboot would suddenly trigger several
> initializations that are unexpected.
I have to admit, I didn't think about in-the-wild users in such a case.
> I think there are at least two solutions:
> 1. Keep the new behavior created with this patch, but make sure that
> the release notes clearly state this behavior change and update the
> documentation.
I hardly see how this is a new behaviour, every single init scripts we
have already implements it, and we require it to.
> 2. Adapt the new behavior: currently you are following
> /etc/init.d/Sxxxx files/links, while I think that the default policy
> on many distributions is to use /etc/init.d/Kxxxx for shutdown (and
> Sxxxx only for startup).
The only one doing that I can think of is OpenWRT, it is barely many.
> In this scenario, users who have custom Sxxx
> init scripts will not be impacted. Only if they choose to, can they
> create appropriate Kxxxx links and provide stop functions.
> For scripts present in the buildroot distribution, we can provide
> appropriate S and K links immediately.
You're right.
I'm glad we can finally have that sort of discussion, I was starting to
think every one had a dev/null rule for my patches.
However, this touches the same area than my systemd patches, so I'd
prefer not to touch the same area in every packages in such a small time
frame. So maybe the easier way would be to merge such as mechanism with
the init mechanism introduced with these patches.
Maxime
--
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH] Rework of shutdown policy in inittab
2011-12-07 13:08 ` Maxime Ripard
@ 2011-12-08 9:33 ` Thomas De Schampheleire
0 siblings, 0 replies; 14+ messages in thread
From: Thomas De Schampheleire @ 2011-12-08 9:33 UTC (permalink / raw)
To: buildroot
Hello Maxime,
On Wed, Dec 7, 2011 at 2:08 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> On 07/12/2011 07:52, Thomas De Schampheleire wrote:
>> Hi,
>>
>> On Fri, Sep 2, 2011 at 2:25 PM, Maxime Ripard
>> <maxime.ripard@free-electrons.com> wrote:
>>> This commit follows commit ad501b66. Start up of the busybox logging
>>> daemons were moved to an init script but the shutdown were still
>>> performed in inittab. This commit moves the shutdown policy to an
>>> rcK script that calls the stop function of all the init scripts in
>>> a reversed order.
>>>
>>> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
>>> ---
>>> ?fs/skeleton/etc/init.d/rcK | ? 27 +++++++++++++++++++++++++++
>>> ?fs/skeleton/etc/inittab ? ?| ? ?3 +--
>>> ?2 files changed, 28 insertions(+), 2 deletions(-)
>>> ?create mode 100755 fs/skeleton/etc/init.d/rcK
>>>
>>> diff --git a/fs/skeleton/etc/init.d/rcK b/fs/skeleton/etc/init.d/rcK
>>> new file mode 100755
>>> index 0000000..59e9c54
>>> --- /dev/null
>>> +++ b/fs/skeleton/etc/init.d/rcK
>>> @@ -0,0 +1,27 @@
>>> +#!/bin/sh
>>> +
>>> +
>>> +# Stop all init scripts in /etc/init.d
>>> +# executing them in reversed numerical order.
>>> +#
>>> +for i in $(ls -r /etc/init.d/S??*) ;do
>>> +
>>> + ? ? # Ignore dangling symlinks (if any).
>>> + ? ? [ ! -f "$i" ] && continue
>>> +
>>> + ? ? case "$i" in
>>> + ? ? ? *.sh)
>>> + ? ? ? ? ? # Source shell script for speed.
>>> + ? ? ? ? ? (
>>> + ? ? ? ? ? ? ? trap - INT QUIT TSTP
>>> + ? ? ? ? ? ? ? set stop
>>> + ? ? ? ? ? ? ? . $i
>>> + ? ? ? ? ? )
>>> + ? ? ? ? ? ;;
>>> + ? ? ? *)
>>> + ? ? ? ? ? # No sh extension, so fork subprocess.
>>> + ? ? ? ? ? $i stop
>>> + ? ? ? ? ? ;;
>>> + ? ?esac
>>> +done
>>> +
>>> diff --git a/fs/skeleton/etc/inittab b/fs/skeleton/etc/inittab
>>> index ac410d6..85881f4 100644
>>> --- a/fs/skeleton/etc/inittab
>>> +++ b/fs/skeleton/etc/inittab
>>> @@ -30,8 +30,7 @@ null::sysinit:/bin/hostname -F /etc/hostname
>>> ?::ctrlaltdel:/sbin/reboot
>>>
>>> ?# Stuff to do before rebooting
>>> -null::shutdown:/usr/bin/killall klogd
>>> -null::shutdown:/usr/bin/killall syslogd
>>> +null::shutdown:/etc/init.d/rcK
>>> ?null::shutdown:/bin/umount -a -r
>>> ?null::shutdown:/sbin/swapoff -a
>>
>> This is a different behavior now. Before only the logging daemons were
>> killed, now all init scripts are run.
>>
>> For this to work properly, all init scripts that users have in
>> /etc/init.d should actually have a stop() function. Since this
>> behavior was not required previously, I expect several users not to
>> have this.
>> For such users, a reboot would suddenly trigger several
>> initializations that are unexpected.
>
> I have to admit, I didn't think about in-the-wild users in such a case.
>
>> I think there are at least two solutions:
>> 1. Keep the new behavior created with this patch, but make sure that
>> the release notes clearly state this behavior change and update the
>> documentation.
>
> I hardly see how this is a new behaviour, every single init scripts we
> have already implements it, and we require it to.
IMO it's new behavior in the sense that the 'stop' function of these
scripts was never run by default, they weren't used.
So, users adding their own script may not have felt this was necessary.
(and admittedly, I am such a user :-) )
>
>> 2. Adapt the new behavior: currently you are following
>> /etc/init.d/Sxxxx files/links, while I think that the default policy
>> on many distributions is to use /etc/init.d/Kxxxx for shutdown (and
>> Sxxxx only for startup).
>
> The only one doing that I can think of is OpenWRT, it is barely many.
I was thinking of non-embedded distributions, for example RedHat.
>
>> In this scenario, users who have custom Sxxx
>> init scripts will not be impacted. Only if they choose to, can they
>> create appropriate Kxxxx links and provide stop functions.
>> For scripts present in the buildroot distribution, we can provide
>> appropriate S and K links immediately.
>
> You're right.
>
> I'm glad we can finally have that sort of discussion, I was starting to
> think every one had a dev/null rule for my patches.
I have thought that before, too :-)
>
> However, this touches the same area than my systemd patches, so I'd
> prefer not to touch the same area in every packages in such a small time
> frame. So maybe the easier way would be to merge such as mechanism with
> the init mechanism introduced with these patches.
Ok for me.
Best regards,
Thomas
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH] Rework of shutdown policy in inittab
2011-12-07 6:52 ` Thomas De Schampheleire
2011-12-07 7:26 ` Kelvin Cheung
2011-12-07 13:08 ` Maxime Ripard
@ 2011-12-14 16:46 ` Thomas Petazzoni
2011-12-15 8:44 ` Thomas De Schampheleire
2 siblings, 1 reply; 14+ messages in thread
From: Thomas Petazzoni @ 2011-12-14 16:46 UTC (permalink / raw)
To: buildroot
Le Wed, 7 Dec 2011 07:52:20 +0100,
Thomas De Schampheleire <patrickdepinguin+buildroot@gmail.com> a ?crit :
> I think there are at least two solutions:
> 1. Keep the new behavior created with this patch, but make sure that
> the release notes clearly state this behavior change and update the
> documentation.
I'd go for this one. All initscripts in Buildroot itself implement the
start/stop/restart logic, so author of scripts that haven't been
submitted upstream should have read this as a suggestion of following a
similar scheme.
> 2. Adapt the new behavior: currently you are following
> /etc/init.d/Sxxxx files/links, while I think that the default policy
> on many distributions is to use /etc/init.d/Kxxxx for shutdown (and
> Sxxxx only for startup). In this scenario, users who have custom Sxxx
> init scripts will not be impacted. Only if they choose to, can they
> create appropriate Kxxxx links and provide stop functions.
> For scripts present in the buildroot distribution, we can provide
> appropriate S and K links immediately.
IMO, it would be ugly to have Sxxfoobar be a regular file (the script
itself) and Kxxfoobar be a symbolic link. So it means that we would
have to change all all scripts to /etc/init.d/foobar, and then create
symbolic links Sxxfoobar and Kxxfoobar. That's an alternative solution,
certainly, but it triples the number of files/symlinks required.
Regards,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH] Rework of shutdown policy in inittab
2011-12-14 16:46 ` Thomas Petazzoni
@ 2011-12-15 8:44 ` Thomas De Schampheleire
2012-01-03 10:22 ` Maxime Ripard
0 siblings, 1 reply; 14+ messages in thread
From: Thomas De Schampheleire @ 2011-12-15 8:44 UTC (permalink / raw)
To: buildroot
On Wed, Dec 14, 2011 at 5:46 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Le Wed, 7 Dec 2011 07:52:20 +0100,
> Thomas De Schampheleire <patrickdepinguin+buildroot@gmail.com> a ?crit :
>
>> I think there are at least two solutions:
>> 1. Keep the new behavior created with this patch, but make sure that
>> the release notes clearly state this behavior change and update the
>> documentation.
>
> I'd go for this one. All initscripts in Buildroot itself implement the
> start/stop/restart logic, so author of scripts that haven't been
> submitted upstream should have read this as a suggestion of following a
> similar scheme.
No problem for me. I also think this is the best alternative.
>
>> 2. Adapt the new behavior: currently you are following
>> /etc/init.d/Sxxxx files/links, while I think that the default policy
>> on many distributions is to use /etc/init.d/Kxxxx for shutdown (and
>> Sxxxx only for startup). In this scenario, users who have custom Sxxx
>> init scripts will not be impacted. Only if they choose to, can they
>> create appropriate Kxxxx links and provide stop functions.
>> For scripts present in the buildroot distribution, we can provide
>> appropriate S and K links immediately.
>
> IMO, it would be ugly to have Sxxfoobar be a regular file (the script
> itself) and Kxxfoobar be a symbolic link. So it means that we would
> have to change all all scripts to /etc/init.d/foobar, and then create
> symbolic links Sxxfoobar and Kxxfoobar. That's an alternative solution,
> certainly, but it triples the number of files/symlinks required.
>
> Regards,
>
> Thomas
> --
> Thomas Petazzoni, Free Electrons
> Kernel, drivers, real-time and embedded Linux
> development, consulting, training and support.
> http://free-electrons.com
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH] Rework of shutdown policy in inittab
@ 2011-12-15 13:21 Sagaert Johan
2011-12-15 15:08 ` Thomas De Schampheleire
0 siblings, 1 reply; 14+ messages in thread
From: Sagaert Johan @ 2011-12-15 13:21 UTC (permalink / raw)
To: buildroot
Hi
I think for the majority of embedded systems the shutdown is performed by pulling the plug..
Regards,
Sagaert Johan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20111215/8871da51/attachment.html>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH] Rework of shutdown policy in inittab
2011-12-15 13:21 Sagaert Johan
@ 2011-12-15 15:08 ` Thomas De Schampheleire
0 siblings, 0 replies; 14+ messages in thread
From: Thomas De Schampheleire @ 2011-12-15 15:08 UTC (permalink / raw)
To: buildroot
On Thu, Dec 15, 2011 at 2:21 PM, Sagaert Johan <sagaert.johan@skynet.be> wrote:
> Hi
>
>
>
> I think for the majority of embedded systems? the shutdown is performed by
> pulling the plug?.
That really depends on the type of system.
Note also that the shutdown script is not only used for a real
shutdown, but also for a reboot.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH] Rework of shutdown policy in inittab
2011-12-15 8:44 ` Thomas De Schampheleire
@ 2012-01-03 10:22 ` Maxime Ripard
2012-01-03 10:48 ` Thomas De Schampheleire
0 siblings, 1 reply; 14+ messages in thread
From: Maxime Ripard @ 2012-01-03 10:22 UTC (permalink / raw)
To: buildroot
On 15/12/2011 09:44, Thomas De Schampheleire wrote:
> On Wed, Dec 14, 2011 at 5:46 PM, Thomas Petazzoni
> <thomas.petazzoni@free-electrons.com> wrote:
>> Le Wed, 7 Dec 2011 07:52:20 +0100,
>> Thomas De Schampheleire <patrickdepinguin+buildroot@gmail.com> a ?crit :
>>
>>> I think there are at least two solutions:
>>> 1. Keep the new behavior created with this patch, but make sure that
>>> the release notes clearly state this behavior change and update the
>>> documentation.
>>
>> I'd go for this one. All initscripts in Buildroot itself implement the
>> start/stop/restart logic, so author of scripts that haven't been
>> submitted upstream should have read this as a suggestion of following a
>> similar scheme.
>
> No problem for me. I also think this is the best alternative.
Then I guess we are all ok for it to be merged ? :)
--
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH] Rework of shutdown policy in inittab
2012-01-03 10:22 ` Maxime Ripard
@ 2012-01-03 10:48 ` Thomas De Schampheleire
0 siblings, 0 replies; 14+ messages in thread
From: Thomas De Schampheleire @ 2012-01-03 10:48 UTC (permalink / raw)
To: buildroot
On Tue, Jan 3, 2012 at 11:22 AM, Maxime Ripard <
maxime.ripard@free-electrons.com> wrote:
> On 15/12/2011 09:44, Thomas De Schampheleire wrote:
> > On Wed, Dec 14, 2011 at 5:46 PM, Thomas Petazzoni
> > <thomas.petazzoni@free-electrons.com> wrote:
> >> Le Wed, 7 Dec 2011 07:52:20 +0100,
> >> Thomas De Schampheleire <patrickdepinguin+buildroot@gmail.com> a ?crit
> :
> >>
> >>> I think there are at least two solutions:
> >>> 1. Keep the new behavior created with this patch, but make sure that
> >>> the release notes clearly state this behavior change and update the
> >>> documentation.
> >>
> >> I'd go for this one. All initscripts in Buildroot itself implement the
> >> start/stop/restart logic, so author of scripts that haven't been
> >> submitted upstream should have read this as a suggestion of following a
> >> similar scheme.
> >
> > No problem for me. I also think this is the best alternative.
>
> Then I guess we are all ok for it to be merged ? :)
>
I am, but I'd like to see something added to the documentation, or at least
a mention of this in the CHANGES file.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20120103/0d57aa49/attachment.html>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2012-01-03 10:48 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-02 12:25 [Buildroot] [PATCH] Rework of shutdown policy in inittab Maxime Ripard
2011-11-24 8:32 ` Maxime Ripard
2011-12-07 4:31 ` Kelvin Cheung
2011-12-07 6:52 ` Thomas De Schampheleire
2011-12-07 7:26 ` Kelvin Cheung
2011-12-07 9:50 ` Gustavo Zacarias
2011-12-07 13:08 ` Maxime Ripard
2011-12-08 9:33 ` Thomas De Schampheleire
2011-12-14 16:46 ` Thomas Petazzoni
2011-12-15 8:44 ` Thomas De Schampheleire
2012-01-03 10:22 ` Maxime Ripard
2012-01-03 10:48 ` Thomas De Schampheleire
-- strict thread matches above, loose matches on Subject: below --
2011-12-15 13:21 Sagaert Johan
2011-12-15 15:08 ` Thomas De Schampheleire
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox