#!/bin/bash #set -x #SET DISPLAYRES to force Xres, ENV takes precendent over cmdline LOGFILE=/tmp/xconfig.log for i in ati intel mga savage sis unichrome do templist=`echo $i-dri xf86-video-$i` NVPKGS=`echo $NVPKGS $templist` done BASE="" MYTH_RUN_STATUS="1" . /etc/profile MYTHHOME=$BASE/home/mythtv function Xvalues { CMDLINE=$(cat /proc/cmdline) echo "$CMDLINE" | grep -q forceXvesa if [ $? = 0 ] then echo "Forcing driver to vesa" VGACARDTYPE=vesa Xcardtype=$VGACARDTYPE else VGACARDTYPE=`lspci | grep -i vga | sort -r | head -n 1 | cut -d: -f3 | cut -d" " -f2` VGAPCIID=`lspci | grep -i vga | sort -r | head -n 1 | cut -d" " -f1` CARDID=`lspci -n | grep "$VGAPCIID" | grep 10de | cut -d" " -f3 | cut -d: -f2` VENDORID=`lspci -n | grep "$VGAPCIID" | grep 10de | cut -d" " -f3 | cut -d: -f1` fi echo "Detected $VGACARDTYPE as the video card type" } function presetupX { if [ "$XIgnoreConfig" = 1 ] then echo "Using User supplied X" if [ -f "$MYTHHOME/templates/xorg.user" ] then cp -f "$MYTHHOME/templates/xorg.user" "$XORG_CONF" else echo "Didn't find the file" echo "Copy your config file to $MYTHHOME/templates/xorg.user" > "$XORG_CONF" fi else setupX fi } function nvidia_prepare { for i in libgl nvidia nvidia-utils nvidia-173xx nvidia-173xx-utils nvidia-96xx nvidia-96xx-utils do pacman --noconfirm -Rdd $i >> $LOGFILE 2>&1 done for i in `echo ${NVPKGS}` do pacman --noconfirm -Rc $i >> $LOGFILE 2>&1 done } function pkg_check () { echo " Checking for $1 in cache or online" pacman --noconfirm -Sw $1 >> $LOGFILE 2>&1 rc=$? if [ $rc != 0 ] then echo " Couldn't find $1 for install, aborting" echo " Couldn't find $1 for install, aborting" >> $LOGFILE 2>&1 exit 1 fi } function nvidia_driver_install { 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 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" } # if [ "$Xcategory" = "Nvidia" ] # then # #Xres="" # if [ "$XnVidia1080p" = "1" ] # then # Xres="${Xres} 1920x1080_60" # fi # if [ "$XnVidia1080i" = "1" ] # then # Xres="${Xres} 1920x1080_60i" # fi # if [ "$XnVidia720p" = "1" ] # then # Xres="${Xres} 1280x720_60" # fi # if [ "$XnVidia480p" = "1" ] # then # Xres="${Xres} 720x480_60" # fi function setupX { Xvalues if [ x = x ] then case $VGACARDTYPE in NVIDIA|nVidia|nvidia) nvidia_driver_install ;; VMware) sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.vmware" > "$XORG_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" ;; 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 ;; esac fi } #--------------------------------------------------------------------------------- #MAIN LINE=`grep -i xorg /etc/mythvantage.cfg|grep -q False` rc=$? if [ $rc = 0 ] then echo "** xorg configuration disabled in /etc/mythvantage.cfg" exit 1 fi if [ -f /etc/sysconfig/IGNORE_X ] then echo "** Will not run xconfig.sh due to presence of /etc/sysconfig/IGNORE_X" exit 1 fi if [ -f /etc/systemconfig ] then . /etc/systemconfig else Xres="800x600" fi CMDLINE=$(cat /proc/cmdline) echo $CMDLINE | grep -q displayres if [ $? = 0 ] then TEMPVAR=${CMDLINE#*displayres=} DSR=${TEMPVAR%% *} fi if [ ! x$DSR = x ] then Xres=$DSR fi if [ ! x$DISPLAYRES = x ] then Xres=$DISPLAYRES fi XORG_CONF="/etc/X11/xorg.conf" XVMC_CONFIG="/etc/X11/XvMCConfig" presetupX