# Runlevels
user = alsa keymap polipo spam
system = at cron hddtemp hostname hwclock i8k sshd swap syslog
-bare = cpufreq fsclean getty localhost modules mounts uevents utmp
+bare = cpufreq fsclean getty qingy localhost modules mounts uevents utmp
default:V: user
Options:
-h,--help Print usage information
+ -r,--relaod Prevent spawning listeners when reloading
-t,--test Fake all commands
Command:
if [ ! "$RELOAD" ]; then
# Fork /dev/initctl listener
+ ( exec 0<&- 1<&- 2<&-
initctld $INITCTL |
while read line; do
echo $line > $CMD
- done &
+ done ) &
# Fork console listener
- while read -e -p "mkinit> " line; do
- echo $line > $CMD
- history -s $line
- done <&0 &
+ # Readline uses stdin,stderr
+ ( exec 1<&-;
+ while true; do
+ while read -e -p "mkinit> " line; do
+ echo $line > $CMD
+ history -s $line
+ done
+ [ "$TEST" ] && break
+ exec 0</dev/console 2>/dev/console
+ echo "Respawning on /dev/console.." >&2
+ sleep 1
+ done) <&0 &
+
+ # Close stdin, stderr
+ exec 0<&- 2<&-
fi
# Kill listeners on exit
# Main loop
while true; do
-while line=$(line); do
+while read line; do
process $line
done < $CMD
done