diff options
Diffstat (limited to 'abs/core/LinHES-config/xconfig.sh')
-rwxr-xr-x | abs/core/LinHES-config/xconfig.sh | 512 |
1 files changed, 167 insertions, 345 deletions
diff --git a/abs/core/LinHES-config/xconfig.sh b/abs/core/LinHES-config/xconfig.sh index a601352..504da81 100755 --- a/abs/core/LinHES-config/xconfig.sh +++ b/abs/core/LinHES-config/xconfig.sh @@ -11,12 +11,14 @@ do done BASE="" +MYTH_RUN_STATUS="1" . /etc/profile -NVIDIA_96XX="$TEMPLATES/xorg/96xx_supported.txt" -NVIDIA_173="$TEMPLATES/xorg/173_supported.txt" -NVIDIA_SUPPORTED="$TEMPLATES/xorg/nvidia_supported.txt" -MYTHHOME=$BASE/home/mythtv +#MYTHHOME=$BASE/home/mythtv + +. /usr/MythVantage/bin/install_functions.sh +home_check + function Xvalues { CMDLINE=$(cat /proc/cmdline) @@ -32,163 +34,23 @@ function Xvalues { 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" - #currentmode=`cat "$BASE/etc/X11/xorg.conf" | grep Modes | awk -Fs '{ print $2 }'` } function presetupX { - if [ -f /etc/sysconfig/IGNORE_X ] + if [ "$XIgnoreConfig" = 1 ] then - echo "Will not run xconfig.sh due to presence of /etc/sysconfig/IGNORE_X" - return 1 - else - if [ "$XIgnoreConfig" = 1 ] + echo "Using User supplied X" + if [ -f "$MYTHHOME/templates/xorg.user" ] 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 + cp -f "$MYTHHOME/templates/xorg.user" "$XORG_CONF" else - #if [ "$XUseAdvanced" = 1 ] - #then - # setupAdvancedX - #else - setupX - #fi + echo "Didn't find the file" + echo "Copy your config file to $MYTHHOME/templates/xorg.user" > "$XORG_CONF" fi + else + setupX fi - -} - -function setupAdvancedX { - - 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=${Xres} - #echo "$Xcategory" - #echo $Xres - 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 - #ML="\t Modes ${Xres}" -# else -# ML="\t Modes \"${Xres}\"" - fi - - case $Xcardtype in - NVIDIA|nVidia|nvidia) - nvidia_driver_install - case $Xconnection in - DVI) ConnectedMonitor=DFP ;; - vga) ConnectedMonitor=CRT;; - Auto) ConnectedMonitor=Auto;; - TV) ConnectedMonitor=TV - nvidia-xconfig -c /etc/X11/xorg.conf.d/20-automv.conf --tv-standard="$XTVstandard" - nvidia-xconfig -c /etc/X11/xorg.conf.d/20-automv.conf --tv-out-format="$XTVconnection" - # echo "Option \"TVStandard\" \"$XTVstandard\"" >>/tmp/options - # echo "Option \"TVOutFormat\" \"$XTVconnection\"" >> /tmp/options - ;; - *) ConnectedMonitor=Auto;; - esac - if [ "$ConnectedMonitor" = Auto ] - then - echo "auto connection" - else - nvidia-xconfig -c /etc/X11/xorg.conf.d/20-automv.conf --connected-monitor="$ConnectedMonitor" - #echo "Option \"ConnectedMonitor\" \"$ConnectedMonitor\"" >> /tmp/options - #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 -# echo "Option \"UseEdidFreqs\" \"$EDIDFREQ\"" >> /tmp/options -# echo "Option \"IgnoreEDID\" \"$EDIDvalue\"" >> /tmp/options -# -# -# sed -e "s/^.*Modes.*$/${ML}/" \ -# -e "/INSERT MODELINE/r $TEMPLATES/xorg/modeline.$Xcategory" \ -# -e "s/^.*DisplaySize.*$/ $DS/" \ -# -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) - case $Xconnection in - DVI) ConnectedMonitor="tmds1,nocrt1,notv";; - VGA) ConnectedMonitor="crt1,notmds1,notv" ;; - TV) ConnectedMonitor="tv,nocrt1,notmds1" - echo "Option \"TVStandard\" \"$XTVstandard\"" >>/tmp/options - echo "Option \"TVFormat\" \"$XTVconnection\"" >> /tmp/options - ;; - esac - if [ "$XignoreEDID" = 1 ] - then - DS=" DisplaySize $XDisplaysize" - HS=" HorizSync $XHsync" - VR=" VertRefresh $XVrefresh" - else - DS="# Display size edid used " - HS="# Hsync edid used " - VR="# Vertrefresh edid used " - fi - - echo "Option \"ForceMonitors\" \"$ConnectedMonitor\"" >> /tmp/options - - sed -e "s/^.*Modes.*$/\t $ML/" \ - -e "/INSERT MODELINE/r $TEMPLATES/xorg/modeline.$Xcategory" \ - -e "s/^.*DisplaySize.*$/ $DS/" \ - -e "s/^#.*HorizSync.*$/ $HS/g" \ - -e "s/^#.*VertRefresh.*$/ $VR/g" \ - -e "/INSERT HERE/r /tmp/options" "$TEMPLATES/xorg/xorg.conf.ati" > "$XORG_CONF" - ;; - - - - *) - echo "unknown card type" - ;; - esac } function nvidia_prepare { @@ -201,198 +63,167 @@ function nvidia_prepare { 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 { + echo "Installing Nvidia driver" + cp "$TEMPLATES/xorg/xorg.nvidia" $BASE/etc/X11/xorg.conf.d/20-automv.conf + #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 + 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 - cp "$TEMPLATES/xorg/xorg.conf.nvidia" $BASE/etc/X11/xorg.conf.d/20-automv.conf - - installed=0 - if [ "$TESTMODE" != "test" ] - then - - - grep -qi "$CARDID" "$NVIDIA_SUPPORTED" - if [ $? = 0 ] - then - #install latest drivers - 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 - - if [ $installed = 0 ] - then - 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 - - if [ $installed = 0 ] - then - #this is a failsafe, can't find the right driver, then use the latest' - #install latest drivers - echo "Couldn't find the card in the supported list" - echo "Installing current nvidia drivers" - - nvidia_prepare - pacman --noconfirm -S nvidia nvidia-utils >> $LOGFILE 2>&1 - installed=1 - fi - - - fi +} +function vesa_driver_install { + echo "Installing Vesa driver" + echo "Installing Vesa driver" >> $LOGFILE 2>&1 + pacman -S --noconfirm xf86-video-vesa >> $LOGFILE 2>&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 +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" +} - echo "/usr/lib/libXvMCNVIDIA_dynamic.so.1" > "$XVMC_CONFIG" - #rm $BASE/etc/X11/xorg.conf.d/20-nvidia.conf +# 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 set_res { + echo " Setting modeline to ${Xres}" + echo " Setting modeline to ${Xres}" >> $LOGFILE 2>&1 + cat > /etc/X11/xorg.conf.d/30-screen.conf <<EOF + Section "Screen" + Identifier "Screen0" #Collapse Monitor and Device section to Screen section + Device "Device0" + Monitor "Monitor0" + DefaultDepth 24 #Choose the depth (16||24) + SubSection "Display" + Depth 24 + Modes "${Xres}" #Choose the resolution + EndSubSection + EndSection +EOF } function setupX { Xvalues - #echo "$currentmode ____ ${Xres}" - #if [ "${currentmode}" != \"${Xres}\" ] if [ x = x ] then case $VGACARDTYPE in - nVidia) + NVIDIA|nVidia|nvidia) nvidia_driver_install - ;; - - # VMware) - # sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.vmware" > "$XORG_CONF" - # ;; - - VIA|S3) - # There are actually multiple options here - # xf86-video-openchrome - # xf86-video-unichrome - # There is also a seperate driver for the Unichrome Pro - if [ ${Xres} = Auto ] - then - sed -e "/^.*Modes.*$/d" "$TEMPLATES/xorg/xorg.conf.via" > "$XORG_CONF" - else - sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.via" > "$XORG_CONF" - fi - if [ "$TESTMODE" != "test" ] - then - if [ "$OPENCHROME" = "1" ] + if [ \"$Xres\" = "Auto" ] then - pacman --noconfirm -R nvidia nvidia-utils >> $LOGFILE 2>&1 - pacman --noconfirm -S libgl unichrome-dri xf86-video-openchrome >> $LOGFILE 2>&1 - else - pacman --noconfirm -R nvidia nvidia-utils >> $LOGFILE 2>&1 - pacman --noconfirm -S libgl unichrome-dri xf86-video-unichrome >> $LOGFILE 2>&1 + Xres="nvidia-auto-select" fi - fi - # I'm making educated guesses here... - if lspci | grep "VGA" | grep -qi "Unichrome Pro" - then - if [ -f "/usr/lib/libchromeXvMCPro.so.1" ] + + if [ ${Xres} != "Auto" ] then - echo "/usr/lib/libchromeXvMCPro.so.1" > "$XVMC_CONFIG" + set_res else - echo "/usr/lib/libviaXvMCPro.so.1" > "$XVMC_CONFIG" + rm -f /etc/X11/xorg.conf.d/30-screen.conf fi - else - if [ -f "/usr/lib/libchromeXvMC.so.1" ] + ;; + + VMware) + 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 "#!/bin/bash" > /etc/X11/autostart/vmware.sh + echo "/usr/bin/vmware-user-suid-wrapper" >> /etc/X11/autostart/vmware.sh + chmod 755 /etc/X11/autostart/vmware.sh + if [ ${Xres} != "Auto" ] then - echo "/usr/lib/libchromeXvMC.so.1" > "$XVMC_CONFIG" + set_res else - echo "/usr/lib/libviaXvMC.so.1" > "$XVMC_CONFIG" + rm -f /etc/X11/xorg.conf.d/30-screen.conf fi - fi - ;; + ;; 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) - 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 - ;; - - *) - XCONF=/root/xorg.conf.new - XCONFB=/etc/X11/xorg.conf.install - X -configure - if [ -f "$XCONF" ] - then - echo "Using $XCONF" - if [ ${Xres} = Auto ] + intel_driver_install + cp $TEMPLATES/xorg/xorg.intel /etc/X11/xorg.conf.d/20-automv.conf + if [ ${Xres} != "Auto" ] then - grep -v Modes "$XCONF" | sed -e 's/dev\/mouse/dev\/psaux/g'> "$XORG_CONF" + set_res else - grep -v Modes "$XCONF" | sed -e "/Depth.*16/a Modes \"${Xres}\" " -e "/Depth.*24/a Modes \"${Xres}\"" -e 's/dev\/mouse/dev\/psaux/g'> "$XORG_CONF" + rm -f /etc/X11/xorg.conf.d/30-screen.conf fi - elif [ -f "$XCONFB" ] - then - echo "Using $XCONFB" - if [ ${Xres} = Auto ] + ;; + + 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" "$XCONFB" > "$XORG_CONF" + set_res else - sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$XCONFB" > "$XORG_CONF" + rm -f /etc/X11/xorg.conf.d/30-screen.conf fi - else - echo "Xorg configuration failed" - fi - rm -f "$XCONF" >> $LOGFILE 2>&1 + ;; + esac fi } + +#--------------------------------------------------------------------------------- #MAIN @@ -400,52 +231,43 @@ LINE=`grep -i xorg /etc/mythvantage.cfg|grep -q False` rc=$? if [ $rc = 0 ] then - echo "xorg configuration disabled in /etc/mythvantage.cfg" - exit 0 + echo "** xorg configuration disabled in /etc/mythvantage.cfg" + exit 1 fi -TESTMODE="$1" -if [ "$TESTMODE" = "test" ] +if [ -f /etc/sysconfig/IGNORE_X ] then - XORG_CONF="/tmp/xorg.conf.test" - XVMC_CONFIG="/tmp/XvMCConfig.test" - XUseAdvanced="1" - XIgnoreConfig="${2}" - Xcardtype="${3}" - XIgnoreEDID="${4}" - Xconnection="${5}" - XHsync="${6}" - XVrefresh="${7}" - Xresadvanced="${8}" - XTVstandard="${9}" - XTVconnection="${10}" - XDisplaysize="${11}" -else - 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 + echo "** Will not run xconfig.sh due to presence of /etc/sysconfig/IGNORE_X" + exit 1 +fi - XORG_CONF="/etc/X11/xorg.conf" - XVMC_CONFIG="/etc/X11/XvMCConfig" +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 |