[BusyBox] awk problem with freeswan

Rob Landley rob at landley.net
Mon Jul 12 22:56:23 UTC 2004


Once again, this time copying the list.  (I mentioned having a cold?)


On Monday 12 July 2004 10:24, you wrote:

> Ah, I see it now. We have a misunderstanding here.

Sorry.  As I said, I have a cold.  I'm a bit grumpy at present...

> I do not say that you shouldn't have 'shutdown','halt' commands etc.
> I say that those commands can be perfectly written in sh. You
> do not need to write busybox applet for that.

I'm not convinced a shell script would be less complex than a busybox applet.  
Considering that you need a C command to call the actual shutdown (and you 
have two: ctrlaltdel and hardshutdown, plus shell scripts to drive them...)

> busybox needs to have only a tiny 'hardshutdown' applet which
> does the only thing not doable from sh: call shutdown syscall.

It currently has two: poweroff and reboot.  (They don't always _work_, due to 
the logic of sometimes calling reboot() directly and sometimes calling init, 
and communication with init being somehow horked on my test system in a way 
I'll worry about after I finish rewriting init, meaning after I get over this 
darn cold...)

> In 'shutdown' script, after you are done with killing processes and
> unmounting filesystems, etc, you just call bb's hardshutdown.

That's init's job.

Even if you use a lobotomized init, you have to stop it from spawining more of 
the processes you're killing, and if you just naievely manage to kill it the 
system panics because init should never die, so you wind up coordinating with 
it, and by that point you might as well just have init do its job and shut 
down the system for you anyway.

That's my theory of operation on the thing, anyway.

> I will attach my in-house version of these scripts.
> Note that they are hardwired to be in /app/shutdown-0.0.6
> directory, grep for that string and modify as you need.

Thanks.  Looking through it's informative, but it just reaffirms my tendency 
not to want to go there.  (My little test system doesn't have setsid because 
I use busybox instead of util-linux.  I don't have a stop_storage script 
because I expect busybox's "umount -a" command to work, especially with 
/etc/mtab as a symlink to /proc/mounts.  I don't know why you have a 
"killall5" command instead of killall.  And you have a lot of workarounds for 
things like your shell pinning /usr, stop_tasks interacting badly with init.  
And having shutdown call do_shutdown calling ctrlaltdel, calling hardshutdown 
(and a few other scripts along the way)...

I'm going for simplicity, more than size.  Shutdown only has two extra bits of 
complexity over poweroff and reboot: 1) parsing a command line argument to 
figure out if you want to halt, reboot, or sleep, and 2) the timer thing, and 
I can just have init fork and daemonize if necessary, and then have the -c 
option call killall.

Heck, for the first version I can have it assume "now" no matter what you 
type, and worry about the timer later.  And the broadcast message isn't 
really a requirement either (if we haven't got a "wall" command, then we 
don't need it.  If busybox sprouts a "wall" command, I'll make shutdown use 
it...)

> shutdown -r -- kill/umount adn execute reboot syscall
> shutdown -h -- kill/umount adn execute halt syscall
>       (this is typically the same as shutdown without options,
>       maybe other arches drop in firmware monitor ot something
>       like that on halt, but not x86)
> shutdown -p -- kill/umount adn execute poweroff syscall

I've never heard of shutdown -p, instead shutdown -h powers the system off if 
it's capable of it on all the ones I'm familiar with.  (What's the 
alternative; the system becomes a brick but stays on?  It would be nice to 
find a standard for this...)

shutdown -z triggers software suspend on systems that support it (it's just 
one more magic constant, I don't intend to make it a config option except 
possibly an #ifdef to see if the constant's defined in the system headers...)

Rob

-- 
www.linucon.org: Linux Expo and Science Fiction Convention
October 8-10, 2004 in Austin Texas.  (I'm the con chair.)




More information about the busybox mailing list