This file is indexed.

/lib/live/config/1140-xserver-xorg is in open-infrastructure-system-config 20161101-lts1-2.

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
#!/bin/sh

## live-config(7) - System Configuration Components
## Copyright (C) 2006-2015 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

Cmdline ()
{
	for _PARAMETER in ${LIVE_CONFIG_CMDLINE}
	do
		case "${_PARAMETER}" in
			live-config.keyboard-layouts=*|keyboard-layouts=*)
				LIVE_KEYBOARD_LAYOUTS="${_PARAMETER#*keyboard-layouts=}"
				;;

			live-config.keyboard-model=*|keyboard-model=*)
				LIVE_KEYBOARD_MODEL="${_PARAMETER#*keyboard-model=}"
				;;

			live-config.keyboard-options=*|keyboard-options=*)
				LIVE_KEYBOARD_OPTIONS="${_PARAMETER#*keyboard-options=}"
				;;

			live-config.keyboard-variants=*|keyboard-variants=*)
				LIVE_KEYBOARD_VARIANTS="${_PARAMETER#*keyboard-variants=}"
				;;

			live-config.xorg-xsession-manager=*|x-session-manager=*)
				LIVE_X_SESSION_MANAGER="${_PARAMETER#*x-session-manager=}"
				;;

			live-config.xorg-driver=*|xorg-driver=*)
				LIVE_XORG_DRIVER="${_PARAMETER#*xorg-driver=}"
				;;

			live-config.xorg-resolution=*|xorg-resolution=*)
				LIVE_XORG_RESOLUTION="${_PARAMETER#*xorg-resolution=}"
				;;
		esac
	done
}

Init ()
{
	# Checking if package is installed
	if [ ! -e /var/lib/dpkg/info/xserver-xorg.list ] || \
	   [ -e /var/lib/live/config/xserver-xorg ]
	then
		exit 0
	fi

	echo -n " xserver-xorg"
}

