moth/sh4pwn/skeleton/sbin/init

56 lines
1.2 KiB
Plaintext
Raw Normal View History

2011-10-11 15:38:34 -06:00
#! /bin/sh
loudmount () {
echo -n " $3"
mount -t $1 $2 $3
}
sysctl () {
echo $2 > /proc/sys/$1
}
if [ $$ -ne 1 ]; then
echo "Perhaps you wanted poweroff, reboot, or halt?"
exit
fi
echo -n "Mounting filesystems:"
loudmount proc proc /proc
loudmount sysfs sys /sys
loudmount tmpfs dev /dev
/sbin/mdev -s
mkdir /dev/pts
loudmount devpts pts /dev/pts
loudmount tmpfs tmp /tmp
loudmount tmpfs mnt /mnt
echo "."
if grep -q noinit /proc/cmdline; then
exec /bin/sh
fi
echo -n "Setting kernel parameters..."
sysctl kernel/hotplug /sbin/mdev
sysctl kernel/randomize_va_space 2
sysctl kernel/hostname dbtl
sysctl kernel/ctrl-alt-del 0
sysctl net/ipv4/tcp_syncookies 1
echo " done."
echo -n "Setting up /service..."
if ! mkrw /service; then
echo " failed! How embarassing!"
echo
echo "Er, sorry about that. Here's a shell, hopefully you"
echo "can sort things out. The machine will reboot when this shell"
echo "exits."
/bin/sh
busybox reboot -f
fi
echo " done."
## Hand off to runit
exec runsvdir -P -s /sbin/runit-signal /service \
'log: ....................................................................................................................................'