5 # initramfs-tools header
21 # live-initramfs header
23 . /scripts/live-functions
25 log_begin_msg "Setting up init..."
27 # live-initramfs script
29 # Arrange for shells on virtual consoles, rather than login prompts
31 if [ -z "${NOAUTOLOGIN}" ]
34 if [ -n "$USERNAME" ]; then
35 if [ ! -z "${LIVE_GETTY}" ]; then
36 if echo "${DEFCONSOLE}" | grep -qs ttyS; then
37 # AUTOMATIC SERIAL CONSOLE #
38 PORT=$(echo "${DEFCONSOLE}" | \
40 SPEED=$(echo "${DEFCONSOLE}" | \
41 sed -e 's%ttyS[0-9]\+,%%' \
42 -e's%\([0-9]\+\).*%\1%')
43 if ! ( sed -n -e'/^[^#]/p' /root/etc/inittab | grep -qs ":respawn:/sbin/getty.*${PORT}" ) ; then
44 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"
48 if ! grep "^${ID}:" /etc/inittab ; then
49 #make sure it is not already in use
54 echo "${ID}:2345:respawn:/sbin/live-getty -L ${PORT} ${SPEED} vt100" \
58 if [ -f /root/etc/inittab ]; then
59 sed -i -e'/^[^#]/s%respawn:/sbin/getty%respawn:/sbin/live-getty%' /root/etc/inittab
62 if [ -f /root/etc/inittab ]; then
63 sed -i -e "s|^\([^:]*:[^:]*:[^:]*\):.*getty.*\<\(tty[0-9]*\).*$|\1:/bin/login -f $USERNAME </dev/\2 >/dev/\2 2>\&1|" /root/etc/inittab
65 if [ "/root/etc/event.d/tty*" != "$(echo /root/etc/event.d/tty*)" ]; then
66 for f in /root/etc/event.d/tty*; do
67 sed -i -e "s|^respawn.*|respawn /bin/login -f $USERNAME </dev/$(basename $f) > /dev/$(basename $f) 2>\&1|" $f
70 if [ "${BUILD_SYSTEM}" = "Ubuntu" ]; then
71 for x in $(cat /proc/cmdline); do
74 sed -i -e "s|^exec.*|exec /usr/bin/ubiquity noninteractive </dev/tty1 > /dev/tty1 2>\&1|" /root/etc/event.d/tty1
75 rm -f /root/etc/rc?.d/[SK]??gdm
76 rm -f /root/etc/rc?.d/[SK]??kdm
84 # Since we use autologin, lastlog doesn't make sense on the console.
85 sed -i '/^[^#].*pam_lastlog\.so/s/^/# /' /root/etc/pam.d/login
90 # This has the nice side effect of the cron.{daily,weekly,monthly} jobs in
91 # /etc/crontab remaining disabled, yet also not run by anacron
92 if [ -x /root/etc/init.d/anacron ]; then
93 for f in /root/etc/rc?.d/S??anacron; do
94 mv ${f} ${f%/*}/K00anacron
99 rm -f /root/etc/rc?.d/[SK]??postfix
101 # Avoid clobbering the user's clock
102 rm -f /root/etc/rc?.d/K??hwclock.sh
104 # Disable readahead since it doesn't play well with squashfs + unionfs
105 # use chmod instead of mv to not trigger unionfs bugs.
106 if [ -e /root/sbin/readahead-list ]; then
107 chmod -x /root/sbin/readahead-list