Package: fglrx-driver
Version: 8.28.8-3
Severity: wishlist
Tags: patch

The fglrx-driver package conflicts with nvidia-glx and performs some diversions that disable the 3-D capabilities of the other xorg drivers. This causes problems when users switch to a new video card, move their hard drive to a new machine, and in other circumstances. The attached patch removes the diversions and adds code that modifies ld.so.conf so the driver can co-exist with other 3-D drivers. It includes fglrx-enable and fglrx-disable scripts.


diff -ruN fglrx-driver-8.28.8.orig/debian/control fglrx-driver-8.28.8/debian/control
--- fglrx-driver-8.28.8.orig/debian/control	2006-11-17 07:25:56.000000000 -0500
+++ fglrx-driver-8.28.8/debian/control	2006-11-17 07:26:55.000000000 -0500
@@ -13,7 +13,6 @@
 Recommends: fglrx-kernel-src (= ${Source-Version}) | fglrx-kernel
 Provides: xserver-xorg-video-1.0
 Suggests: fglrx-control
-Conflicts: nvidia-glx
 Description: display driver for the ATI graphics accelerators
  Display driver for the ATI Radeon and FireGL graphics accelerators.
  .
diff -ruN fglrx-driver-8.28.8.orig/debian/fglrx-disable fglrx-driver-8.28.8/debian/fglrx-disable
--- fglrx-driver-8.28.8.orig/debian/fglrx-disable	1969-12-31 19:00:00.000000000 -0500
+++ fglrx-driver-8.28.8/debian/fglrx-disable	2006-11-27 09:43:04.000000000 -0500
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+echo "De-configuring the FGLRX driver" 1>&2
+
+grep -q '^/usr/lib/fglrx$' /etc/ld.so.conf && {
+    rm -f /etc/ld.so.conf.orig
+    cp /etc/ld.so.conf /etc/ld.so.conf.orig
+    grep -v '^/usr/lib/fglrx$' < /etc/ld.so.conf.orig > /etc/ld.so.conf
+    ldconfig
+}
+
+if [ -e /sys/module/fglrx ]; then
+    modprobe -r fglrx || true
+    modprobe -r drm || true
+fi
+
+echo -n > /etc/modprobe.d/aliases.fglrx
+
+exit 0
diff -ruN fglrx-driver-8.28.8.orig/debian/fglrx-driver.postrm fglrx-driver-8.28.8/debian/fglrx-driver.postrm
--- fglrx-driver-8.28.8.orig/debian/fglrx-driver.postrm	2006-11-17 07:25:56.000000000 -0500
+++ fglrx-driver-8.28.8/debian/fglrx-driver.postrm	2006-11-17 07:26:47.000000000 -0500
@@ -34,18 +34,18 @@
 
 case "$1" in
     remove|abort-install)
-        undivert_libGL /usr/lib
-
-        if [ "$(dpkg --print-architecture)" = "amd64" ]; then
-            undivert_libGL /emul/ia32-linux/usr/lib
-        fi
+#        undivert_libGL /usr/lib
+#
+#        if [ "$(dpkg --print-architecture)" = "amd64" ]; then
+#            undivert_libGL /emul/ia32-linux/usr/lib
+#        fi
     ;;
 
     upgrade|abort-upgrade)
-        if dpkg --compare-versions "$2" lt "8.24.8"; then
-          echo "*** fglrx-driver: Downgrading and aborted upgrades don't work!" >&2
-          echo "*** fglrx-driver: Please uninstall any remains of this package." >&2
-        fi
+#        if dpkg --compare-versions "$2" lt "8.24.8"; then
+#          echo "*** fglrx-driver: Downgrading and aborted upgrades don't work!" >&2
+#          echo "*** fglrx-driver: Please uninstall any remains of this package." >&2
+#        fi
     ;;
 
     purge|failed-upgrade|disappear)
diff -ruN fglrx-driver-8.28.8.orig/debian/fglrx-driver.preinst fglrx-driver-8.28.8/debian/fglrx-driver.preinst
--- fglrx-driver-8.28.8.orig/debian/fglrx-driver.preinst	2006-11-17 07:25:56.000000000 -0500
+++ fglrx-driver-8.28.8/debian/fglrx-driver.preinst	2006-11-17 07:26:47.000000000 -0500
@@ -53,11 +53,11 @@
 
 case "$1" in
     install)
-        divert_libGL /usr/lib
-
-        if [ "$(dpkg --print-architecture)" = "amd64" ]; then
-            divert_libGL /emul/ia32-linux/usr/lib
-        fi
+#        divert_libGL /usr/lib
+#
+#        if [ "$(dpkg --print-architecture)" = "amd64" ]; then
+#            divert_libGL /emul/ia32-linux/usr/lib
+#        fi
     ;;
 
     upgrade)
@@ -96,13 +96,13 @@
         fi
 
         # set up current diversion, as if installing anew
-        if dpkg --compare-versions "$2" lt "8.24.8"; then
-            divert_libGL /usr/lib
-
-            if [ "$(dpkg --print-architecture)" = "amd64" ]; then
-                divert_libGL /emul/ia32-linux/usr/lib
-            fi
-        fi
+#        if dpkg --compare-versions "$2" lt "8.24.8"; then
+#            divert_libGL /usr/lib
+#
+#            if [ "$(dpkg --print-architecture)" = "amd64" ]; then
+#                divert_libGL /emul/ia32-linux/usr/lib
+#            fi
+#        fi
     ;;
 
     abort-upgrade)
