28 lines
1.8 KiB
Bash
Executable File
28 lines
1.8 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
PREFIX=/usr/local
|
|
|
|
# Tell the system to use xorg-x11 OpenGL libraries and nVidia GLX extensions
|
|
eselect opengl set xorg-x11
|
|
for arch in 32bit 64bit; do for chip in i915 i965 r300 r600 sw; do sudo eselect mesa set $arch $chip classic &>/dev/null; done; done
|
|
|
|
# Create backups of original xorg.conf.* files and replacing with snail's versions
|
|
[[ -f /etc/X11/xorg.conf && ! -f /etc/X11/xorg.conf.snail-bkp ]] && mv /etc/X11/xorg.conf /etc/X11/xorg.conf.snail-bkp
|
|
[[ -f /etc/X11/xorg.conf.intel && ! -f /etc/X11/xorg.conf.intel.snail-bkp ]] && mv /etc/X11/xorg.conf.intel /etc/X11/xorg.conf.intel.snail-bkp
|
|
[[ -f /etc/X11/xorg.conf.nvidia && ! -f /etc/X11/xorg.conf.nvidia.snail-bkp ]] && mv /etc/X11/xorg.conf.nvidia /etc/X11/xorg.conf.nvidia.snail-bkp
|
|
cp -f /etc/X11/xorg.conf.intel.snail /etc/X11/xorg.conf.intel
|
|
cp -f /etc/X11/xorg.conf.nvidia.snail /etc/X11/xorg.conf.nvidia
|
|
ln -sf xorg.conf.intel /etc/X11/xorg.conf
|
|
|
|
# Recognize BusID of both chips and set it in xorg.conf.* files
|
|
BusIDIntel="PCI:`lspci | grep VGA | grep Intel | cut -d" " -f1 | sed 's~\.~\:~g ; s~0\([0-9]\)~\1~g'`"
|
|
BusIDNvidia="PCI:`lspci | grep VGA | grep nVidia | cut -d" " -f1 | sed 's~\.~\:~g ; s~0\([0-9]\)~\1~g'`"
|
|
sed -i "s~BusIDIntel~$BusIDIntel~" /etc/X11/xorg.conf.intel
|
|
sed -i "s~BusIDNvidia~$BusIDNvidia~" /etc/X11/xorg.conf.nvidia
|
|
|
|
# Allow in sudo for %video group to start/stop second X-server with nVidia card and run snail.dmidecode
|
|
sed -i '/snail/d' /etc/sudoers
|
|
sudoers_lines=`wc -l /etc/sudoers | cut -d" " -f1`
|
|
sed -i "${sudoers_lines}a#snail:\n#snail: Allow %video group to start/stop second X-server with nVidia card\n#snail:\n%video ALL= NOPASSWD: /etc/init.d/snail start\n%video ALL= NOPASSWD: /etc/init.d/snail stop\n%video ALL= NOPASSWD: /usr/local/sbin/snail.dmidecode" /etc/sudoers
|
|
|