From 58eb3213ca8346dfef22ae6a7c9052f35414ed8c Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Thu, 28 Feb 2019 19:36:37 +0000
Subject: LinHES-config: LinHES-release: update for 8.6

xconfig.sh: add support for nvidia-390xx and ati
---
 abs/core/LinHES-config/LinHES-release |   2 +-
 abs/core/LinHES-config/PKGBUILD       |  10 +--
 abs/core/LinHES-config/xconfig.sh     | 134 +++++++++++++++++++++++++---------
 3 files changed, 104 insertions(+), 42 deletions(-)

diff --git a/abs/core/LinHES-config/LinHES-release b/abs/core/LinHES-config/LinHES-release
index 5afb5ff..203aeb3 100644
--- a/abs/core/LinHES-config/LinHES-release
+++ b/abs/core/LinHES-config/LinHES-release
@@ -1 +1 @@
-LinHES R8.5.2 (Gareth)
+LinHES R8.6.0 (Feeding the Kids)
diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index 424d709..f8ab4e1 100755
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
-pkgver=8.5.2
-pkgrel=3
+pkgver=8.6.0
+pkgrel=1
 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'
@@ -8,7 +8,7 @@ depends=('bc' 'libstatgrab' 'mysql-python' 'expect' 'curl' 'dnsutils' 'parted'
          'python2-pexpect' 'python-netifaces' 'xcursor-vanilla-dmz-aa'
          'python-iplib' 'sudo' 'setserial' 'udevil' 'balance'
          'mythinstall' 'runit-scripts>=8.3-4' )