diff -ruN fglrx-driver-8.28.8.orig/debian/fglrx-enable fglrx-driver-8.28.8/debian/fglrx-enable
--- fglrx-driver-8.28.8.orig/debian/fglrx-enable	1969-12-31 19:00:00.000000000 -0500
+++ fglrx-driver-8.28.8/debian/fglrx-enable	2006-11-27 09:42:52.000000000 -0500
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+echo "Enabling the FGLRX driver" 1>&2
+
+grep -q '/usr/lib/fglrx' /etc/ld.so.conf || {
+    rm -f /etc/ld.so.conf.orig
+    cp /etc/ld.so.conf /etc/ld.so.conf.orig
+    echo '/usr/lib/fglrx' > /etc/ld.so.conf
+    cat /etc/ld.so.conf.orig >> /etc/ld.so.conf
+    ldconfig
+}
+if [ ! -e /sys/module/fglrx ]; then
+    modprobe -r drm || true
+    modprobe fglrx
+fi
+
+# The fglrx module is loaded automatically when the driver starts.
+# However, it is necessary to unload any drm module that is already
+# inserted because it will prevent fglrx from loading.  Theoretically,
+# removing drm should do it, but I've seen that fail.
+
+modprobe -r drm
+echo "alias /dev/dri* fglrx" > /etc/modprobe.d/aliases.fglrx
+
+exit 0
diff -ruN fglrx-driver-8.28.8.orig/debian/rules fglrx-driver-8.28.8/debian/rules
--- fglrx-driver-8.28.8.orig/debian/rules	2006-11-17 07:25:56.000000000 -0500
+++ fglrx-driver-8.28.8/debian/rules	2006-11-17 07:26:47.000000000 -0500
@@ -105,6 +105,7 @@
 ifeq ($(DEB_BUILD_ARCH),amd64)
 	# the amd64 package includes 32bit compatibility libraries
 	dh_installdirs -p$(PKG_driver) \
+		emul/ia32-linux/usr/lib/fglrx \
 		emul/ia32-linux/usr/lib/xorg \
 		emul/ia32-linux/usr/lib/xorg/modules
 endif
@@ -125,28 +126,28 @@
 
 	# amd64 needs some library redirection
 ifeq ($(DEB_BUILD_ARCH),amd64)
-	dh_install -p$(PKG_driver) "$(ARCH)/usr/X11R6/lib64/*.so*"         "usr/lib"
+	dh_install -p$(PKG_driver) "$(ARCH)/usr/X11R6/lib64/*.so*"         "usr/lib/fglrx"
 	dh_install -p$(PKG_driver) "$(ARCH)/usr/X11R6/lib64/modules/dri/*" "usr/lib/dri"
 	dh_install -p$(PKG_driver) "$(XDIR)/usr/X11R6/lib64/modules/*"     "usr/lib/xorg/modules"
-	dh_install -p$(PKG_driver) "$(ARCH)/usr/X11R6/lib/*.so*"           "emul/ia32-linux/usr/lib"
+	dh_install -p$(PKG_driver) "$(ARCH)/usr/X11R6/lib/*.so*"           "emul/ia32-linux/usr/lib/fglrx"
 	dh_install -p$(PKG_driver) "$(ARCH)/usr/X11R6/lib/modules/dri/*"   "emul/ia32-linux/usr/lib/dri"
 
 	# replace library paths -- careful, these are binary files
 	rpl -v -e '/usr/X11R6/lib64/modules/dri\0' \
 	          '/usr/lib/dri\0!!!!!!!!!!!!!!!!' \
-	          debian/$(PKG_driver)/usr/lib/libGL.so.1.2
+	          debian/$(PKG_driver)/usr/lib/fglrx/libGL.so.1.2
 	rpl -v -e '/usr/X11R6/lib/modules/dri\0' \
 	          '/usr/lib32/dri\0!!!!!!!!!!!!' \
-	          debian/$(PKG_driver)/emul/ia32-linux/usr/lib/libGL.so.1.2
+	          debian/$(PKG_driver)/emul/ia32-linux/usr/lib/fglrx/libGL.so.1.2
 else
-	dh_install -p$(PKG_driver) "$(ARCH)/usr/X11R6/lib/*.so*"           "usr/lib"
+	dh_install -p$(PKG_driver) "$(ARCH)/usr/X11R6/lib/*.so*"           "usr/lib/fglrx"
 	dh_install -p$(PKG_driver) "$(ARCH)/usr/X11R6/lib/modules/dri/*"   "usr/lib/dri"
 	dh_install -p$(PKG_driver) "$(XDIR)/usr/X11R6/lib/modules/*"       "usr/lib/xorg/modules"
 
 	# replace library paths -- careful, these are binary files
 	rpl -v -e '/usr/X11R6/lib/modules/dri\0' \
 	          '/usr/lib/dri\0!!!!!!!!!!!!!!' \
-	          debian/$(PKG_driver)/usr/lib/libGL.so.1.2
+	          debian/$(PKG_driver)/usr/lib/fglrx/libGL.so.1.2
 endif
 
 	# create symlinks to shared libs; fixes a lintian error
@@ -168,6 +169,8 @@
 	dh_install -p$(PKG_driver) "debian/acpi/*.sh"           "etc/acpi"
 	dh_install -p$(PKG_driver) "debian/acpi/events/fglrx-*" "etc/acpi/events"
 
+	dh_install -p$(PKG_driver) "debian/fglrx-*able"		"usr/sbin"
+
 ifeq ($(DEB_BUILD_ARCH),amd64)
 	dh_install -p$(PKG_driver_dev) "$(ARCH)/usr/X11R6/lib64/*.a" "usr/lib"
 else

Reply via email to