From fc96acff66db76199f852ee1a394a55356f88153 Mon Sep 17 00:00:00 2001
From: Kai Hendry <hendry@iki.fi>
Date: Sun, 25 Jan 2009 20:36:54 +0000
Subject: [PATCH] Apply Jordi's patch
 http://lists.alioth.debian.org/pipermail/debian-live-devel/2008-August/004103.html

---
 scripts/live-bottom/21xdriver   |   59 ---------------------------------------
 scripts/live-bottom/21xvidemode |   38 ++++++-------------------
 2 files changed, 9 insertions(+), 88 deletions(-)
 delete mode 100755 scripts/live-bottom/21xdriver
 mode change 100755 => 100644 scripts/live-bottom/21xvidemode

diff --git a/scripts/live-bottom/21xdriver b/scripts/live-bottom/21xdriver
deleted file mode 100755
index 29ae78e..0000000
--- a/scripts/live-bottom/21xdriver
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/sh
-
-#set -e
-
-# initramfs-tools header
-
-PREREQ=""
-
-prereqs()
-{
-	echo "${PREREQ}"
-}
-
-case "${1}" in
-	prereqs)
-		prereqs
-		exit 0
-		;;
-esac
-
-# live-initramfs header
-
-if [ -n "${NOXAUTOCONFIG}" ]
-then
-	exit 0
-fi
-
-if [ ! -x /root/usr/bin/X ]
-then
-	exit 0
-fi
-
-. /scripts/live-functions
-
-log_begin_msg "Configuring X video driver"
-
-# live-initramfs script
-
-. /live.vars
-
-if [ -n "$XDRIVER" ]
-then
-	mount -o bind /sys /root/sys
-	mount -o bind /proc /root/proc
-	mount -o bind /dev /root/dev
-
-chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF
-set xserver-xorg/autodetect_video_card false
-set xserver-xorg/config/device/driver ${XDRIVER}
-EOF
-
-	chroot /root dexconf
-
-	umount /root/sys
-	umount /root/proc
-	umount /root/dev
-fi
-
-log_end_msg
diff --git a/scripts/live-bottom/21xvidemode b/scripts/live-bottom/21xvidemode
old mode 100755
new mode 100644
index ead3a6c..6f27c85
--- a/scripts/live-bottom/21xvidemode
+++ b/scripts/live-bottom/21xvidemode
@@ -1,7 +1,5 @@
 #!/bin/sh
 
-#set -e
-
 # initramfs-tools header
 
 PREREQ=""
@@ -20,40 +18,22 @@ esac
 
 # live-initramfs header
 
-if [ -n "${NOXAUTOCONFIG}" ]
-then
-	exit 0
-fi
-
-if [ ! -x /root/usr/bin/X ]
-then
-	exit 0
-fi
-
 . /scripts/live-functions
 
-log_begin_msg "Configuring X video modes"
-
 # live-initramfs script
 
-. /live.vars
-
-if [ -n "$XVIDEOMODE" ]
+if [ "${XAUTOCONFIG}" != "Yes" ]
 then
-	mount -o bind /sys /root/sys
-	mount -o bind /proc /root/proc
-	mount -o bind /dev /root/dev
-
-chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF
-set xserver-xorg/config/monitor/mode-list ${XVIDEOMODE}
-set xserver-xorg/config/display/modes ${XVIDEOMODE}
-EOF
+	exit 0
+fi
 
-	chroot /root dexconf
+log_begin_msg "Configuring X kludges..."
 
-	umount /root/sys
-	umount /root/proc
-	umount /root/dev
+if [ -n "${XVIDEOMODE}" -o -n "${XDPI}" ]
+then
+	echo "# X session startup script: /etc/X11/Xsession.d/55xvideomode
+if which xrandr; then xrandr ${XVIDEOMODE:+"-s"} ${XVIDEOMODE} || /bin/true; fi
+# EOF" > "${rootmnt}/etc/X11/Xsession.d/55xvideomode"
 fi
 
 log_end_msg
-- 
1.5.6.5

