diff options
author | David Runge <david.runge@frqrec.com> | 2013-12-10 12:16:25 +0100 |
---|---|---|
committer | David Runge <david.runge@frqrec.com> | 2013-12-10 12:16:25 +0100 |
commit | 0426ea3467f05b2f4bbba5576197cd72477c6e15 (patch) | |
tree | 1a38bacb366d0d986e674ece01b644b4332e1996 | |
parent | e2a08a9317d69e09fd82bcc2f3bb434f1af48d2c (diff) | |
download | dotfiles-0426ea3467f05b2f4bbba5576197cd72477c6e15.tar.gz dotfiles-0426ea3467f05b2f4bbba5576197cd72477c6e15.tar.bz2 dotfiles-0426ea3467f05b2f4bbba5576197cd72477c6e15.tar.xz dotfiles-0426ea3467f05b2f4bbba5576197cd72477c6e15.zip |
Added scripts for switching between nvidia and nouveau drivers on XPS1340
-rwxr-xr-x | bin/nouveau2nvidia | 57 | ||||
-rwxr-xr-x | bin/nvidia2nouveau | 58 |
2 files changed, 115 insertions, 0 deletions
diff --git a/bin/nouveau2nvidia b/bin/nouveau2nvidia new file mode 100755 index 0000000..a71e6b7 --- /dev/null +++ b/bin/nouveau2nvidia @@ -0,0 +1,57 @@ +#!/bin/bash +# nouveau -> nvidia + +set -e +# check if root +if [[ $EUID -ne 0 ]]; then + echo "You must be root to run this script. Aborting..."; + exit 1; +fi + +echo "Switching MODULES line in /etc/mkinitcpio.conf" +sed -i 's/MODULES="dm-mod nouveau"/#MODULES="dm-mod nouveau"/' /etc/mkinitcpio.conf +sed -i 's/#*MODULES="dm-mod nvidia"/MODULES="dm-mod nvidia"/' /etc/mkinitcpio.conf + +echo "Uninstalling nouveau drivers, installing nvidia drivers." + +declare -i NVIDIAINSTALL +NVIDIART=$(pacman -Qi|grep Name|grep linux-rt) + +if [[ -n "$NVIDIART" ]]; then + NVIDIAINSTALL=$NVIDIAINSTALL+1 + echo "Seems that linux-rt is installed. Marking nvidia-rt for installation." +fi + +pacman -Rdds --noconfirm nouveau-dri xf86-video-nouveau mesa-libgl lib32-nouveau-dri lib32-mesa-libgl + +case $NVIDIAINSTALL in + 0) + pacman -S --noconfirm nvidia lib32-nvidia-libgl + ;; + 1) + pacman -S --noconfirm nvidia lib32-nvidia-libgl + aura -A --noconfirm nvidia-rt + ;; +esac + +echo "Switching X11 settings." +NVIDIACONF="/etc/X11/xorg.conf.d/20-nvidia.conf" +NOUVEAUCONF="/etc/X11/xorg.conf.d/20-nouveau.conf" +BKP=".bkp" + +if [[ -f $NOUVEAUCONF ]]; then + mv $NOUVEAUCONF "$NOUVEAUCONF$BKP" +fi + +if [ -f "$NVIDIACONF$BKP" ]; then + mv "$NVIDIACONF$BKP" $NVIDIACONF +fi + + +echo "Building new initramfs images." +mkinitcpio -p linux + +if [[ -f "/etc/mkinitcpio.d/linux-rt.preset" ]]; then + mkinitcpio -p linux-rt +fi + diff --git a/bin/nvidia2nouveau b/bin/nvidia2nouveau new file mode 100755 index 0000000..e862d8c --- /dev/null +++ b/bin/nvidia2nouveau @@ -0,0 +1,58 @@ +#!/bin/bash +# nvidia -> nouveau + +set -e +# check if root +if [[ $EUID -ne 0 ]]; then + echo "You must be root to run this script. Aborting..."; + exit 1; +fi + +echo "Switching MODULES line in /etc/mkinitcpio.conf" +sed -i 's/#*MODULES="dm-mod nouveau"/MODULES="dm-mod nouveau"/' /etc/mkinitcpio.conf +sed -i 's/MODULES="dm-mod nvidia"/#MODULES="dm-mod nvidia"/' /etc/mkinitcpio.conf + +echo "Uninstalling nvidia drivers, installing nouveau drivers." + +declare -i NVIDIAINSTALL +NVIDIART=$(pacman -Qi|grep Name|grep nvidia-rt) + +if [[ -n "$NVIDIART" ]]; then + NVIDIAINSTALL=$NVIDIAINSTALL+1 + echo "Seems that nvidia-rt is installed. Marked for removal." +fi + +case $NVIDIAINSTALL in + 0) + pacman -Rdds --noconfirm nvidia nvidia-libgl lib32-nvidia-libgl + ;; + 1) + pacman -Rdds --noconfirm nvidia nvidia-rt nvidia-libgl lib32-nvidia-libgl + ;; +esac + +pacman -S --noconfirm nouveau-dri xf86-video-nouveau lib32-nouveau-dri + +echo "Switching X11 settings." +NVIDIACONF="/etc/X11/xorg.conf.d/20-nvidia.conf" +NOUVEAUCONF="/etc/X11/xorg.conf.d/20-nouveau.conf" +BKP=".bkp" + +if [ -f $NVIDIACONF ]; then + mv $NVIDIACONF "$NVIDIACONF$BKP" +fi + +if [[ -f "$NOUVEAUCONF$BKP" ]]; then + mv "$NOUVEAUCONF$BKP" $NOUVEAUCONF +fi + +echo "Building new initramfs images." +mkinitcpio -p linux + +if [[ -f "/etc/mkinitcpio.d/linux-rt.preset" ]]; then + mkinitcpio -p linux-rt +fi + +if [[ -f "/etc/mkinitcpio.d/linux-mainline.preset" ]]; then + mkinitcpio -p linux-rt +fi |