Dropping /etc/live.conf, replaced mostly by /etc/live/config.conf of live-config.
[debian-live-boot/hramrach.git] / scripts / live-bottom / 25configure_init
blobb82d2aab98b460f1db6a36e446e11c72684d618f
1 #!/bin/sh
3 #set -e
5 # initramfs-tools header
7 PREREQ=""
9 prereqs()
11 echo "${PREREQ}"
14 case "${1}" in
15 prereqs)
16 prereqs
17 exit 0
19 esac
21 # live-boot header
23 . /scripts/live-functions
25 log_begin_msg "Setting up init"
27 # live-boot script
29 # Arrange for shells on virtual consoles, rather than login prompts
31 USERNAME="user"
33 if [ -z "${NOAUTOLOGIN}" ] && [ -n "${USERNAME}" ]
34 then
35 if [ ! -z "${LIVE_GETTY}" ]
36 then
37 if echo "${DEFCONSOLE}" | grep -qs ttyS
38 then
39 # AUTOMATIC SERIAL CONSOLE #
40 PORT=$(echo "${DEFCONSOLE}" | \
41 sed -e 's%,.*%%')
42 SPEED=$(echo "${DEFCONSOLE}" | \
43 sed -e 's%ttyS[0-9]\+,%%' \
44 -e's%\([0-9]\+\).*%\1%')
46 if ! ( sed -n -e'/^[^#]/p' /root/etc/inittab | grep -qs ":respawn:/sbin/getty.*${PORT}" )
47 then
48 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"
50 for ID1 in ${IDs}
52 for ID2 in ${IDs}
54 ID="${ID1}${ID2}"
56 if ! grep "^${ID}:" /etc/inittab
57 then
58 #make sure it is not already in use
59 break 2
61 done
62 done
64 echo "${ID}:2345:respawn:/sbin/live-getty -L ${PORT} ${SPEED} vt100" >> /root/etc/inittab
68 if [ -f /root/etc/inittab ]
69 then
70 sed -i -e'/^[^#]/s%respawn:/sbin/getty%respawn:/sbin/live-getty%' /root/etc/inittab
72 else
73 if [ -f /root/etc/inittab ]
74 then
75 sed -i -e "s|^\([^:]*:[^:]*:[^:]*\):.*getty.*\<\(tty[0-9]*\).*$|\1:/bin/login -f ${USERNAME} </dev/\2 >/dev/\2 2>\&1|" /root/etc/inittab
78 if [ "/root/etc/init/tty*" != "$(echo /root/etc/init/tty*)" ]
79 then
80 for f in /root/etc/init/tty*
82 sed -i -e "s|^exec.*|exec /bin/login -f $USERNAME </dev/$(basename $f .conf) > /dev/$(basename $f .conf) 2>\&1|" $f
83 done
87 # Since we use autologin, lastlog doesn't make sense on the console.
88 sed -i '/^[^#].*pam_lastlog\.so/s/^/# /' /root/etc/pam.d/login
91 # do not try to remove files if using file-rc
92 if [ -d /root/etc/rc0.d ]
93 then
94 # This has the nice side effect of the cron.{daily,weekly,monthly} jobs in
95 # /etc/crontab remaining disabled, yet also not run by anacron
96 if [ -x /root/usr/sbin/anacron ]
97 then
98 chroot /root dpkg-divert --add --rename --quiet /usr/sbin/anacron
99 ln -s /bin/true /root/usr/sbin/anacron
102 # Avoid clobbering the user's clock
103 rm -f /root/etc/rc?.d/K??hwclock.sh /root/etc/init/hwclock-save.conf
106 # Disable readahead since it doesn't play well with squashfs + unionfs
107 # use chmod instead of mv to not trigger unionfs bugs.
108 if [ -e /root/sbin/readahead-list ]
109 then
110 chmod -x /root/sbin/readahead-list
113 # Disable ureadahead too since we don't ship a pack file for it anyway, so
114 # all we'll end up doing is profiling the live CD boot. ureadahead also
115 # breaks partman occasionally by reading from its synchronisation FIFOs.
116 rm -f /root/etc/init/ureadahead.conf
118 log_end_msg
120 exit 0