#! /bin/sh # preinst script for nvidia-current-dev # # see: dh_installdeb(1) # # Copyright (C) 2009-2010 Canonical Ltd # Authors: Alberto Milone # set -e case "$1" in install|upgrade) # We need to remove diversions from previous versions of the package if [ -d /usr/share/nvidia-glx/diversions/ ] ; then rm -f /usr/lib/libGL.so rm -f /usr/lib/libGL.a dpkg-divert --remove --rename --package nvidia-glx-dev --divert /usr/share/nvidia-glx/diversions/libGL.so /usr/lib/libGL.so > /dev/null dpkg-divert --remove --rename --package nvidia-glx-dev --divert /usr/share/nvidia-glx/diversions/libGL.a /usr/lib/libGL.a > /dev/null rmdir /usr/share/nvidia-glx/diversions/ || true rmdir /usr/share/nvidia-glx || true fi if [ ! -d /usr/lib/nvidia ]; then mkdir -p /usr/lib/nvidia || true fi # Remove old old old gl header diversions if [ -e /usr/share/nvidia-glx/diversions/gl.h ]; then if [ -e /usr/include/GL/gl.h ]; then rm -f /usr/include/GL/gl.h /usr/include/GL/glx.h /usr/include/GL/glxtokens.h fi dpkg-divert --remove --rename --package nvidia-glx-dev --divert /usr/share/nvidia-glx/diversions/gl.h /usr/include/GL/gl.h > /dev/null dpkg-divert --remove --rename --package nvidia-glx-dev --divert /usr/share/nvidia-glx/diversions/glx.h /usr/include/GL/glx.h > /dev/null dpkg-divert --remove --rename --package nvidia-glx-dev --divert /usr/share/nvidia-glx/diversions/glxext.h /usr/include/GL/glxext.h > /dev/null fi # Make sure that no diversion is still there set -a "nvidia-glx-dev" "nvidia-glx-new-dev" "nvidia-glx-legacy-dev" "nvidia-glx-dev-envy"\ "nvidia-glx-new-dev-envy" "nvidia-glx-legacy-dev-envy" "nvidia-glx-180-dev" \ "nvidia-glx-177-dev" "nvidia-glx-173-dev" "nvidia-glx-96-dev" "nvidia-glx-71-dev" \ "nvidia-glx-185-dev" "nvidia-glx-190-dev" while [ $# -ge 1 ]; do glxdevname=$1 if dpkg-divert --list /usr/lib/libGL.so | grep $glxdevname > /dev/null ; then dpkg-divert --remove --rename --package $glxdevname --divert /usr/lib/nvidia/libGL.so.xlibmesa /usr/lib/libGL.so > /dev/null fi if dpkg-divert --list /usr/lib/libGL.a | grep $glxdevname > /dev/null ; then dpkg-divert --remove --rename --package $glxdevname --divert /usr/lib/nvidia/libGL.a.xlibmesa /usr/lib/libGL.a > /dev/null fi if dpkg-divert --list /usr/X11R6/lib/libGL.so | grep $glxdevname > /dev/null ; then dpkg-divert --remove --rename --package $glxdevname --divert /usr/X11R6/lib/nvidia/libGL.so.xlibmesa /usr/X11R6/lib/libGL.so > /dev/null fi if dpkg-divert --list /usr/X11R6/lib/libGL.so | grep $glxdevname > /dev/null ; then dpkg-divert --remove --rename --package $glxdevname --divert /usr/X11R6/lib/nvidia/libGL.a.xlibmesa /usr/X11R6/lib/libGL.a > /dev/null fi shift done ;; abort-upgrade) ;; *) echo "preinst called with unknown argument \`$1'" >&2 exit 0 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0