Fix check for X.org.
[live-boot-grml.git] / scripts / live-bottom / 20xconfig
1 #!/bin/sh
2
3 #set -e
4
5 # initramfs-tools header
6
7 PREREQ=""
8
9 prereqs()
10 {
11         echo "${PREREQ}"
12 }
13
14 case "${1}" in
15         prereqs)
16                 prereqs
17                 exit 0
18                 ;;
19 esac
20
21 # live-initramfs header
22
23 if [ -n "${NOXAUTOCONFIG}" ]
24 then
25         exit 0
26 fi
27
28 . /scripts/live-functions
29
30 # live-initramfs script
31
32 if [ "${TERM_TYPE}" = "serial" ]
33 then
34         # Don't bother trying to configure or start X on a serial console
35         rm -f /root/etc/rc?.d/S??[gkx]dm
36         exit 0
37 fi
38
39 if [ -n "${TEXTONLY}" ]
40 then
41         exit 0
42 fi
43
44 if [ ! -x /root/usr/bin/X ]
45 then
46         exit 0
47 fi
48
49 log_begin_msg "Configuring X"
50
51 locale=en_US.UTF-8
52
53 mount -n -o bind /sys /root/sys
54 mount -n -o bind /proc /root/proc
55 mount -n -o bind /dev /root/dev
56
57 if [ -n "${XDEBCONF}" -a -x /root/usr/sbin/xdebconfigurator ]
58 then
59         # xdebconfigurator
60         chroot /root /usr/sbin/xdebconfigurator
61 fi
62
63 if [ -n "${KOPTIONS}" ]
64 then
65         setoptions="set xserver-xorg/config/inputdevice/keyboard/options ${KOPTIONS}"
66 fi
67
68 if [ -n "${KVARIANT}" ]
69 then
70         setvariant="set xserver-xorg/config/inputdevice/keyboard/variant ${KVARIANT}"
71 fi
72
73 if [ -n "${KMODEL}" ]
74 then
75         setmodel="set xserver-xorg/config/inputdevice/keyboard/model ${KMODEL}"
76 fi
77
78 chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF
79 set xserver-xorg/config/inputdevice/keyboard/layout ${kbd}
80 ${setvariant}
81 ${setmodel}
82 ${setoptions}
83 EOF
84
85 DEBUG_XORG_PACKAGE=1 DEBUG_XORG_DEBCONF=1 live-reconfigure /root xserver-xorg 2>&1 \
86         | grep -v "overwriting possibly-customised configuration file"
87 umount /root/sys
88 umount /root/proc
89 umount /root/dev
90
91 log_end_msg