[BusyBox] interactive script at shutdown, inittab
Karsten Kruse
tecneeq at gmx.net
Sat Oct 25 10:55:17 MDT 2003
Hi,
i made two floppys to boot linux. Everything works fine, except my
inittab. I use latest uClibc and busybox 1.something-pre3.
I want to let the user make some changes to a file at boottime. The system
reads ip, keymap and such things from that file. I thought it might handy
to save that file to read it at next boot again.
To let the user make the changes i present a menu at boottime that asks if
he would like to edit the file with vi or load a previously edited file.
He does that and gets the login. Works fine.
At shutdown i want to ask the user if he wants to save the changes to that
file, for that i wrote a small shell-script:
#!/bin/sh
cnf_halt_done=0
until [ $cnf_halt_done = 1 ] ; do
echo "Do you want to save your current configuration to floppy so you"
echo "can restore it when you boot the next time?"
echo ""
echo " 1 -> Save configuration to Bootfloppy"
echo " 2 -> Skip that"
echo ""
read -p "Choose a number: " reply
case $reply in
1) /usr/sbin/modules/sys_conf_save && cnf_halt_done=1 ;;
2) cnf_halt_done=1 ;;
*) cnf_halt_done=0 ;;
esac
done
This is what i have in my inittab:
# To do before rebooting
::shutdown:/sbin/rcS stop
[...]
/sbin/rcS calls "/etc/init.d/system stop", that calls
/usr/sbin/modules/cnf_halt.
Now, if the user types his choice he gets:
-sh 1: command not found. Of course, the user is still logged in, so his
tty grabs the 1, not /dev/console.
Any idea how i can cleanly logout all users before i call the script?
Karsten
--
Homepage, Mac68k, A/UX-Links und Shorties: www.tecneeq.de
() Linux/NetBSD-Anleitungen, Forum und Chat: www.newbie-net.de
<\/>
_/\_ When you are in it up to your ears, keep your mouth shut.
More information about the busybox
mailing list