/lib/live/debconfig/0050-sysvinit is in live-debconfig 4.0~alpha31-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | #!/bin/sh
## live-debconfig(7) - System Configuration Components
## Copyright (C) 2006-2013 Daniel Baumann <mail@daniel-baumann.ch>
##
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.
set -e
DEBCONF_SYSTEMRC="/var/lib/live/debconfig/systemrc"
export DEBCONF_SYSTEMRC
. /usr/share/debconf/confmodule
if [ ! -e /usr/share/sysvinit/inittab ]
then
# System does not use sysvinit
exit 0
fi
Defaults ()
{
_LXC_ENABLE="${_LXC_ENABLE:-false}"
_LXC_CONSOLES="${_LXC_CONSOLES:-6}"
_LXC_DISABLE_SERVICES="${_LXC_DISABLE_SERVICES:-checkroot.sh hwclockfirst.sh hwclock.sh kmod module-init-tools mountall.sh mountkernfs.sh umountfs umountroot}"
}
db_get live-debconfig/sysvinit/lxc-enable
_LXC_ENABLE="${RET}" # boolean
db_get live-debconfig/sysvinit/lxc-consoles
_LXC_CONSOLES="${RET}" # string (w/o empty)
db_get live-debconfig/sysvinit/lxc-disable-services
_LXC_DISABLE_SERVICES="${RET}" # string (w/o empty)
Defaults
db_set live-debconfig/sysvinit/lxc-enable "${_LXC_ENABLE}"
db_fset live-debconfig/sysvinit/lxc-enable seen false
db_set live-debconfig/sysvinit/lxc-consoles "${_LXC_CONSOLES}"
db_fset live-debconfig/sysvinit/lxc-consoles seen false
db_set live-debconfig/sysvinit/lxc-disable-services "${_LXC_DISABLE_SERVICES}"
db_fset live-debconfig/sysvinit/lxc-disable-services seen false
db_settitle live-debconfig/title
db_input high live-debconfig/sysvinit/lxc-enable || true
db_go
db_get live-debconfig/sysvinit/lxc-enable
_LXC_ENABLE="${RET}" # boolean
case "${_LXC_ENABLE}" in
true)
db_settitle live-debconfig/title
db_input high live-debconfig/sysvinit/lxc-consoles || true
db_go
db_settitle live-debconfig/title
db_input high live-debconfig/sysvinit/lxc-disable-services || true
db_go
db_get live-debconfig/sysvinit/lxc-consoles
_LXC_CONSOLES="${RET}" # string (w/o empty)
db_get live-debconfig/sysvinit/lxc-disable-services
_LXC_DISABLE_SERVICES="${RET}" # string (w/o empty)
Defaults
;;
false)
;;
esac
db_stop
case "${_LXC_ENABLE}" in
true)
# Revert /etc/inittab
cp -p /usr/share/sysvinit/inittab /etc/inittab.tmp
# Disable sulogin
# ~~:S:wait:/sbin/sulogin
sed -i -e 's|\(^[^#].*S:wait:.*$\)|#\1|' /etc/inittab.tmp
# Disable ctrlaltdel
# ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
sed -i -e 's|\(^[^#].*:ctrlaltdel:.*$\)|#\1|' /etc/inittab.tmp
# Disable power
# pf::powerwait:/etc/init.d/powerfail start
# pn::powerfailnow:/etc/init.d/powerfail now
# po::powerokwait:/etc/init.d/powerfail stop
sed -i -e 's|\(^[^#].*:power.*:.*$\)|#\1|' /etc/inittab.tmp
# Disable normal getty
# 1:2345:respawn:/sbin/getty 38400 tty1
# 2:23:respawn:/sbin/getty 38400 tty2
# 3:23:respawn:/sbin/getty 38400 tty3
# ...
# Keep container getty
# 1:2345:respawn:/sbin/getty 38400 console
# c1:23:respawn:/sbin/getty 38400 tty1
# c2:23:respawn:/sbin/getty 38400 tty2
# ...
sed -i -e 's|\(^[^#,^c].*:respawn:/sbin/getty.*[^console,linux]$\)|#\1|' /etc/inittab.tmp
# Enable container getty
# 1:2345:respawn:/sbin/getty 38400 console
# c1:23:respawn:/sbin/getty 38400 tty1
# c2:23:respawn:/sbin/getty 38400 tty2
if [ -e /etc/progress-linux_version ]
then
_OPTIONS="--nohostname 38400"
else
_OPTIONS="38400"
fi
# Assemble new entries
_CONSOLES="\n#-- live-debconfig begin\n1:2345:respawn:/sbin/getty ${_OPTIONS} console"
for _CONSOLE in $(seq 1 ${_LXC_CONSOLES})
do
_CONSOLES="${_CONSOLES}\nc${_CONSOLE}:12345:respawn:/sbin/getty ${_OPTIONS} tty${_CONSOLE} linux"
done
_CONSOLES="${_CONSOLES}\n#-- live-debconfig end"
# Remove old entries
sed -i -e '/#-- live-debconfig begin/,/#-- live-debconfig end/d' /etc/inittab.tmp
# Add new entries
_CONSOLE="$(grep '#[0-9].*:respawn:/sbin/getty' /etc/inittab.tmp | tail -1)"
sed -i -e "s|\(${_CONSOLE}\)|\1${_CONSOLES}|" /etc/inittab.tmp
# Enable powerfail entries for lxc-shutdown
if ! grep -qs ^p0:: /etc/inittab.tmp
then
echo "p0::powerfail:/sbin/init 0" >> /etc/inittab.tmp
fi
if ! grep -qs ^p6:: /etc/inittab.tmp
then
echo "p6::ctrlaltdel:/sbin/init 6" >> /etc/inittab.tmp
fi
mv /etc/inittab.tmp /etc/inittab
# squeeze and newer have /dev/tty and /dev/tty0 by default
for _CONSOLE in $(seq 1 ${_LXC_CONSOLES})
do
if [ ! -e "/dev/tty${_CONSOLE}" ]
then
mknod "/dev/tty${_CONSOLE}" c 4 "${_CONSOLE}"
fi
done
# Remove uneeded services in a container
for _SERVICE in ${_LXC_DISABLE_SERVICES}
do
# service does not exist
if [ ! -e /etc/init.d/${_SERVICE} ]
then
continue
fi
_ALREADY_DISABLED="false"
# service is already disabled
for _RUNLEVEL in /etc/rc*.d
do
if ! ls ${_RUNLEVEL}/K*${_SERVICE} > /dev/null 2>&1
then
# disabled services have stop links in all runlevels
# if at least one runlevel does not have a stop link,
# then the service was not disabled and we need to continue
# with disabling the service later on
_ALREADY_DISABLED="false"
break
fi
# service is indeed already disabled
_ALREADY_DISABLED="true"
done
if [ "${_ALREADY_DISABLED}" = "false" ]
then
if ls /etc/rc*.d/K*${_SERVICE} > /dev/null 2>&1 && \
! ls /etc/rc*.d/S*${_SERVICE} > /dev/null 2>&1
then
# service has only stop links
# therefore, using 'update-rc.d disable' does not work,
# and using 'update-rc.d remove' is not upgrade safe
# (on upgrades, the stop links would be re-added).
for _SYMLINK in /etc/rc*.d/K*${_SERVICE}
do
rm -f ${_SYMLINK}
ln -s /bin/live-initscripts-empty-stop ${_SYMLINK}
done
fi
# service is a normal service with both start and stop links
update-rc.d -f ${_SERVICE} disable 2>&1 | \
grep -v -e "^insserv: warning:" \
-e "^update-rc.d: warning:" \
-e "^update-rc.d: using dependency based boot sequencing" \
-e "^update-rc.d: error: .* Default-Start contains no runlevels, aborting." \
|| true
fi
done
;;
false)
# Revert /etc/inittab
cp -p /usr/share/sysvinit/inittab /etc/inittab
# Renable services
for _SERVICE in ${_LXC_DISABLE_SERVICES}
do
if [ -e "/etc/init.d/${_SERVICE}" ]
then
rm -f /etc/rc*.d/S*${_SERVICE}
rm -f /etc/rc*.d/K*${_SERVICE}
update-rc.d -f ${_SERVICE} defaults 2>&1 | \
grep -v -e "^insserv: warning:" \
-e "^update-rc.d: warning:" \
-e "^update-rc.d: using dependency based boot sequencing" \
-e "^update-rc.d: error: .* Default-Start contains no runlevels, aborting." \
|| true
fi
done
;;
esac
|