[PATCH] halt: add option to call telinit when using external init

Alexander Shishkin virtuoso at slind.org
Sat Jul 25 09:07:39 UTC 2009


2009/7/25 Denys Vlasenko <vda.linux at googlemail.com>:
> On Tuesday 21 July 2009 23:31, Alexander Shishkin wrote:
>> In case our init is not a busybox applet, but an external program
>> like SysV init or upstart, we'd want to be able to call telinit
>> (or somesuch) to switch to an appropriate runlevel instead of
>> simply rebooting (or otherwise shutting down).
>
> I am torn on this.
>
> Can't it be achieved much simpler, e.g.
>
> /bin/reboot:
>
> #!/bin/sh
> test x"$1" = x"-f" && /bin/busybox reboot "$@"
> exec telinit 6
>
> ?

Of course it could, but let's see: we compile busybox with halt
applets, then we manually replace reboot/poweroff symlinks with crude
shell hacks for the sheer joy of not applying a trivial patch that
fits in perfectly?

Come to think of it, 9/10 of busybox functionality could be
implemented in shell, however, it's not and having a trivial patch in
is actually loads simpler than having to maintain half arsed scripts
that try to deal with command line options for applets.
Which reminds me, btw, why is this not done the same _simpler_ way you
suggest for the -i option of reboot?

Regards,
--
Alex


More information about the busybox mailing list