rendered paste body#!/bin/shUNSUPPORTED=1LEGACY=0#CARDS="$(lspci -n|gawk '{sub("Class","")} $2 == "0300:" {print$3}')"CARDS="$(lspci -n|perl -e 'while(<>){(push(@cards,$_)) if (s/^.+?\s*0300\:\s+(.+?)\s+.*$/$1/)} print join(" ",@cards);')"for card in $CARDS; do VENDOR=${card%:*} DEVICE=${card#*:} case $VENDOR in 10de|12d2) case $DEVICE in 0008|0009|0010|0018|0019) UNSUPPORTED=1 ;; 0020|0028|0029|002c|002d|00a0|0100|0101|0103|0150|0151|0152|0153) LEGACY=1;UNSUPPORTED=0 ;; 0110|0111|0112|0113|0170|0171|0172|0173|0174|0175|0176|0177|0178|0179|017a|017c|017d|0181|0182|0183|0185|0188|018a|018b|018c|01a0|01f0|0200|0201|0202|0203|0250|0251|0253|0258|0259|025b|0280|0281|0282|0286|0288|0289|028c) LEGACY=2;UNSUPPORTED=0 ;; #0170) LEGACY=1;UNSUPPORTED=0 ;; # GeForce4 MX 460 workaround *) UNSUPPORTED=0 ;; esac ;; esacdoneif [ ! -f /etc/kanotix-version ]; then echo Error: No KANOTIX found. Do not ask for support! >&2fiif [ ! -f /etc/debian_version ]; then echo Error: No Debian compatible system found. Do not ask for support! >&2 exit 100fiif [ "$UNSUPPORTED" = "1" ]; then echo Error: No supported nVidia VGA adapter found. >&2 exit 3fiif [ "$(id -u)" != "0" ]; then echo Error: You must be root to run this script! >&2 exit 4fi[ -d /KNOPPIX -o -d /KANOTIX ] && INSTALLED="no" || INSTALLED="yes"if [ -f /etc/default/distro ]; then . /etc/default/distro [ "$FLL_DISTRO_MODE" = "live" ] && INSTALLED="no"fiif [ "$INSTALLED" = "yes" ]; then if [ -n "$DISPLAY" ]; then echo Error: Can\`t be run within X! Use a text console \(ALT-CTRL-F1\) >&2 exit 5 fielse if grep -q -e unionfs -e aufs /proc/mounts; then echo Unionfs found. >&2 else echo Activating Unionfs now. >&2 mkdir -p /tmp/union UNION=/KNOPPIX [ -d /KANOTIX ] && UNION=/KANOTIX [ -d "$FLL_MOUNTPOINT" ] && UNION="$FLL_MOUNTPOINT" mount -t unionfs -o dirs=/tmp/union/:$UNION /none $UNION/ >/dev/null 2>&1 fifiX_CONF=XF86Config-4if which Xorg >/dev/null; then [ -e /etc/X11/xorg.conf ] && X_CONF=xorg.conffiAGPRATE=0# AGPRATE can be 15 (8x), 4, 2, 1 or 0 (auto)FW=0# FW can be 0 (off) or 1 (on)EMUL=1COMPOSITE=1NRC=1USEEDID=1USEEDIDFREQS=1RMML=0XVMC=1TV=0DYN_TWINVIEW=0VER_FORCE=""PRINT_VER=0NO_X_KILL=0while getopts cdefnprtlqxv:zh opt; do case $opt in c) COMPOSITE=0 ;; d) DYN_TWINVIEW=1 ;; e) USEEDID=0 ;; f) FW=1 ;; n) NRC=0 ;; p) PRINT_VER=1 ;; r) RMML=1 ;; t) TV=1 ;; l) EMUL=0 ;; q) USEEDIDFREQS=0 ;; x) XVMC=0 ;; v) VER_FORCE="$OPTARG" ;; z) NO_X_KILL=1 ;; \?|h) echo "Usage $0 [options] " >&2 echo "optional options are:" >&2 echo " -c Disable Composite extension" >&2 echo " -d Enable DynamicTwinView" >&2 echo " -e Disable UseEDID" >&2 echo " -f Enable FastWrites" >&2 echo " -n Disable DFP Native Resolution Check" >&2 echo " -r Remove ModeLines" >&2 echo " -t Enable TV-Out" >&2 echo " -q Disable UseEdidFreqs" >&2 echo " -x Disable XvMC" >&2 echo " -l Disable 32 bit emulation libs in 64 bit mode" >&2 echo " -v VER Force use of specific driver build. Example: -v 1.0-9629" >&2 echo " -p Print driver version to be installed and quit" >&2 echo " -z No X kill/restart. Special purpose only!" >&2 echo " -h Show this help" >&2 exit 6 ;; esacdone# check for pipe usage[ "$0" = "sh" -o "$0" = "bash" ] && NO_X_KILL=1# old DX7 cards up to gf2gts/proVER_LEGACY_1=1.0-7185# DX7 cards since gf2mx and all DX8 cardsVER_LEGACY_2=1.0-9631VER=100.14.03#VER=1.0-9755#VER=1.0-9746#VER=1.0-9742#VER=1.0-9631#VER=1.0-9629#VER=1.0-9626#VER=1.0-9625#VER=1.0-8776#VER=1.0-8774#VER=1.0-8762#VER=1.0-8756#VER=1.0-8178#VER=1.0-8174#VER=1.0-7676#VER=1.0-7667#VER=1.0-7664#VER=1.0-7185#VER=1.0-7184#VER=1.0-7182#VER=1.0-7174#VER=1.0-7167#VER=1.0-6629#VER=1.0-6111#VER=1.0-6106#VER=1.0-5336#VER=1.0-5328#VER=1.0-4620[ "$VER" = "1.0-8776" -a "$COMPOSITE" = "1" ] && VER=1.0-9631case $VER in 1.0-7664|1.0-7667|1.0-7676|1.0-8174|1.0-8178|1.0-8756|1.0-8762|1.0-8774|1.0-8776|1.0-9625|1.0-9626|1.0-9629|1.0-9631) [ "$LEGACY" = "1" ] && VER=$VER_LEGACY_1 ;; 1.0-9742|1.0-9746|1.0-9755|100.14.03) if [ "$LEGACY" = "1" ]; then VER=$VER_LEGACY_1 elif [ "$LEGACY" = "2" ]; then VER=$VER_LEGACY_2 fi ;;esacARCH=""[ "$(uname -m)" = "x86_64" ] && ARCH="_64"[ "$VER" = "1.0-7664" -a "$ARCH" = "_64" ] && VER=1.0-7184if [ -n "$VER_FORCE" ]; then if [ "${#VER_FORCE}" = "4" ]; then VER=1.0-$VER_FORCE else VER=$VER_FORCE fifiif [ "$PRINT_VER" = "1" ]; then echo $VER exitfiDVER=1.0.${VER#1.0-}SERVER=de.download.nvidia.com[ "$VER" = "1.0-9742" ] && SERVER=us.download.nvidia.comURL=http://$SERVER/XFree86/Linux-x86$ARCH/$VER/EURL=http://$SERVER/XFree86/Linux-x86/$VER/PKG=0PATCH=0HACK=0UDEVHACK=0[ "$VER" = "1.0-7174" ] && UDEVHACK=1KVER=$(uname -r)KV=$(uname -r|cut -d. -f1-2)cd /usr/src[ -f NVIDIA-Linux-x86$ARCH-$VER-pkg$PKG.run ] || wget -Nc "$URL"NVIDIA-Linux-x86$ARCH-$VER-pkg$PKG.runrm -rf NVIDIA-Linux-x86$ARCH-$VER-pkg$PKGbash NVIDIA-Linux-x86$ARCH-$VER-pkg$PKG.run --extract-only >/dev/null 2>&1 || ( rm -f NVIDIA-Linux-x86$ARCH-$VER-pkg$PKG.run echo NVIDIA-Linux-x86$ARCH-$VER-pkg$PKG.run could not be extracted >&2 echo and has been deleted. Please restart this script. >&2 exit 1) || exit $?if [ "$ARCH" = "_64" -a "$EMUL" = "1" ]; then [ -f NVIDIA-Linux-x86-$VER-pkg$PKG.run ] || wget -Nc "$EURL"NVIDIA-Linux-x86-$VER-pkg$PKG.run rm -rf NVIDIA-Linux-x86-$VER-pkg$PKG bash NVIDIA-Linux-x86-$VER-pkg$PKG.run --extract-only >/dev/null 2>&1 || ( rm -f NVIDIA-Linux-x86-$VER-pkg$PKG.run echo NVIDIA-Linux-x86-$VER-pkg$PKG.run could not be extracted >&2 echo and has been deleted. Please restart this script. >&2 exit 2 ) || exit $?fiif [ "$KV" = "2.6" -a "$PATCH" = "1" ]; then wget -Nc http://www.minion.de/files/NVIDIA_kernel-$VER-2.6.difffiif [ -f /etc/modutils/1alsa ]; then mv /lib/modules/extra/alsa /lib/modules/`uname -r`/ rm -f /etc/modutils/1alsa depmod -afiif ! [ "$NO_X_KILL" = "1" ]; then if [ "$INSTALLED" = "yes" ]; then DM=$(cat /etc/X11/default-display-manager 2>/dev/null) DM=$(basename $DM 2>/dev/null) if [ -z "$DM" ]; then if [ -x /etc/init.d/kdm ]; then /etc/init.d/kdm stop elif [ -x /etc/init.d/gdm ]; then /etc/init.d/gdm stop elif [ -x /etc/init.d/xdm ]; then /etc/init.d/xdm stop fi else [ -x /etc/init.d/$DM ] && /etc/init.d/$DM stop fi fifikillall -9 Xgl >/dev/null 2>&1rmmod nvidia >/dev/null 2>&1rm -f /lib/modules/`uname -r`/kernel/drivers/video/nvidia.*orm -f /lib/modules/`uname -r`/volatile/nvidia.*orm -f /usr/local/bin/nvidia-settings /usr/local/bin/nvidia-xconfigOLD_NVIDIA=$(COLUMNS=200 dpkg -l|cut -f3 -d' '|grep nvidia)[ -n "$OLD_NVIDIA" ] && dpkg --purge $OLD_NVIDIA# Ubuntu workaround[ -f /etc/default/linux-restricted-modules-common ] && perl -pi -e 's/^(DISABLED_MODULES)=.*/\1="nv"/' /etc/default/linux-restricted-modules-commonunset UPif ! [ -x /usr/bin/module-assistant ]; then apt-get update && UP=1 apt-get install --allow-unauthenticated --yes module-assistantfiif ! [ -d /usr/share/build-essential ]; then [ -z "$UP" ] && apt-get update apt-get install --allow-unauthenticated --yes build-essentialfiif ! [ -x /usr/bin/module-assistant ]; then echo "Error: module-assistant missing." >&2 [ -r /etc/lsb-release ] && . /etc/lsb-release [ "$DISTRIB_ID" = "Ubuntu" ] && echo "Hint: Enable universe repository in /etc/apt/sources.list." >&2 exit 1fi# Debian (and Ubuntu)[ -f /etc/debian_version -a ! -f /etc/kanotix-version ] && m-a -i preparecd NVIDIA-Linux-x86$ARCH-$VER-pkg$PKGif [ "$KV" = "2.6" ]; then if [ "$PATCH" = "1" ]; then cd usr/src/nv patch -p1 < ../../../../NVIDIA_kernel-$VER-2.6.diff ln -s Makefile.kbuild Makefile cd ../../.. fielse # fix NVIDIA's stupid error in Makefile perl -pi -e 's/"\$\$\?"/"\$\?"/' Makefilefi[ "$(uname -r|cut -d- -f1)" = "2.6.10" ] && perl -pi -e s/pci_find_class/pci_get_class/ usr/src/nv/nv.cif [ "$(uname -r|grep -E '2.6.11')" != "" -a "$VER" = "1.0-6629" ]; then #PATCH_BASE_URL="http://www.minion.de/files/1.0-6629/" PATCH_BASE_URL="http://kanotix.com/files/1.0-6629/" PATCHES="NVIDIA_kernel-1.0-6629-1155389.diff NVIDIA_kernel-1.0-6629-1161283.diff NVIDIA_kernel-1.0-6629-1165235.diff NVIDIA_kernel-1.0-6629-1171869.diff NVIDIA_kernel-1.0-6629-1175225.diff NVIDIA_kernel-1.0-6629-1182399.diff NVIDIA_kernel-1.0-6629-1189413.diff NVIDIA_kernel-1.0-6629-1201042.diff" for p in $PATCHES; do #wget -qO- $PATCH_BASE_URL$p|patch -p0 [ -f /usr/src/$p ] || wget -NqO/usr/src/$p $PATCH_BASE_URL$p patch -p0 </usr/src/$p || rm -f /usr/src/$p donefiif [ "$VER" = "1.0-7167" ]; then PATCH_BASE_URL="http://kanotix.com/files/1.0-7167/" PATCHES="NVIDIA_kernel-1.0-7167-1233959.diff NVIDIA_kernel-1.0-7167-1237815.diff" for p in $PATCHES; do #wget -qO- $PATCH_BASE_URL$p|patch -p0 [ -f /usr/src/$p ] || wget -NqO/usr/src/$p $PATCH_BASE_URL$p patch -p0 </usr/src/$p || rm -f /usr/src/$p donefiif [ "$VER" = "1.0-7174" ]; then PATCH_BASE_URL="http://kanotix.com/files/1.0-7174/" PATCHES="NVIDIA_kernel-1.0-7174-1258475.diff NVIDIA_kernel-1.0-7174-1296092.diff NVIDIA_kernel-1.0-7174-1321905.diff NVIDIA_kernel-1.0-7174-1361053.diff" for p in $PATCHES; do #wget -qO- $PATCH_BASE_URL$p|patch -p0 [ -f /usr/src/$p ] || wget -NqO/usr/src/$p $PATCH_BASE_URL$p patch -p0 </usr/src/$p || rm -f /usr/src/$p donefiif [ "$VER" = "1.0-7174" -a "$ARCH" = "_64" ]; then PATCH_BASE_URL="http://kanotix.com/files/1.0-7174/" PATCHES="NVIDIA_kernel-1.0-7174-1386866.diff" for p in $PATCHES; do #wget -qO- $PATCH_BASE_URL$p|patch -p0 [ -f /usr/src/$p ] || wget -NqO/usr/src/$p $PATCH_BASE_URL$p patch -p0 </usr/src/$p || rm -f /usr/src/$p donefiif [ "$VER" = "1.0-7184" ]; then PATCH_BASE_URL="http://kanotix.com/files/1.0-7184/" PATCHES="NVIDIA_kernel-2.6.19-fixups.diff" for p in $PATCHES; do #wget -qO- $PATCH_BASE_URL$p|patch -p0 [ -f /usr/src/$p ] || wget -NqO/usr/src/$p $PATCH_BASE_URL$p patch -p0 </usr/src/$p || rm -f /usr/src/$p donefiif [ "$VER" = "1.0-7676" ]; then PATCH_BASE_URL="http://kanotix.com/files/1.0-7676/" PATCHES="NVIDIA_kernel-1.0-7676-1321905.diff NVIDIA_kernel-1.0-7676-1361053.diff NVIDIA_kernel-1.0-7676-1392404.diff" for p in $PATCHES; do #wget -qO- $PATCH_BASE_URL$p|patch -p0 [ -f /usr/src/$p ] || wget -NqO/usr/src/$p $PATCH_BASE_URL$p patch -p0 </usr/src/$p || rm -f /usr/src/$p donefiif [ "$VER" = "1.0-7676" -a "$ARCH" = "_64" ]; then PATCH_BASE_URL="http://kanotix.com/files/1.0-7676/" PATCHES="NVIDIA_kernel-1.0-7676-1386866.diff" for p in $PATCHES; do #wget -qO- $PATCH_BASE_URL$p|patch -p0 [ -f /usr/src/$p ] || wget -NqO/usr/src/$p $PATCH_BASE_URL$p patch -p0 </usr/src/$p || rm -f /usr/src/$p donefiif [ "$VER" = "1.0-8174" ]; then PATCH_BASE_URL="http://kanotix.com/files/1.0-8174/" PATCHES="NVIDIA_kernel-1.0-8174-1423627.diff NVIDIA_kernel-1.0-8174-1427453.diff NVIDIA_kernel-1.0-8174-1430812.diff" for p in $PATCHES; do #wget -qO- $PATCH_BASE_URL$p|patch -p0 [ -f /usr/src/$p ] || wget -NqO/usr/src/$p $PATCH_BASE_URL$p patch -p0 </usr/src/$p || rm -f /usr/src/$p donefi if [ "$VER" = "1.0-8178" ]; then PATCH_BASE_URL="http://kanotix.com/files/1.0-8178/" PATCHES="NVIDIA_kernel-1.0-8178-1423627.diff NVIDIA_kernel-1.0-8178-1427453.diff NVIDIA_kernel-1.0-8178-1435131.diff NVIDIA_kernel-1.0-8178-1450608.diff NVIDIA_kernel-1.0-8178-1451498.diff NVIDIA_kernel-1.0-8178-1453708.diff" for p in $PATCHES; do #wget -qO- $PATCH_BASE_URL$p|patch -p0 [ -f /usr/src/$p ] || wget -NqO/usr/src/$p $PATCH_BASE_URL$p patch -p0 </usr/src/$p || rm -f /usr/src/$p donefiif [ "$VER" = "1.0-8762" -o "$VER" = "1.0-7182" ]; then PATCH_BASE_URL="http://kanotix.com/files/1.0-8762/" PATCHES="NVIDIA_kernel-1.0-8762-U072006.diff" for p in $PATCHES; do #wget -qO- $PATCH_BASE_URL$p|patch -p0 [ -f /usr/src/$p ] || wget -NqO/usr/src/$p $PATCH_BASE_URL$p patch -p0 </usr/src/$p || rm -f /usr/src/$p donefi# NOSMBUS patch enabled for 1.0-9631 too for 2.6.20if [ "$VER" = "1.0-9625" -o "$VER" = "1.0-9626" -o "$VER" = "1.0-9631" ]; then PATCH_BASE_URL="http://kanotix.com/files/1.0-9625/" PATCHES="NVIDIA_kernel-1.0-9625-NOSMBUS.diff" for p in $PATCHES; do #wget -qO- $PATCH_BASE_URL$p|patch -p0 [ -f /usr/src/$p ] || wget -NqO/usr/src/$p $PATCH_BASE_URL$p patch -p0 </usr/src/$p || rm -f /usr/src/$p donefiif [ "$VER" = "1.0-9625" -o "$VER" = "1.0-9626" ]; then PATCH_BASE_URL="http://kanotix.com/files/1.0-9625/" PATCHES="NVIDIA_kernel-2.6.19.patch" for p in $PATCHES; do #wget -qO- $PATCH_BASE_URL$p|patch -p1 [ -f /usr/src/$p ] || wget -NqO/usr/src/$p $PATCH_BASE_URL$p patch -p1 </usr/src/$p || rm -f /usr/src/$p donefi[ "$VER" = "1.0-9742" ] && sed -i s/==/=/ usr/src/nv/conftest.shif [ "$FW" = "1" ]; then perl -pi -e 's/(NVreg_EnableAGPFW =) .*/\1 1;/' usr/src/nv/os-registry.cfiif [ "$AGPRATE" != "0" ]; then perl -pi -e "s/^(static int NVreg_ReqAGPRate =) 15/\1 $AGPRATE/" usr/src/nv/os-registry.c perl -pi -e "s/(\s*&NVreg_ReqAGPRate,\s*)0/\${1}1/" usr/src/nv/os-registry.cfiCC=gcc-$(perl -pe '($_)=/gcc.[Vv]ersion\s(4\.\d|3\.\d|2\.\d+)/;' /proc/version)if [ -e /usr/bin/$CC ]; then CC=/usr/bin/$CCelse unset CCfiexport CCif [ -f Makefile -a ! -x ./nvidia-installer ]; then if [ -e /usr/bin/$CC ]; then make install CC=$CC IGNORE_CC_MISMATCH=1 else make install IGNORE_CC_MISMATCH=1 fielse rm -f /tmp/.X0-lock if [ -x /usr/bin/nvidia-installer ]; then /usr/bin/nvidia-installer --uninstall -s -N 2>/dev/null elif [ -f /usr/lib/libnvidia-tls.so.1 ]; then ./nvidia-installer --uninstall -s -N 2>/dev/null fi if [ -d /usr/lib/xorg/modules ]; then #CC=$CC ./nvidia-installer -s --x-module-path=/usr/lib/xorg/modules -N 2>/dev/null else #CC=$CC ./nvidia-installer -s -N 2>/dev/null fificd ..rm -rf NVIDIA-Linux-x86$ARCH-$VER-pkg$PKGrm -f /etc/modutils/nvidiaperl -pi -e 's|.*char-major-195.*[\n]?||' /etc/modutils/aliasesperl -pi -e 's|[\n]?$|\n|' /etc/modutils/aliasesecho alias char-major-195 nvidia >> /etc/modutils/aliasesdepmod -aif ! [ -e /etc/X11/$X_CONF.1st ]; then cp /etc/X11/$X_CONF /etc/X11/$X_CONF.1stfiperl -p -e 's/^[\s]*Load\s*"GLcore"/#\tLoad "GLcore"/; s/^[\s]*Load\s*"dri"/#\tLoad "dri"/; s/^[\s]*#*[\s]*Load\s*"glx"/\tLoad "glx"/; s/^[\s]*Driver\s*"nv"/\tDriver "nvidia"/g; s/^[\s]*Driver\s*"fbdev"/\tDriver "nvidia"/g; s/^[\s]*Driver\s*"vesa"/\tDriver "nvidia"/g; s/DefaultColorDepth.*/DefaultColorDepth 24/; s/^[\s]*Option\s*"sw_cursor"/\t#Option "sw_cursor"/; s/^.*IgnoreDisplayDevices.*\n?//g; s/^.*Coolbits.*\n?//g; s/^([\s]*Driver\s*"nvidia")/\1\n\tOption "IgnoreDisplayDevices"\t"TV"\n\tOption "Coolbits"\t"1"/g' \ < /etc/X11/$X_CONF.1st > /etc/X11/$X_CONFif which Xorg >/dev/null; then perl -pi -e 's/^.*RenderAccel.*\n?//g;s/^.*AllowGLXWithComposite.*\n?//g;s/^.*RandRRotation.*\n?//g; s/^.*AddARGBGLXVisuals.*\n?//g;s/^.*DisableGLXRootClipping.*\n?//g;s/^.*TripleBuffer.*\n?//g; s/^.*UseEDID.*\n?//g;s/^.*UseEdidFreqs.*\n?//g;s/^.*DynamicTwinView.*\n?//g;s/^.*ModeValidation.*\n?//g; s/^([\s]*Driver\s*"nvidia")/\1\n\tOption "RenderAccel"\t"1"\n\tOption "AllowGLXWithComposite"\t"1"\n\tOption "RandRRotation"\t"1"\n\tOption "AddARGBGLXVisuals"\t"1"\n\tOption "DisableGLXRootClipping"\t"1"\n\tOption "TripleBuffer"\t"1"\n\tOption "UseEDID"\t"1"\n\tOption "UseEdidFreqs"\t"1"\n\tOption "DynamicTwinView"\t"0"\n#\tOption "ModeValidation"\t"NoDFPNativeResolutionCheck"/g' /etc/X11/$X_CONF if ! grep -q Extensions /etc/X11/$X_CONF; then printf "%b\n" '\nSection "Extensions"' >> /etc/X11/$X_CONF printf "%b\n" '\tOption\t"Composite"\t"1"' >> /etc/X11/$X_CONF printf "%b\n" '#\tOption\t"RENDER"\t"1"' >> /etc/X11/$X_CONF echo 'EndSection' >> /etc/X11/$X_CONF fi perl -pi -e 's/^[\s]*#*[\s]*Option\s*"Composite".*/\tOption\t"Composite"\t"1"/' /etc/X11/$X_CONF # disable composite for cards without dx9 support for card in $CARDS; do DEVICE=${card#*:} case $DEVICE in 0020|0028|0029|002c|002d|00a0|00ff|0100|0101|0103|0110|0111|0112|0113|0150|0151|0152|0153|0170|0171|0172|0173|0174|0175|0176|0177|0179|017a|017d|0178|017c|0181|0182|0183|0185|0188|018c|018a|018b|01a0|01f0|0200|0201|0202|0203|0250|0251|0253|0258|0259|025b|0280|0281|0282|0286|0288|0289|028c) #perl -pi -e 's/^[\s]*#*[\s]*Option\s*"Composite".*/#\tOption\t"Composite"\t"1"/' /etc/X11/$X_CONF #perl -pi -e 's/^.*RenderAccel.*\n?//g;s/^.*AllowGLXWithComposite.*\n?//g;s/^.*RandRRotation.*\n?//g' /etc/X11/$X_CONF ;; #perl -pi -e 's/^(.*RenderAccel"\s*).*/\1"1"/g;s/^.*AllowGLXWithComposite.*\n?//g;s/^.*RandRRotation.*\n?//g; # s/^.*AddARGBGLXVisuals.*\n?//g;s/^.*DisableGLXRootClipping.*\n?//g;s/^.*TripleBuffer.*\n?//g' /etc/X11/$X_CONF perl -pi -e 's/^(.*RenderAccel"\s*).*/\1"0"/g' /etc/X11/$X_CONF ;; esac done # disable composite if not -c option used [ "$COMPOSITE" = "0" ] && perl -pi -e 's/^[\s]*#*[\s]*Option\s*"Composite".*/#\tOption\t"Composite"\t"1"/' /etc/X11/$X_CONF # disable UseEDID if -e option used [ "$USEEDID" = "0" ] && perl -pi -e 's/^(.*UseEDID"\s*).*/\1"0"/g' /etc/X11/$X_CONF # disable UseEdidFreqs if -q option used [ "$USEEDIDFREQS" = "0" ] && perl -pi -e 's/^(.*UseEdidFreqs"\s*).*/\1"0"/g' /etc/X11/$X_CONF # remove modelines if -r option used [ "$RMML" = "1" ] && perl -pi -e 's/^.*Mode.ine.*\n?//g' /etc/X11/$X_CONF # enable TV Out if -t option used [ "$TV" = "1" ] && perl -pi -e 's/^.*IgnoreDisplayDevices.*\n?//g' /etc/X11/$X_CONF # enable DynamicTwinView if -d option used [ "$DYN_TWINVIEW" = "1" ] && perl -pi -e 's/^(.*DynamicTwinView"\s*).*/\1"1"/g' /etc/X11/$X_CONF # disable DFP Native Resolution Check if -n option used [ "$NRC" = "0" ] && perl -pi -e 's/^([\s]*)#*([\s]*Option\s*"ModeValidation".*)/\1\2/g' /etc/X11/$X_CONF # Xorg 7.1 hack #X -version 2>&1|grep -q -e "X Window System Version 7.1" && perl -pi -e 's/^(.*RenderAccel"\s*).*/\1 "0"/' /etc/X11/$X_CONFfirm -f /etc/X11/XvMCConfigif [ "$XVMC" = "1" -a "$LEGACY" = "0" -a -x /usr/lib/libXvMCNVIDIA_dynamic.so.1 ]; then echo libXvMCNVIDIA_dynamic.so.1 > /etc/X11/XvMCConfigelse echo libXvMC.so.1 > /etc/X11/XvMCConfigfi[ "$HACK" = "1" ] && rm -rf /usr/lib/tlsif [ "$ARCH" = "_64" -a "$EMUL" = "1" ]; then mkdir -p /emul/ia32-linux/usr/lib/tls/ rm -f /emul/ia32-linux/usr/lib/tls/libnvidia-tls.so.* rm -f /emul/ia32-linux/usr/lib/libGLcore.so.* rm -f /emul/ia32-linux/usr/lib/libGL.so.* rm -f /emul/ia32-linux/usr/lib/libnvidia-tls.so.* cp -v /usr/src/NVIDIA-Linux-x86-$VER-pkg$PKG/usr/lib/tls/libnvidia-tls.so.$DVER /emul/ia32-linux/usr/lib/tls/ cp -v /usr/src/NVIDIA-Linux-x86-$VER-pkg$PKG/usr/lib/libGLcore.so.$DVER /emul/ia32-linux/usr/lib/ cp -v /usr/src/NVIDIA-Linux-x86-$VER-pkg$PKG/usr/lib/libGL.so.$DVER /emul/ia32-linux/usr/lib/ cp -v /usr/src/NVIDIA-Linux-x86-$VER-pkg$PKG/usr/lib/tls/libnvidia-tls.so.$DVER /emul/ia32-linux/usr/lib/ ln -sf tls/libnvidia-tls.so.$DVER /emul/ia32-linux/usr/lib/libnvidia-tls.so.1 ln -sf libGLcore.so.$DVER /emul/ia32-linux/usr/lib/libGLcore.so ln -sf libGL.so.$DVER /emul/ia32-linux/usr/lib/libGL.so.1 ln -sf libGL.so.1 /emul/ia32-linux/usr/lib/libGL.so rm -rf /usr/src/NVIDIA-Linux-x86-$VER-pkg$PKGfimkdir -p /etc/udev/rules.drm -f /etc/udev/nvidia.rules /etc/udev/rules.d/nvidia.rulesif [ "$UDEVHACK" = "1" ]; then cat <<EOF > /etc/udev/nvidia.rules KERNEL=="nvidia", PROGRAM="/bin/sh -c '/bin/mknod /dev/nvidia0 -m 666 c 195 0 2>/dev/null;/bin/mknod /dev/nvidiactl -m 666 c 195 255 2>/dev/null'"EOF ln -s ../nvidia.rules /etc/udev/rules.d/nvidia.rulesfildconfigsyncif ! [ "$NO_X_KILL" = "1" ]; then if [ "$INSTALLED" = "yes" ]; then if [ -z "$DM" ]; then if [ -x /etc/init.d/kdm ]; then /etc/init.d/kdm start elif [ -x /etc/init.d/gdm ]; then /etc/init.d/gdm start elif [ -x /etc/init.d/xdm ]; then /etc/init.d/xdm start fi else [ -x /etc/init.d/$DM ] && /etc/init.d/$DM start fi else /etc/init.d/xsession restart fifi