From 5512856791a84272d4dc8f3217eb18ac6f878ede Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Tue, 21 Aug 2012 15:16:14 -0500
Subject: LinHES-config: xconfig  added support for intel/vmware/vesa drivers
 using the new  xorg.conf.d layout. Still need to account for different
 resolutions

---
 abs/core/LinHES-config/xconfig.sh | 100 +++++++++++++++++++++-----------------
 1 file changed, 56 insertions(+), 44 deletions(-)

diff --git a/abs/core/LinHES-config/xconfig.sh b/abs/core/LinHES-config/xconfig.sh
index 7024566..f679dba 100755
--- a/abs/core/LinHES-config/xconfig.sh
+++ b/abs/core/LinHES-config/xconfig.sh
@@ -34,7 +34,6 @@ function Xvalues {
 }
 
 function presetupX {
-
     if  [ "$XIgnoreConfig" = 1 ]
     then
         echo "Using User supplied X"
@@ -48,8 +47,6 @@ function presetupX {
     else
         setupX
     fi
-
-
 }
 
 function nvidia_prepare {
@@ -62,8 +59,6 @@ function nvidia_prepare {
     do
         pacman --noconfirm  -Rc $i >> $LOGFILE 2>&1
     done
-
-
 }
 
 function pkg_check () {
@@ -76,37 +71,59 @@ function pkg_check () {
         echo "  Couldn't find $1 for install, aborting" >> $LOGFILE 2>&1
         exit 1
     fi
-
-
-
-    }
+}
 
 function nvidia_driver_install {
-
+    echo "Installing Nvidia driver"
     cp "$TEMPLATES/xorg/xorg.conf.nvidia"  $BASE/etc/X11/xorg.conf.d/20-automv.conf
-    #grep -qi "$CARDID" "$NVIDIA_SUPPORTED"
-
-    #if [ $? = 0 ]
-    #then
-        #install latest drivers
-        pkg_check nvidia-utils
-        echo "Installing current nvidia drivers"
-        nvidia_prepare
-        pacman --noconfirm  -S nvidia nvidia-utils >> $LOGFILE 2>&1
-        installed=1
-    #fi
+    #install latest drivers
+    pkg_check nvidia-utils
+    echo "Installing current nvidia drivers"
+    nvidia_prepare
+    pacman --noconfirm  -S nvidia nvidia-utils >> $LOGFILE 2>&1
+    installed=1
 
     if [ \"$Xres\" = "Auto" ]
     then
         nvidia-xconfig -c /etc/X11/xorg.conf.d/20-automv.conf --mode-list="nvidia-auto-select"
     else
-        #nvidia-xconfig -c /etc/X11/xorg.conf.d/20-automv.conf --mode-list=$Xres
         eval nvidia-xconfig -c /etc/X11/xorg.conf.d/20-automv.conf --mode-list=\"${Xres}\"
     fi
 
     echo "/usr/lib/libXvMCNVIDIA_dynamic.so.1" > "$XVMC_CONFIG"
 }
 
+function vmware_driver_install {
+    echo "Installing VMware driver"
+    echo "Installing VMware driver" >> $LOGFILE 2>&1
+    LIST="xf86-input-vmmouse  xf86-video-vmware xf86-video-vesa svga-dri"
+    for i in `echo ${LIST}`
+    do
+        pkg_check $i
+    done
+    for i in `echo ${LIST}`
+    do
+        pacman -S --noconfirm $i >> $LOGFILE 2>&1
+    done
+
+}
+
+function vesa_driver_install {
+    echo "Installing Vesa driver"
+    echo "Installing Vesa driver" >> $LOGFILE 2>&1
+    pacman -S --noconfirm xf86-video-vesa  >> $LOGFILE 2>&1
+}
+
+function intel_driver_install {
+    echo "Installing Intel driver"
+    echo "Installing Intel driver" >> $LOGFILE 2>&1
+    pkg_check xf86-video-intel
+    #this is used to remove nvidia
+    nvidia_prepare
+    pacman -S --noconfirm xf86-video-intel >> $LOGFILE 2>&1
+    echo "/usr/lib/libIntelXvMC.so.1" > "$XVMC_CONFIG"
+}
+
 # if [ "$Xcategory" = "Nvidia" ]
 # then
 # #Xres=""
@@ -139,32 +156,27 @@ function setupX {
                 ;;
 
             VMware)
-                    sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.vmware" > "$XORG_CONF"
+                    vmware_driver_install
+                    cp $TEMPLATES/xorg/xorg.vmware  /etc/X11/xorg.conf.d/20-automv.conf
+                    echo "copy in autostart functions" >> $LOGFILE 2>&1
+                    mkdir -p /etc/X11/autostart  >> $LOGFILE 2>&1
+                    echo "/usr/bin/vmware-user-suid-wrapper" > /etc/X11/autostart/vmware.conf
                     ;;
 
             Intel|intel)
-               if [ ${Xres} = Auto ]
-                then
-                    sed -e "/^.*Modes.*$/d" "$TEMPLATES/xorg/xorg.conf.intel" > "$XORG_CONF"
-                else
-                    sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.intel" > "$XORG_CONF"
-                fi
-                if [ "$TESTMODE" != "test" ]
-                then
-                    pacman --noconfirm -R nvidia-utils >> $LOGFILE 2>&1
-                    pacman --noconfirm -S libgl >> $LOGFILE 2>&1
-                fi
-                echo "/usr/lib/libIntelXvMC.so.1" > "$XVMC_CONFIG"
-                ;;
+                    intel_driver_install
+                    cp $TEMPLATES/xorg/xorg.intel  /etc/X11/xorg.conf.d/20-automv.conf
+                    ;;
 
-            vesa|InnoTek|*)
-                echo "Using the vesa driver"
-                if [ ${Xres} = Auto ]
-                then
-                    sed -e "/^.*Modes.*$/d" "$TEMPLATES/xorg/xorg.conf.vesa" > "$XORG_CONF"
-                else
-                    sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.vesa" > "$XORG_CONF"
-                fi
+            vesa|InnoTek|*) #leaving this as * and vesa for no real reason other then it's explicit to catch vesa
+                  vesa_driver_install
+                  cp $TEMPLATES/xorg/xorg.vesa  /etc/X11/xorg.conf.d/20-automv.conf
+#                 if [ ${Xres} = Auto ]
+#                 then
+#                     sed -e "/^.*Modes.*$/d" "$TEMPLATES/xorg/xorg.conf.vesa" > "$XORG_CONF"
+#                 else
+#                     sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.vesa" > "$XORG_CONF"
+#                 fi
                 ;;
 
         esac
-- 
cgit v0.12

