Don't configure X when /usr/bin/X does not exist.
[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 log_begin_msg "Configuring X"
31
32 # live-initramfs script
33
34 if [ "${TERM_TYPE}" = "serial" ]
35 then
36         # Don't bother trying to configure or start X on a serial console
37         rm -f /root/etc/rc?.d/S??[gkx]dm
38         exit 0
39 fi
40
41 if [ -n "${TEXTONLY}" ]
42 then
43         exit 0
44 fi
45
46 if [ -x /root/usr/bin/X ]
47 then
48         exit 0
49 fi
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