This file is indexed.

/lib/live/debconfig/0040-systemd 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
#!/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 /lib/systemd/systemd ]
then
	# System does not use systemd
	exit 0
fi

Defaults ()
{
	_LXC_ENABLE="${_LXC_ENABLE:-false}"
	_LXC_CONSOLES="${_LXC_CONSOLES:-6}"
	_LXC_DISABLE_SERVICES="${_LXC_DISABLE_SERVICES:-checkroot.service dev-hugepages.mount dev-mqueue.mount proc-sys-fs-binfmt_misc.automount remount-rootfs.service run-lock.mount run-user.mount swap.target sys-kernel-debug.mount sys-kernel-security.mount systemd-modules-load.service systemd-remount-api-vfs.service systemd-sysctl.service systemd-update-utmp-runlevel.service udev.service udev-settle.service udev-trigger.service user.mount var-lock.mount systemd-update-utmp-runlevel.service rescue.target}"
}

db_get live-debconfig/systemd/lxc-enable
_LXC_ENABLE="${RET}" # boolean

db_get live-debconfig/systemd/lxc-consoles
_LXC_CONSOLES="${RET}" # string (w/o empty)

db_get live-debconfig/systemd/lxc-disable-services
_LXC_DISABLE_SERVICES="${RET}" # string (w/o empty)

Defaults

db_set live-debconfig/systemd/lxc-enable "${_LXC_ENABLE}"
db_fset live-debconfig/systemd/lxc-enable seen false

db_set live-debconfig/systemd/lxc-consoles "${_LXC_CONSOLES}"
db_fset live-debconfig/systemd/lxc-consoles seen false

db_set live-debconfig/systemd/lxc-disable-services "${_LXC_DISABLE_SERVICES}"
db_fset live-debconfig/systemd/lxc-disable-services seen false

db_settitle live-debconfig/title
db_input high live-debconfig/systemd/lxc-enable || true
db_go

db_get live-debconfig/systemd/lxc-enable
_LXC_ENABLE="${RET}" # boolean

case "${_LXC_ENABLE}" in
	true)
		db_settitle live-debconfig/title
		db_input high live-debconfig/systemd/lxc-consoles || true
		db_go

		db_get live-debconfig/systemd/lxc-consoles
		_LXC_CONSOLES="${RET}" # string (w/o empty)

		db_get live-debconfig/systemd/lxc-disable-services
		_LXC_DISABLE_SERVICES="${RET}" # string (w/o empty)

		Defaults
		;;

	false)

		;;
esac

db_stop

# systemd starts counting consoles at 0, not 1 like sysvinit.
_LXC_CONSOLES="$((${_LXC_CONSOLES} - 1))"

case "${_LXC_ENABLE}" in
	true)
		# Disable sulogin
		ln -sf /dev/null /etc/systemd/system/console-shell.service

		# Disable ctrlaltdel
		ln -sf /dev/null /etc/systemd/system/ctrl-alt-del.target

		# Disable normal getty
		rm -f /etc/systemd/system/getty.target.wants/getty@*.service

		# Enable container getty
		sed -e 's|^ *BindTo=|#BindTo=|' /lib/systemd/system/getty@.service > /etc/systemd/system/getty.target.wants/getty@console.service

		for _CONSOLE in $(seq 0 ${_LXC_CONSOLES})
		do
			if [ -L /etc/systemd/system/getty.target.wants/getty@tty${_CONSOLE}.service ]
			then
				rm -f /etc/systemd/system/getty.target.wants/getty@tty${_CONSOLE}.service
			fi

			sed -e 's|^ *BindTo=|#BindTo=|' /lib/systemd/system/getty@.service > /etc/systemd/system/getty.target.wants/getty@tty${_CONSOLE}.service
		done

		# Enable powerfail for lxc-shutdown
		ln -sf /lib/systemd/system/reboot.target /etc/systemd/system/sigpwr.target

		# Disable default cpu and cpupacct
		grep -Eq '^ *JoinControllers=' /etc/systemd/system.conf || echo "JoinControllers=" >> /etc/systemd/system.conf

		sed -e 's|^ *JoinControllers=.*|JoinControllers=|' /etc/systemd/system.conf > /etc/systemd/system.conf.tmp
		mv /etc/systemd/system.conf.tmp /etc/systemd/system.conf

		# squeeze and newer have /dev/tty and /dev/tty0 by default
		for _CONSOLE in $(seq 0 ${_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
			systemctl mask ${_SERVICE}
		done

		# Disable setting CapabilityBoundingSet for journald
		sed -e 's/^ *CapabilityBoundingSet/\#&/' /lib/systemd/system/systemd-journald.service > /etc/systemd/system/systemd-journald.service
		;;

	false)
		# Reenable sulogin
		if [ -L /etc/systemd/system/console-shell.service ] && [ "$(readlink /etc/systemd/system/console-shell.service)" = "/dev/null" ]
		then
			rm -f /etc/systemd/system/console-shell.service
		fi

		# Reenable ctrlaltdel
		if [ -L /etc/systemd/system/ctrl-alt-del.target ] && [ "$(readlink /etc/systemd/system/ctrl-alt-del.target)" = "/dev/null" ]
		then
			rm -f /etc/systemd/system/ctrl-alt-del.target
		fi

		# Reenable normal getty
		rm -f /etc/systemd/system/getty.target.wants/getty@*.service
		ln -sf /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty1.service

		# Reenable powerfail for lxc-shutdown
		if [ -L /etc/systemd/system/sigpwr.target ] && [ "$(readlink /etc/systemd/system/sigpwr.target)" = "/lib/systemd/system/reboot.target" ]
		then
			rm -f /etc/systemd/system/sigpwr.target
		fi

		# Renable services
		for _SERVICE in ${_LXC_DISABLE_SERVICES}
		do
			systemctl unmask ${_SERVICE}
		done

		# Restore journald capabilities
		rm -f /etc/systemd/system/systemd-journald.service
		;;
esac