779a1c2bc9bab2ad57566ca1b297ca61f3eae600
[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 locale=en_US.UTF-8
47
48 mount -n -o bind /sys /root/sys
49 mount -n -o bind /proc /root/proc
50 mount -n -o bind /dev /root/dev
51
52 if [ -n "${XDEBCONF}" -a -x /root/usr/sbin/xdebconfigurator ]
53 then
54         # xdebconfigurator
55         chroot /root /usr/sbin/xdebconfigurator
56 fi
57
58 if [ "${BUILD_SYSTEM}" = "Ubuntu" ]
59 then
60
61 chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF
62 set xserver-xorg/autodetect_keyboard true
63 fset xserver-xorg/autodetect_keyboard seen true
64 EOF
65
66 else
67         # d-i code not present, so:
68         if [ -n "${KOPTIONS}" ]
69         then
70                 setoptions="set xserver-xorg/config/inputdevice/keyboard/options ${KOPTIONS}"
71         fi
72
73         if [ -n "${KVARIANT}" ]
74         then
75                 setvariant="set xserver-xorg/config/inputdevice/keyboard/variant ${KVARIANT}"
76         fi
77
78         if [ -n "${KMODEL}" ]
79         then
80                 setmodel="set xserver-xorg/config/inputdevice/keyboard/model ${KMODEL}"
81         fi
82
83 chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF
84 set xserver-xorg/config/inputdevice/keyboard/layout ${kbd}
85 ${setvariant}
86 ${setmodel}
87 ${setoptions}
88 EOF
89
90 fi
91
92 DEBUG_XORG_PACKAGE=1 DEBUG_XORG_DEBCONF=1 live-reconfigure /root xserver-xorg
93 umount /root/sys
94 umount /root/proc
95 umount /root/dev
96
97 log_end_msg