Config ()
{
	if [ -n "${LIVE_KEYBOARD_MODEL}" ]
	then
		echo "xserver-xorg xserver-xorg/config/inputdevice/keyboard/model select ${LIVE_KEYBOARD_MODEL}" >> /tmp/live-config.cfg
	fi

	if [ -n "${LIVE_KEYBOARD_LAYOUTS}" ]
	then
		echo "xserver-xorg xserver-xorg/config/inputdevice/keyboard/layout select ${LIVE_KEYBOARD_LAYOUTS}" >> /tmp/live-config.cfg
	fi

	if [ -n "${LIVE_KEYBOARD_VARIANTS}" ]
	then
		echo "xserver-xorg xserver-xorg/config/inputdevice/keyboard/variant select ${LIVE_KEYBOARD_VARIANTS}" >> /tmp/live-config.cfg
	fi

	if [ -n "${LIVE_KEYBOARD_OPTIONS}" ]
	then
		echo "xserver-xorg xserver-xorg/config/inputdevice/keyboard/options string ${LIVE_KEYBOARD_OPTIONS}" >> /tmp/live-config.cfg
	fi

	if [ -n "${LIVE_X_SESSION_MANAGER}" ]
	then
		case "${LIVE_X_SESSION_MANAGER}" in
			none)
				_DM_FILE="/etc/X11/default-display-manager"
				if [ -e "${_DM_FILE}" ]
				then
					sed -i "s|\(.*\)|\1 # disabled by live-config:|" -- "${_DM_FILE}"
				fi
				;;

			*)
				update-alternatives --quiet --set x-session-manager "${LIVE_X_SESSION_MANAGER}"
				;;
		esac
	fi

	if [ -z "${LIVE_XORG_DRIVER}" ] && [ -e /usr/bin/lspci ]
	then
		# pci-id of the first graphic card
		_DEVICE="$(lspci -mn | awk '/0300/ { print $3$4 }' | sed -e 's|\"||g' | tr [a-z] [A-Z] | head -n1)"

		if [ -n "${_DEVICE}" ]
		then
			if ls /usr/share/live/config/xserver-xorg/*.ids > /dev/null 2>&1
			then
				# xorg-driver manual overrides
				for _OVERRIDE_IDS in /usr/share/live/config/xserver-xorg/*.ids
				do
					if [ -e "${_OVERRIDE_IDS}" ]
					then
						if grep -qs "${_DEVICE}" "${_OVERRIDE_IDS}"
						then
							LIVE_XORG_DRIVER="$(basename ${_OVERRIDE_IDS} .ids)"

							break
						fi
					fi
				done
			fi

			if [ -z "${LIVE_XORG_DRIVER}" ]
			then
				# xorg-driver automatic override for virtualbox
				if [ -e /var/lib/dpkg/info/virtualbox-guest-x11.list ] && echo "${_DEVICE}" | grep -qs '^80EEBEEF'
				then
					LIVE_XORG_DRIVER="vboxvideo"
				fi

				# xorg-driver automatic override for fglrx
				if echo "${_DEVICE}" | grep -qs '^1002'
				then
					if grep -qs "${_DEVICE}" /usr/share/fglrx/fglrx.ids
					then
						LIVE_XORG_DRIVER="fglrx"
					fi
				fi

				# xorg-driver automatic override for nvidia
				if echo "${_DEVICE}" | grep -qs -E '^(10DE|12D2)'
				then
					for _NVIDIA_IDS in /usr/lib/nvidia/current/nvidia.ids $(ls /usr/lib/nvidia/legacy-*/nvidia.ids | sort -V -r)
					do
						if [ -e "${_NVIDIA_IDS}" ]
						then
							if grep -qs "${_DEVICE}" ${_NVIDIA_IDS}
							then
								_NVIDIA_VERSION="$(basename $(dirname ${_NVIDIA_IDS}))"
								_NVIDIA_MODULE="$(echo nvidia-${_NVIDIA_VERSION} | sed -e 's|-current$||')"

								break
							fi
						fi
					done

					if [ -n "${_NVIDIA_VERSION}" ]
					then
						LIVE_XORG_DRIVER="nvidia"
					fi
				fi
			fi
		fi
	fi

	if [ -n "${LIVE_XORG_DRIVER}" ]
	then
		mkdir -p /etc/X11/xorg.conf.d

		if [ -e "/usr/share/live/config/xserver-xorg/${LIVE_XORG_DRIVER}.conf" ]
		then
			# xorg-driver manual override
			cp "/usr/share/live/config/xserver-xorg/${LIVE_XORG_DRIVER}.conf" /etc/X11/xorg.conf.d/zz-live-config_xserver-xorg.conf
		else

			# xorg-driver automatic override

cat > /etc/X11/xorg.conf.d/zz-live-config_xserver-xorg.conf << EOF
Section "Device"
	Identifier	"Default screen"
	Driver		"${LIVE_XORG_DRIVER}"
EndSection
EOF

		fi

		case "${LIVE_XORG_DRIVER}" in
			fglrx)
				update-alternatives --quiet --set glx /usr/lib/fglrx

				modprobe --ignore-install fglrx || true
				;;

			nvidia)
				update-alternatives --quiet --set glx /usr/lib/nvidia
				update-alternatives --quiet --set nvidia /usr/lib/nvidia/${_NVIDIA_VERSION:-current}

				modprobe --ignore-install ${_NVIDIA_MODULE:-nvidia} || true
				;;

			*)
				update-alternatives --quiet --set glx /usr/lib/mesa-diverted
				;;
		esac
	fi

	if [ -n "${LIVE_XORG_RESOLUTION}" ]
	then
		echo "xrandr -s ${LIVE_XORG_RESOLUTION} || /bin/true" >> /etc/X11/Xsession.d/21xvidemode
	else
		rm -f /etc/X11/Xsession.d/21xvidemode
	fi

	if [ -e /tmp/live-config.cfg ]
	then
		debconf-set-selections < /tmp/live-config.cfg
		rm -f /tmp/live-config.cfg

		dpkg-reconfigure -f noninteractive -p critical \
			xserver-xorg 2>&1 \
			| grep -v "overwriting possibly-customised configuration" \
			| grep -v "file; backup in /etc/X11/xorg.conf" || true

		# Creating state file
		touch /var/lib/live/config/xserver-xorg
	fi
}

Cmdline
Init
Config