-arch=('i686' 'x86_64')
+arch=('x86_64')
 
 source=(mv_install.py 09_mythvantge_runit_grub
 	mv_config.py
@@ -156,11 +156,11 @@ md5sums=('49952a2375b8ee53d8673473f22f8d12'
          '27e4fcacca9b9662dd782fbdc92fceea'
          '2a7f3b34e522acfd08283b86c8926aba'
          'da60447a2a5fe0e6f5aaed2e677281ef'
-         '4239a837227ff97a24c5335de47ce029'
+         'd94deab4efc68ed179a4f59f1a589e74'
          'f0376c98a7986897406d393186c0365e'
          '157e73d0f90d7b306aba8f5921aeedd3'
          '1f58c0393a131f4a8f9a84b3fe08a7e4'
-         '03ab4c6af061da01584b450ec83f26ed'
+         '4dd17c4e1ad6047872fab3a37e9997ed'
          '5f890ea9bda6aef652d2560ca19dac07'
          'ab2aa42c2947148c2b1cac0ade6d1d55'
          'd429b59d3cfb37b0624c6a4a71a7c2c0'
diff --git a/abs/core/LinHES-config/xconfig.sh b/abs/core/LinHES-config/xconfig.sh
index 5514b00..b1e0c18 100755
--- a/abs/core/LinHES-config/xconfig.sh
+++ b/abs/core/LinHES-config/xconfig.sh
@@ -2,29 +2,43 @@
 #set -x
 #SET DISPLAYRES to force Xres, ENV takes precendent over cmdline
 #SET VGACARDTYPE to force card type:
+    #VGACARDTYPE="ati" xconfig.sh
     #VGACARDTYPE="intel" xconfig.sh
     #VGACARDTYPE="nvidia" xconfig.sh
+    #VGACARDTYPE="nvidia-390xx" xconfig.sh
     #VGACARDTYPE="nvidia-340xx" xconfig.sh
     #VGACARDTYPE="nvidia-304xx" xconfig.sh
-    #VGACARDTYPE="VMware" xconfig.sh
     #VGACARDTYPE="vesa" xconfig.sh
+    #VGACARDTYPE="VMware" xconfig.sh
 
 LOGFILE=/tmp/xconfig.log
 echo -e "\n\n--------------------------------------------------------------------------------" >> $LOGFILE 2>&1
 echo -e `date`"\n" >> $LOGFILE 2>&1
 
-for i in ati intel mga savage sis unichrome
+#libxnvctrl is needed as a dep of mythtv so must be installed for every driver
+ATI_PKGS="xf86-video-ati libglvnd libxnvctrl"
+INTEL_PKGS="xf86-video-intel libglvnd libxnvctrl"
+NVIDIA_PKGS="nvidia nvidia-utils opencl-nvidia nvidia-settings libglvnd libxnvctrl"
+NVIDIA-390xx_PKGS="nvidia-390xx nvidia-390xx-utils opencl-nvidia-390xx nvidia-390xx-settings libglvnd libxnvctrl-390xx"
+NVIDIA-340xx_PKGS="nvidia-340xx nvidia-340xx-utils opencl-nvidia-340xx nvidia-340xx-settings libglvnd libxnvctrl-340xx"
+NVIDIA-304xx_PKGS="nvidia-304xx nvidia-304xx-utils opencl-nvidia-304xx libglvnd libxnvctrl-340xx"
+NVIDIA_ALL_PKGS=`echo $NVIDIA_PKGS $NVIDIA-390xx_PKGS $NVIDIA-340xx_PKGS $NVIDIA-304xx_PKGS|xargs -n1|sort -u`
+VESA_PKGS="xf86-video-vesa libglvnd libxnvctrl"
+VMWARE_PKGS="xf86-input-vmmouse xf86-video-vmware xf86-video-vesa svga-dri libglvnd libxnvctrl"
+
+for i in ati intel mga savage sis unichrome vmware
 do
     templist=`echo $i-dri xf86-video-$i`
-    NVPKGS=`echo $NVPKGS  $templist`
+    OTHER_PKGS=`echo $OTHER_PKGS $templist`
 done
 
 BASE=""
 MYTH_RUN_STATUS="1"
 . /etc/profile
 
-NVIDIA_304xx="$TEMPLATES/xorg/304xx_supported.txt"
-NVIDIA_340xx="$TEMPLATES/xorg/340xx_supported.txt"
+NVIDIA_304xx_SUPPORTED="$TEMPLATES/xorg/304xx_supported.txt"
+NVIDIA_340xx_SUPPORTED="$TEMPLATES/xorg/340xx_supported.txt"
+NVIDIA_390xx_SUPPORTED="$TEMPLATES/xorg/340xx_supported.txt"
 NVIDIA_SUPPORTED="$TEMPLATES/xorg/nvidia_supported.txt"
 NVIDIA_DISABLE_MSI="$TEMPLATES/xorg/nvidia_disable_msi.txt"
 NVIDIA_MSI_MODPROBE="$BASE/etc/modprobe.d/nvidia_msi.conf"
@@ -77,12 +91,12 @@ function presetupX {
 
 function nvidia_prepare {
     [[ -f "$NVIDIA_MSI_MODPROBE" ]] && rm -f "$NVIDIA_MSI_MODPROBE"
-    for i in libva-intel-driver mesa-libgl nvidia nvidia-utils nvidia-libgl opencl-nvidia nvidia-settings libxnvctrl libglvnd nvidia-304xx nvidia-304xx-utils nvidia-304xx-libgl opencl-nvidia-304xx nvidia-340xx nvidia-340xx-utils nvidia-340xx-libgl opencl-nvidia-340xx
+    for i in ${$NVIDIA_ALL_PKGS}
     do
         pacman --noconfirm -Rdd $i >> $LOGFILE 2>&1
     done
 
-    for i in `echo ${NVPKGS}`
+    for i in ${OTHER_PKGS}
     do
         pacman --noconfirm -Rc $i >> $LOGFILE 2>&1
     done
@@ -108,14 +122,13 @@ function nvidia_driver_install {
     if [[ $? = 0 || $VGAFORCED -eq 1 && $VGACARDTYPE == "nvidia" ]]
     then
         echo "$CARDNAME" | tee -a $LOGFILE
-        LIST="nvidia nvidia-utils opencl-nvidia nvidia-settings libglvnd"
-        for i in `echo ${LIST}`
+        for i in ${NVIDIA_PKGS}
         do
             pkg_check $i
         done
         echo "Installing current nvidia driver" | tee -a $LOGFILE
         nvidia_prepare
-        pacman --noconfirm -S ${LIST} >> $LOGFILE 2>&1
+        pacman --noconfirm -S ${NVIDIA_PKGS} >> $LOGFILE 2>&1
         if [[ $? != 0 ]]
         then
             echo "ERROR: Unable to install current nvidia driver" | tee -a $LOGFILE
@@ -126,18 +139,39 @@ function nvidia_driver_install {
 
     if [ $INSTALLED -eq 0 ]
     then
-        CARDNAME=`grep -i "$CARDID" "$NVIDIA_340xx"`
+        CARDNAME=`grep -i "$CARDID" "$NVIDIA_390xx_SUPPORTED"`
+        if [[ $? = 0 || $VGAFORCED -eq 1 && $VGACARDTYPE == "nvidia-390xx" ]]
+        then
+            echo "$CARDNAME" | tee -a $LOGFILE
+            for i in ${NVIDIA_390xx_PKGS}
+            do
+                pkg_check $i
+            done
+            echo "Installing nvidia-390xx driver" | tee -a $LOGFILE
+            nvidia_prepare
+            pacman --noconfirm -S ${NVIDIA_390xx_PKGS} >> $LOGFILE 2>&1
+            if [[ $? != 0 ]]
+            then
+                echo "ERROR: Unable to install nvidia-390xx driver" | tee -a $LOGFILE
+            else
+                INSTALLED=1
+            fi
+        fi
+    fi
+
+    if [ $INSTALLED -eq 0 ]
+    then
+        CARDNAME=`grep -i "$CARDID" "$NVIDIA_340xx_SUPPORTED"`
         if [[ $? = 0 || $VGAFORCED -eq 1 && $VGACARDTYPE == "nvidia-340xx" ]]
         then
             echo "$CARDNAME" | tee -a $LOGFILE
-            LIST="nvidia-340xx nvidia-340xx-utils opencl-nvidia-340xx libglvnd"
-            for i in `echo ${LIST}`
+            for i in ${NVIDIA_340xx_PKGS}
             do
                 pkg_check $i
             done
             echo "Installing nvidia-340xx driver" | tee -a $LOGFILE
             nvidia_prepare
-            pacman --noconfirm -S ${LIST} >> $LOGFILE 2>&1
+            pacman --noconfirm -S ${NVIDIA_340xx_PKGS} >> $LOGFILE 2>&1
             if [[ $? != 0 ]]
             then
                 echo "ERROR: Unable to install nvidia-340xx driver" | tee -a $LOGFILE
@@ -149,18 +183,17 @@ function nvidia_driver_install {
 
     if [ $INSTALLED -eq 0 ]
     then
-        CARDNAME=`grep -i "$CARDID" "$NVIDIA_304xx"`
+        CARDNAME=`grep -i "$CARDID" "$NVIDIA_304xx_SUPPORTED"`
         if [[ $? = 0 || $VGAFORCED -eq 1 && $VGACARDTYPE == "nvidia-304xx" ]]
         then
             echo "$CARDNAME" | tee -a $LOGFILE
-            LIST="nvidia-304xx nvidia-304xx-utils opencl-nvidia-304xx libglvnd"
-            for i in `echo ${LIST}`
+            for i in ${NVIDIA_304xx_PKGS}
             do
                 pkg_check $i
             done
             echo "Installing nvidia-304xx driver" | tee -a $LOGFILE
             nvidia_prepare
-            pacman --noconfirm -S ${LIST} >> $LOGFILE 2>&1
+            pacman --noconfirm -S ${NVIDIA_304xx_PKGS} >> $LOGFILE 2>&1
             if [[ $? != 0 ]]
             then
                 echo "ERROR: Unable to install nvidia-304xx driver" | tee -a $LOGFILE
@@ -174,14 +207,13 @@ function nvidia_driver_install {
     then
         #this is a failsafe, can't find the right driver, then use the latest'
         echo "  Couldn't find the card id in any list" | tee -a $LOGFILE
-        LIST="nvidia nvidia-utils opencl-nvidia nvidia-settings libglvnd"
-        for i in `echo ${LIST}`
+        for i in ${NVIDIA_PKGS}
         do
             pkg_check $i
         done
         echo "Installing current nvidia driver" | tee -a $LOGFILE
         nvidia_prepare
-        pacman --noconfirm -S ${LIST} >> $LOGFILE 2>&1
+        pacman --noconfirm -S ${NVIDIA_PKGS} >> $LOGFILE 2>&1
         if [[ $? != 0 ]]
         then
             echo "ERROR: Unable to install current nvidia driver" | tee -a $LOGFILE
@@ -190,8 +222,6 @@ function nvidia_driver_install {
         fi
     fi
 
-    echo "/usr/lib/libXvMCNVIDIA_dynamic.so.1" > "$XVMC_CONFIG"
-
     if [ $INSTALLED -eq 1 ]
     then
         grep -qi "$CARDID" "$NVIDIA_DISABLE_MSI"
@@ -204,37 +234,59 @@ function nvidia_driver_install {
 }
 
 function vmware_driver_install {
-    LIST="xf86-input-vmmouse xf86-video-vmware xf86-video-vesa svga-dri libglvnd"
-    for i in `echo ${LIST}`
+    for i in ${VMWARE_PKGS}
     do
         pkg_check $i
     done
     echo "Installing VMware driver" | tee -a $LOGFILE
     #this is used to remove nvidia
     nvidia_prepare
-    for i in `echo ${LIST}`
+    for i in ${VMWARE_PKGS}
     do
         pacman -S --noconfirm $i >> $LOGFILE 2>&1
     done
 }
 
 function vesa_driver_install {
-    pkg_check xf86-video-vesa
-    pkg_check libglvnd
+    for i in ${VESA_PKGS}
+    do
+        pkg_check $i
+    done
     echo "Installing Vesa driver" | tee -a $LOGFILE
     #this is used to remove nvidia
     nvidia_prepare
-    pacman -S --noconfirm xf86-video-vesa libglvnd  >> $LOGFILE 2>&1
+    for i in ${VESA_PKGS}
+    do
+        pacman -S --noconfirm $i >> $LOGFILE 2>&1
+    done
 }
 
 function intel_driver_install {
-    pkg_check xf86-video-intel
-    pkg_check libglvnd
+    for i in ${INTEL_PKGS}
+    do
+        pkg_check $i
+    done
     echo "Installing Intel driver" | tee -a $LOGFILE
     #this is used to remove nvidia
     nvidia_prepare
-    pacman -S --noconfirm xf86-video-intel libva-intel-driver libglvnd >> $LOGFILE 2>&1
-    echo "/usr/lib/libIntelXvMC.so.1" > "$XVMC_CONFIG"
+    for i in ${INTEL_PKGS}
+    do
+        pacman -S --noconfirm $i >> $LOGFILE 2>&1
+    done
+}
+
+function ati_driver_install {
+    for i in ${ATI_PKGS}
+    do
+        pkg_check $i
+    done
+    echo "Installing ATI driver" | tee -a $LOGFILE
+    #this is used to remove nvidia
+    nvidia_prepare
+    for i in ${ATI_PKGS}
+    do
+        pacman -S --noconfirm $i >> $LOGFILE 2>&1
+    done
 }
 
 function set_res {
@@ -258,7 +310,7 @@ function setupX {
     if [ x = x ]
     then
         case $VGACARDTYPE in
-            nvidia|nvidia-340xx|nvidia-304xx)
+            nvidia|nvidia-390xx|nvidia-340xx|nvidia-304xx)
                     nvidia_driver_install
                     if [[ $Xres != "Auto" ]]
                     then
@@ -298,6 +350,18 @@ function setupX {
                     fi
                 ;;
 
+            ati)
+                    ati_driver_install
+                    #cp $TEMPLATES/xorg/xorg.ati  /etc/X11/xorg.conf.d/20-automv.conf
+                    if [[ $Xres != "Auto" ]]
+                    then
+                        set_res
+                    else
+                        echo "Setting resolution to ${Xres}" | tee -a $LOGFILE
+                        rm -f /etc/X11/xorg.conf.d/30-screen.conf
+                    fi
+                ;;
+
             vesa|innotek|*) #leaving this as * and vesa for no real reason other then it's explicit to catch vesa
                     if [[ $VGACARDTYPE != "vesa" && $VGACARDTYPE != "innotek" ]]
                     then
@@ -387,8 +451,6 @@ fi
 
 
 XORG_CONF="/etc/X11/xorg.conf"
-XVMC_CONFIG="/etc/X11/XvMCConfig"
-
 
 pacman_wait
 presetupX
-- 
cgit v0.12

