Show
Ignore:
Timestamp:
05/12/08 10:03:54 (4 months ago)
Author:
kris
Message:

Fixed up the problems with loading NVIDIA from the XGUI tool on FreeBSD 7.
Turns out you have to load nvidia driver from /boot/loader.conf at bootup
instead of kldload as on 6.x. Script takes this into account and prompts to
reboot when an nvidia driver is choosen.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pcbsd/trunk/system-overlay/PCBSD/xorg-gui/bin/rundetect.sh

    r697 r1890  
    2525echo "`clear`" >/dev/console 
    2626 
    27  
    28 echo "Determining monitor refresh rate capabilities..." >/dev/console 
    29 X -configure 2>/dev/null 
    30  
    31 # Clear out any old refresh rates 
    32 rm /tmp/.horzsync >/dev/null 2>/dev/null 
    33 rm /tmp/.vertsync >/dev/null 2>/dev/null 
    34  
    35 # Check for refresh rate lines 
    36 cat /root/xorg.conf.new | grep HorizSync >/dev/null 2>/dev/null 
    37 if [ "$?" = "0" ] 
    38 then 
     27# If we have rebooted for nvidia drivers, skip some inital setup 
     28if [ ! -e "/PCBSD/xorg-gui/.nvidiareboot" ] 
     29then 
     30 rm /PCBSD/xorg-gui/.xsettings.sh >/dev/null 2>/dev/null 
     31 
     32 # Move any existing xorg.conf file 
     33 if [ -e "/etc/X11/xorg.conf" ] 
     34 then 
     35    mv /etc/X11/xorg.conf /etc/X11/xorg.conf.bak 
     36 fi 
     37 
     38 
     39 echo "Determining monitor refresh rate capabilities..." >/dev/console 
     40 X -configure 2>/dev/null 
     41 
     42 # Clear out any old refresh rates 
     43 rm /tmp/.horzsync >/dev/null 2>/dev/null 
     44 rm /tmp/.vertsync >/dev/null 2>/dev/null 
     45 
     46 # Check for refresh rate lines 
     47 cat /root/xorg.conf.new | grep HorizSync >/dev/null 2>/dev/null 
     48 if [ "$?" = "0" ] 
     49 then 
    3950  cat /root/xorg.conf.new | grep HorizSync > /tmp/.horzsync 
    40 fi 
    41  
    42 cat /root/xorg.conf.new | grep VertRefresh >/dev/null 2>/dev/null 
    43 if [ "$?" = "0" ] 
    44 then 
     51 fi 
     52 
     53 cat /root/xorg.conf.new | grep VertRefresh >/dev/null 2>/dev/null 
     54 if [ "$?" = "0" ] 
     55 then 
    4556  cat /root/xorg.conf.new | grep VertRefresh > /tmp/.vertsync 
    46 fi 
     57 fi 
     58 
     59fi # End of skip for nvidia reboot 
    4760 
    4861echo "Please wait... Start X-Configuration Utility" >/dev/console 
     
    6679cd /root/ 
    6780 
    68 # Move any existing xorg.conf file 
    69 if [ -e "/etc/X11/xorg.conf" ] 
    70 then 
    71    mv /etc/X11/xorg.conf /etc/X11/xorg.conf.bak 
    72 fi 
    7381 
    7482# Recreate our log file 
     
    8189echo "" > ${XLOG} 
    8290 
     91 
    8392# Remove any files from a previous attempt 
    84 rm /PCBSD/xorg-gui/.done >/dev/null 2>/dev/null 
    85 rm /PCBSD/xorg-gui/.xsettings.sh >/dev/null 2>/dev/null 
    8693rm /PCBSD/xorg-gui/.canceled >/dev/null 2>/dev/null 
    8794rm /PCBSD/xorg-gui/.selected >/dev/null 2>/dev/null 
     95rm /PCBSD/xorg-gui/.rerunxsetup >/dev/null 2>/dev/null 
     96rm /PCBSD/xorg-gui/.done >/dev/null 2>/dev/null 
    8897 
    8998 
     
    98107do 
    99108 
    100 # Save the previous xorg.conf file for troubleshooting 
    101 if [ -e "/etc/X11/xorg.conf" ] 
    102 then 
     109# If we have rebooted for nvidia drivers go straight to confirm screen 
     110if [ ! -e "/PCBSD/xorg-gui/.nvidiareboot" ] 
     111then 
     112 # Save the previous xorg.conf file for troubleshooting 
     113 if [ -e "/etc/X11/xorg.conf" ] 
     114 then 
    103115  mv /etc/X11/xorg.conf /etc/X11/xorg.conf.previous 
    104 fi 
     116 fi 
    105117 
    106118 
    107119if [ "${ATTEMPT}" = "0" ] 
    108120then 
     121 
    109122  # Use the saved xorg.conf.basic file 
    110123  echo "Using saved /PCBSD/xorg-gui/conf/xorg.conf.basic from install..." >/dev/console 
    111124  cp /PCBSD/xorg-gui/conf/xorg.conf.basic /etc/X11/xorg.conf 
     125 
    112126elif [ "${ATTEMPT}" = "1" ] 
    113127then 
     128 
    114129  # Try running the driver detection again 
    115130  rm /etc/X11/xorg.conf 
    116131  echo "Saved configuration failed... Running auto-detect..." >/dev/console 
    117132  /PCBSD/xorg-gui/cardDetect/x_config.sh 
    118 else 
     133 
     134else 
     135 
    119136  # Still failed, drop to VESA failsafe 
    120137  echo "Auto-detected settings failed... Using failsafe VESA 1024x768 mode..." >/dev/console 
    121138  rm /etc/X11/xorg.conf 
    122139  cp /PCBSD/xorg-gui/cardDetect/XF86Config.compat /etc/X11/xorg.conf 
     140 
    123141fi 
    124142 
     
    129147  rm /PCBSD/xorg-gui/.failed 
    130148 
    131   ##### Create the xinitrc file 
    132 echo '#!/bin/sh 
     149 ##### Create the xinitrc file 
     150 echo '#!/bin/sh 
    133151touch /PCBSD/xorg-gui/.xstartupsuccess 
    134152/usr/local/bin/fluxbox & 
     
    143161kill -9 ${PID} 
    144162' > /root/.xinitrc 
    145 chmod 755 /root/.xinitrc 
    146  
    147 else 
    148  
    149 ##### Create the xinitrc file 
    150 echo '#!/bin/sh 
     163 chmod 755 /root/.xinitrc 
     164 
     165 else 
     166 
     167 ##### Create the xinitrc file 
     168 echo '#!/bin/sh 
    151169touch /PCBSD/xorg-gui/.xstartupsuccess 
    152170/usr/local/bin/fluxbox & 
    153171PID=$! 
    154 #kdialog --msgbox "PC-BSD will now allow you to setup your monitor resolution and video settings.\n If your system is equipped with a 3D card, please select the appropriate driver. This will enable you to run the 3D desktop, Beryl.\n\nNOTE: Beryl requires a color depth of 24." 
    155172/PCBSD/xorg-gui/bin/XGUI 
    156173if [ "$?" = "1" ] 
     
    159176 echo "Canceled" > /PCBSD/xorg-gui/.canceled 
    160177fi 
     178 
     179cat /PCBSD/xorg-gui/.xsettings.sh | grep nvidia >/dev/null 
     180if [  "$?" = "0" ] 
     181then 
     182 ls /dev/nvidiactl* >/dev/null 
     183 if [ "$?" != "0" ] 
     184 then 
     185   /usr/local/bin/kdialog --msgbox "The system will be rebooted to load the NVIDIA kernel module. You will be asked to confirm the resolution after bootup." 
     186   touch /PCBSD/xorg-gui/.nvidiareboot 
     187   touch /PCBSD/xorg-gui/.rerunxsetup 
     188 fi 
     189fi 
     190 
    161191kill -9 ${PID} 
    162192' > /root/.xinitrc 
    163 chmod 755 /root/.xinitrc 
    164  
    165  
    166 fi 
    167  
    168  
    169 echo "Please wait... Starting X..." >/dev/console 
    170 sleep 1 
    171 # Start the X gui 
    172 /usr/local/bin/startx 2>>${XLOG} 
    173  
    174  
    175  
    176 # The user canceled the dialog, and chose to use the default 
    177 if [ -e "/PCBSD/xorg-gui/.canceled" ] 
    178 then 
    179   break 
    180 fi 
     193 chmod 755 /root/.xinitrc 
     194 
     195  
     196 fi 
     197 
     198 
     199 echo "Please wait... Starting X..." >/dev/console 
     200 sleep 1 
     201 # Start the X gui 
     202 /usr/local/bin/startx 2>>${XLOG} 
     203 
     204# if the user chose an nvidia driver and we need to reboot, do it 
     205if [ -e "/PCBSD/xorg-gui/.nvidiareboot" ] 
     206then 
     207 #### Create the new XF86Config file with the user settings 
     208 echo "Generating new Xorg configuration file..." >/dev/console 
     209 /PCBSD/xorg-gui/bin/setupconf.sh >>${XLOG} 2>>${XLOG} 
     210fi 
     211 
     212 # The user canceled the dialog, and chose to use the default 
     213 if [ -e "/PCBSD/xorg-gui/.canceled" ] 
     214 then 
     215   break 
     216 fi 
     217 
     218fi # End of nvidia skip 
    181219 
    182220# Check if a new version of xorg.conf is ready to be tested 
     
    185223 
    186224rm /PCBSD/xorg-gui/.selected >/dev/null 2>/dev/null 
    187  
    188 #### Create the new XF86Config file with the user settings 
    189 echo "Generating new Xorg configuration file..." >/dev/console 
    190 /PCBSD/xorg-gui/bin/setupconf.sh >>${XLOG} 2>>${XLOG} 
     225if [ ! -e "/PCBSD/xorg-gui/.nvidiareboot" ] 
     226then 
     227  #### Create the new XF86Config file with the user settings 
     228  echo "Generating new Xorg configuration file..." >/dev/console 
     229  /PCBSD/xorg-gui/bin/setupconf.sh >>${XLOG} 2>>${XLOG} 
     230else 
     231 # Remove the old nvidareboot file 
     232 rm /PCBSD/xorg-gui/.nvidiareboot 
     233fi 
    191234 
    192235##### Create the xinitrc file