Adding debian version 2.0~a1-1.
[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-boot header
22
23 if [ -n "${NOXAUTOCONFIG}" ]
24 then
25         exit 0
26 fi
27
28 . /scripts/live-functions
29
30 # live-boot script
31
32 if [ -n "${TEXTONLY}" ]
33 then
34         exit 0
35 fi
36
37 if [ ! -x /root/usr/bin/X ]
38 then
39         exit 0
40 fi
41
42 log_begin_msg "Configuring X"
43
44 if ! grep -q xforcevesa /proc/cmdline 2>&1 >/dev/null
45 then
46         if [ "${TERM_TYPE}" = "serial" ]
47         then
48                 # Don't bother trying to configure or start X on a serial
49                 # console
50                 rm -f /root/etc/rc?.d/S??[gkx]dm
51                 exit 0
52         fi
53
54         locale=en_US.UTF-8
55
56         mount -o bind /sys /root/sys
57         mount -o bind /proc /root/proc
58         mount -o bind /dev /root/dev
59
60         if [ -n "${XDEBCONF}" -a -x /root/usr/sbin/xdebconfigurator ]
61         then
62                 # xdebconfigurator
63                 chroot /root /usr/sbin/xdebconfigurator
64         fi
65
66         if [ -n "${KOPTIONS}" ]
67         then
68                 setoptions="set xserver-xorg/config/inputdevice/keyboard/options ${KOPTIONS}"
69         fi
70
71         if [ -n "${KVARIANT}" ]
72         then
73                 setvariant="set xserver-xorg/config/inputdevice/keyboard/variant ${KVARIANT}"
74         fi
75
76         if [ -n "${KMODEL}" ]
77         then
78                 setmodel="set xserver-xorg/config/inputdevice/keyboard/model ${KMODEL}"
79         fi
80
81         if [ -n "${KLAYOUT}" ]
82         then
83                 setlayout="set xserver-xorg/config/inputdevice/keyboard/layout ${KLAYOUT}"
84         fi
85
86 chroot /root debconf-communicate -fnoninteractive live-boot > /dev/null << EOF
87 ${setlayout}
88 ${setvariant}
89 ${setmodel}
90 ${setoptions}
91 EOF
92
93         live-reconfigure /root xserver-xorg 2>&1 \
94                 | grep -v "overwriting possibly-customised configuration" \
95                 | grep -v "file; backup in /etc/X11/xorg.conf"
96
97         umount /root/sys
98         umount /root/proc
99         umount /root/dev
100 else
101
102 cat > /root/etc/X11/xorg.conf << EOF
103 Section "Device"
104         Identifier      "Configured Video Device"
105         Driver          "vesa"
106 EndSection
107
108 Section "Monitor"
109         Identifier      "Configured Monitor"
110 EndSection
111
112 Section "Screen"
113         Identifier      "Default Screen"
114         Monitor         "Configured Monitor"
115         Device          "Configured Video Device"
116 EndSection
117 EOF
118
119 fi
120
121 log_end_msg