From 88894761addea4ab33c6109f62ddd6ac398c8415 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Mon, 31 Oct 2011 13:46:32 -0500
Subject: remove almost all Advanced X, introduce reading available modes from
 xorg.log

---
 abs/core/LinHES-config/PKGBUILD   |   4 +-
 abs/core/LinHES-config/xconfig.sh | 130 ++++++++++++++++++++++++--------------
 abs/core/mythinstall/PKGBUILD     |   2 +-
 3 files changed, 84 insertions(+), 52 deletions(-)

diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index ddfc5a4..a6d8d54 100644
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=2.3
-pkgrel=41
+pkgrel=43
 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev LinHes-config )
 pkgdesc="Install and configure your system"
 depends=('bc' 'libstatgrab'  'mysql-python' 'expect' 'curl' 'dnsutils' 'parted'
@@ -110,7 +110,7 @@ md5sums=('6259677916192a92d1adf47b276f7829'
          'c20f73d4da5d7e15e1f3eb85c7dcb49a'
          '8ac1cfd2eca0f641737da0d0aca416a7'
          '9ae8d79f620c6d19973c55c32a921874'
-         '7af56cecd1081d45f57fb207df0a0c87'
+         '960017a34d9cc78af6298f45aad6eb8e'
          'ecf9e5df20683a769c4a8a8f2d65de85'
          'eaf845dda830c531649d5840e0584f8e'
          '97de45a04f4efbd9d40d9fc0e1db1c3f'
diff --git a/abs/core/LinHES-config/xconfig.sh b/abs/core/LinHES-config/xconfig.sh
index 4237fcc..a601352 100755
--- a/abs/core/LinHES-config/xconfig.sh
+++ b/abs/core/LinHES-config/xconfig.sh
@@ -54,47 +54,51 @@ function presetupX {
                 echo "Copy your config file to $MYTHHOME/templates/xorg.user" > "$XORG_CONF"
             fi
         else
-            if [ "$XUseAdvanced" = 1 ]
-            then
-                setupAdvancedX
-            else
+            #if [ "$XUseAdvanced" = 1 ]
+            #then
+            #    setupAdvancedX
+            #else
                 setupX
-            fi
+            #fi
         fi
     fi
 
 }
 
 function setupAdvancedX {
-    echo "#Doing the advanced X setup" > /tmp/options
+
+    echo "#Doing the advanced X setup" >> $LOGFILE
+    #Xcategory=`echo "$Xresadvanced" | cut -d_ -f1`
+    #Xres=`echo "$Xresadvanced" | cut -d_ -f2`
+
     Xcategory=`echo "$Xresadvanced" | cut -d_ -f1`
-    Xres=`echo "$Xresadvanced" | cut -d_ -f2`
-    echo "$Xcategory"
-    if [ "$Xcategory" = "nVidia Modeline" ]
+    Xres=${Xres}
+    #echo "$Xcategory"
+    #echo $Xres
+    if [ "$Xcategory" = "Nvidia" ]
     then
-        Xres=""
+        #Xres=""
         if [ "$XnVidia1080p" = "1" ]
         then
-            Xres="${Xres} \"1920x1080_60\""
+            Xres="${Xres} 1920x1080_60"
         fi
         if [ "$XnVidia1080i" = "1" ]
         then
-            Xres="${Xres}  \"1920x1080_60i\""
+            Xres="${Xres} 1920x1080_60i"
         fi
         if [ "$XnVidia720p" = "1" ]
         then
-            Xres="${Xres}  \"1280x720_60\""
+            Xres="${Xres} 1280x720_60"
         fi
         if [ "$XnVidia480p" = "1" ]
         then
-            Xres="${Xres}  \"720x480_60\""
+            Xres="${Xres} 720x480_60"
         fi
-            ML="\t Modes ${Xres}"
-    else
-
-    ML="\t Modes \"${Xres}\""
+        #ML="\t Modes ${Xres}"
+#     else
+#         ML="\t Modes \"${Xres}\""
     fi
-#    echo $ML
+
     case $Xcardtype in
         NVIDIA|nVidia|nvidia)
             nvidia_driver_install
@@ -119,21 +123,21 @@ function setupAdvancedX {
                 #echo "Option \"FlatPanelProperties\" \"Scaling = centered, Dithering = enabled\"" >> /tmp/options
                 #echo "Option \"DigitalVibrance\" \"0\"" >> /tmp/options
             fi
-
-            if  [ "$XignoreEDID" = 1 ]
-            then
-                EDIDvalue=true
-                EDIDFREQ=false
-                DS="    DisplaySize $XDisplaysize"
-                HS="    HorizSync   $XHsync"
-                VR="    VertRefresh $XVrefresh"
-            else
-                EDIDvalue=false
-                EDIDFREQ=true
-                DS="# Display size edid used "
-                HS="# Hsync edid used "
-                VR="# Vertrefresh edid used "
-            fi
+#
+#             if  [ "$XignoreEDID" = 1 ]
+#             then
+#                 EDIDvalue=true
+#                 EDIDFREQ=false
+#                 DS="    DisplaySize $XDisplaysize"
+#                 HS="    HorizSync   $XHsync"
+#                 VR="    VertRefresh $XVrefresh"
+#             else
+#                 EDIDvalue=false
+#                 EDIDFREQ=true
+#                 DS="# Display size edid used "
+#                 HS="# Hsync edid used "
+#                 VR="# Vertrefresh edid used "
+#             fi
 #             echo "Option  \"UseEdidFreqs\" \"$EDIDFREQ\"" >> /tmp/options
 #             echo "Option  \"IgnoreEDID\" \"$EDIDvalue\"" >> /tmp/options
 #
@@ -144,6 +148,9 @@ function setupAdvancedX {
 #                 -e "s/^#.*HorizSync.*$/ $HS/g" \
 #                 -e "s/^#.*VertRefresh.*$/ $VR/g" \
 #                 -e "/INSERT HERE/r /tmp/options" "$TEMPLATES/xorg/xorg.conf.nvidia" > "$XORG_CONF"
+
+            #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}\"
             ;;
 
         ati|ATI)
@@ -203,7 +210,7 @@ function nvidia_driver_install {
 
         cp "$TEMPLATES/xorg/xorg.conf.nvidia"  $BASE/etc/X11/xorg.conf.d/20-automv.conf
 
-
+        installed=0
         if [ "$TESTMODE" != "test" ]
         then
 
@@ -215,37 +222,62 @@ function nvidia_driver_install {
                 echo "Installing current nvidia drivers"
                 nvidia_prepare
                 pacman --noconfirm  -S nvidia nvidia-utils >> $LOGFILE 2>&1
+                installed=1
             fi
 
+            if [ $installed = 0 ]
+            then
+                #nvidia check right here
+                grep -qi "$CARDID" "$NVIDIA_96XX"
+                if [ $? = 0 ]
+                then
+                    #install 96xx drivers
+                    echo "Installing nvidia 96xx drivers"
+                    nvidia_prepare
+                    pacman --noconfirm  -S nvidia-96xx nvidia-96xx-utils  >> $LOGFILE 2>&1
+                    installed=1
+                fi
+            fi
 
-            #nvidia check right here
-            grep -qi "$CARDID" "$NVIDIA_96XX"
-            if [ $? = 0 ]
+            if [ $installed = 0 ]
             then
-                #install 96xx drivers
-                echo "Installing nvidia 96xx drivers"
-                nvidia_prepare
-                pacman --noconfirm  -S nvidia-96xx nvidia-96xx-utils  >> $LOGFILE 2>&1
+                grep -qi "$CARDID" "$NVIDIA_173"
+                if [ $? = 0 ]
+                then
+                    #install latest drivers
+                    echo "Installing 173 nvidia drivers"
+                    nvidia_prepare
+                    pacman --noconfirm  -S nvidia-173xx nvidia-173xx-utils >> $LOGFILE 2>&1
+                    installed=1
+                fi
             fi
 
-            grep -qi "$CARDID" "$NVIDIA_173"
-            if [ $? = 0 ]
+            if [ $installed = 0 ]
             then
+                #this is a failsafe, can't find the right driver, then use the latest'
                 #install latest drivers
-                echo "Installing 173 nvidia drivers"
+                echo "Couldn't find the card in the supported list"
+                echo "Installing current nvidia drivers"
+
                 nvidia_prepare
-                pacman --noconfirm  -S nvidia-173xx nvidia-173xx-utils >> $LOGFILE 2>&1
+                pacman --noconfirm  -S nvidia nvidia-utils >> $LOGFILE 2>&1
+                installed=1
             fi
+
+
         fi
-        if [ ${Xres} = Auto ]
+
+
+        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}
+            #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"
-        rm $BASE/etc/X11/xorg.conf.d/20-nvidia.conf
+        #rm $BASE/etc/X11/xorg.conf.d/20-nvidia.conf
 }
 
 
diff --git a/abs/core/mythinstall/PKGBUILD b/abs/core/mythinstall/PKGBUILD
index 7a10d19..92ba4bb 100644
--- a/abs/core/mythinstall/PKGBUILD
+++ b/abs/core/mythinstall/PKGBUILD
@@ -1,7 +1,7 @@
 # Maintainer: Jams
 pkgname=mythinstall
 pkgver=3
-pkgrel=13
+pkgrel=15
 pkgdesc="LinHES installer/systemconfig GUI."
 arch=i686
 depends=()
-- 
cgit v0.12

