4 DESCRIPTION="Setting up init..."
21 log_begin_msg "$DESCRIPTION"
23 # Arrange for shells on virtual consoles, rather than login prompts
25 if [ -n "$USERNAME" ]; then
26 if [ ! -z "${CASPERGETTY}" ]; then
27 # AUTOMATIC SERIAL CONSOLE #
28 defconsole=$(sed -e 's%.*console=%console=%' /proc/cmdline)
29 if echo "${defconsole}" | grep -qs console=ttyS; then
30 PORT=$(echo "${defconsole}" | \
31 sed -e's%^console=%%' -e's%,.*%%')
32 SPEED=$(echo "${defconsole}" | \
33 sed -e 's%^console=ttyS[0-9]\+,%%' \
34 -e's%\([0-9]\+\).*%\1%')
35 if ! ( sed -n -e'/^[^#]/p' /root/etc/inittab | grep -qs ":respawn:/sbin/getty.*${PORT}" ) ; then
36 IDs="A B C D E F G H I J K L M N O P Q R S T Q U V V X Y Z 0 1 2 3 4 5 6 7 8 9"
40 if ! grep "^${ID}:" /etc/inittab ; then
41 #make sure it is not already in use
46 echo "${ID}:2345:respawn:/sbin/casper-getty -L ${PORT} ${SPEED} vt100" \
51 if [ -f /root/etc/inittab ]; then
52 sed -i -e "s|^\([^:]*:[^:]*:[^:]*\):.*getty.*\<\(tty[0-9]*\).*$|\1:/bin/login -f $USERNAME </dev/\2 >/dev/\2 2>\&1|" /root/etc/inittab
54 if [ "/root/etc/event.d/tty*" != "$(echo /root/etc/event.d/tty*)" ]; then
55 for f in /root/etc/event.d/tty*; do
56 sed -i -e "s|^respawn.*|respawn /bin/login -f $USERNAME </dev/$(basename $f) > /dev/$(basename $f) 2>\&1|" $f
62 # This has the nice side effect of the cron.{daily,weekly,monthly} jobs in
63 # /etc/crontab remaining disabled, yet also not run by anacron
64 if [ -x /root/etc/init.d/anacron ]; then
65 for f in /root/etc/rc?.d/S??anacron; do
66 mv ${f} ${f%/*}/K00anacron
71 rm -f /root/etc/rc?.d/[SK]??postfix
73 # Avoid clobbering the user's clock
74 rm -f /root/etc/rc?.d/K??hwclock.sh
76 # Disable readahead since it doesn't play well with squashfs + unionfs
77 # use chmod instead of mv to not trigger unionfs bugs.
78 if [ -e /root/sbin/readahead-list ]; then
79 chmod -x /root/sbin/readahead-list