slitaz-tools diff tinyutils/hwsetup @ rev 498

Update wiki links
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jul 09 18:44:39 2010 +0200 (2010-07-09)
parents ba631807a0e1
children 5299601a32b9
line diff
     1.1 --- a/tinyutils/hwsetup	Thu Apr 29 07:11:47 2010 -0400
     1.2 +++ b/tinyutils/hwsetup	Fri Jul 09 18:44:39 2010 +0200
     1.3 @@ -1,7 +1,7 @@
     1.4  #!/bin/sh
     1.5  # usage: hwsetup [device]
     1.6  # e.g.,  hwsetup printer
     1.7 -# #  
     1.8 +# #
     1.9  # (c) - SliTaz GNU/Linux 2009 - GNU GPL v3
    1.10  # Authors : Rohit Joshi <jozee@slitaz.org>
    1.11  #
    1.12 @@ -28,8 +28,8 @@
    1.13    3g-modem	3g-modem setup.
    1.14    firewall	start/stop firewall.
    1.15    nvidia	Nvidia (non-free/free) setup.
    1.16 -  ati		ATI (non-free/free) setup.  
    1.17 -  
    1.18 +  ati		ATI (non-free/free) setup.
    1.19 +
    1.20  \033[1mOptions: \033[0m
    1.21    --non-free	install non-free packages (nvidia, ati).
    1.22    --suggested	auto-install optional dependencies.
    1.23 @@ -43,19 +43,19 @@
    1.24  	. /etc/rcS.conf
    1.25  	if ! echo "$RUN_DAEMONS" | grep -q "$1"; then
    1.26  		sed -i "s/^RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"\1 $1\"/" /etc/rcS.conf
    1.27 -	fi	
    1.28 +	fi
    1.29  }
    1.30  
    1.31  device()
    1.32  {
    1.33  	case "$DEVICE" in
    1.34 -  		printer) 
    1.35 +  		printer)
    1.36  			DEPENDS="$DEPENDS cups cups-pdf usbutils hal-info ghostscript aspell aspell-en"
    1.37  			SUGGESTED="hplip gutenprint foomatic-filters foomatic-db hal-cups-utils foomatic-db-nonfree ufr2 splix"
    1.38  			CONFIRM_SUGGESTED="yes"
    1.39 -			GROUP="lp"					
    1.40 +			GROUP="lp"
    1.41  			;;
    1.42 -		scanner) 
    1.43 +		scanner)
    1.44  			DEPENDS="$DEPENDS xsane usbutils hal-info"
    1.45  			SUGGESTED="hplip"
    1.46  			GROUP="scanner lp"
    1.47 @@ -64,8 +64,8 @@
    1.48      		DEPENDS="$DEPENDS v4l-dvb usbutils hal-info"
    1.49  			SUGGESTED="xorg-xf86-video-v4l linux-video libv4l "
    1.50  			GROUP="video audio lp"
    1.51 -			;;				
    1.52 -		camera)  
    1.53 +			;;
    1.54 +		camera)
    1.55      	    DEPENDS="$DEPENDS gphoto2 usbutils hal-info"
    1.56  			SUGGESTED=""
    1.57  			GROUP="camera lp"
    1.58 @@ -74,7 +74,7 @@
    1.59  			DEPENDS="$DEPENDS bluez usbutils hal-info pygobject dbus-python"
    1.60  			SUGGESTED=""
    1.61  			GROUP="lp"
    1.62 -			;;	
    1.63 +			;;
    1.64  		3g-modem)
    1.65      		DEPENDS="$DEPENDS linux-dialup wvdial pcmciautils usbutils hal-info"
    1.66  			SUGGESTED=""
    1.67 @@ -89,18 +89,18 @@
    1.68      		DEPENDS="mesa mesa-demos linux-agp xorg-xf86-video-nv"
    1.69      		NON_FREE_DEPENDS="mesa mesa-demos linux-agp nvidia"
    1.70      		SUGGESTED=""
    1.71 -			GROUP="video"			
    1.72 +			GROUP="video"
    1.73  			;;
    1.74  		ati)
    1.75      		DEPENDS=" xorg-xf86-video-ati mesa-dri-ati mesa-demos"
    1.76      		NON_FREE_DEPENDS="mesa mesa-demos mesa-dri linux-agp catalyst"
    1.77      		SUGGESTED=""
    1.78 -			GROUP="video"			
    1.79 -			;;				
    1.80 +			GROUP="video"
    1.81 +			;;
    1.82  	esac
    1.83  }
    1.84  
    1.85 -# Check if user is root 
    1.86 +# Check if user is root
    1.87  check_root()
    1.88  {
    1.89  	if test $(id -u) != 0 ; then
    1.90 @@ -137,12 +137,12 @@
    1.91  		if [ ! -d /var/lib/tazpkg/installed/"$pkg" ]; then
    1.92  			echo "installing pkg: $pkg"
    1.93  			tazpkg get-install "$pkg" --forced
    1.94 -			if tazpkg list-files "$pkg" | grep -q "/etc/udev" ; then 
    1.95 +			if tazpkg list-files "$pkg" | grep -q "/etc/udev" ; then
    1.96  			   UDEV_RULES="yes"
    1.97  			fi
    1.98  		fi
    1.99  	done
   1.100 -	
   1.101 +
   1.102  }
   1.103  # Install DEPENDS and/or SUGGESTED
   1.104  confirm_install()
   1.105 @@ -154,12 +154,12 @@
   1.106  			echo -n " Would you like to install pkg: $pkg (y/N) ? "; read anser
   1.107  			if [ "$anser" == "y" ]; then
   1.108  				tazpkg get-install "$pkg" --forced
   1.109 -				if tazpkg list-files "$pkg" | grep -q "/etc/udev" ; then 
   1.110 +				if tazpkg list-files "$pkg" | grep -q "/etc/udev" ; then
   1.111  			   		UDEV_RULES="yes"
   1.112  				fi
   1.113 -			fi				
   1.114 +			fi
   1.115  		fi
   1.116 -	done	
   1.117 +	done
   1.118  }
   1.119  
   1.120  add_all_user_to_group()
   1.121 @@ -171,7 +171,7 @@
   1.122  			if ! grep -q "$grp.*$user.*" /etc/group ; then
   1.123  				echo "adding $user to $grp"
   1.124  				addgroup "$user" "$grp"
   1.125 -			fi	
   1.126 +			fi
   1.127  		done
   1.128  	done
   1.129  }
   1.130 @@ -184,19 +184,19 @@
   1.131    		camera)  PATTERN="Cls=00" ;;
   1.132    		bluetooth) PATTERN="Cls=e0" ;;
   1.133    	esac
   1.134 -  	  	
   1.135 -	if [ -f /proc/bus/usb/devices ]; then 
   1.136 +
   1.137 +	if [ -f /proc/bus/usb/devices ]; then
   1.138  	   # no vendor entry in dmesg ??
   1.139  	   #dmesglogs=`dmesg | tail -20`
   1.140  	   DETECTED="no"
   1.141  	   count=1
   1.142 -	   
   1.143 +
   1.144  	   # assume device to be in last 3 entries; use tac
   1.145  	   DEVICES_LIST=`cat /proc/bus/usb/devices | grep ^[TDP] | grep -B1 -A1 "$PATTERN" | grep -i vendor | \
   1.146  	   awk ' { print $2,$3 } ' | sed 's/ /   /'|sed 's/Vendor=//' | sed 's/ProdID=//' | tail -3`
   1.147  	   echo "Detected USB Device : Vendor : Product"
   1.148  	   echo "========================================"
   1.149 -	   echo "$DEVICES_LIST" | while read line 
   1.150 +	   echo "$DEVICES_LIST" | while read line
   1.151  	   do
   1.152  	      vendorid=`echo "$line" | awk '{ print $1 }'`
   1.153  	      productid=`echo "$line" | awk '{ print $2 }'`
   1.154 @@ -205,44 +205,44 @@
   1.155  	   	  echo " $count) Vendor  : $vendor "
   1.156  	   	  echo "    Product : $product"
   1.157  	   	  echo "========================================"
   1.158 -	   	  count=`expr $count + 1`		  
   1.159 -	   done   
   1.160 +	   	  count=`expr $count + 1`
   1.161 +	   done
   1.162  	    # confirm (use dmesg or some other way to automate this)
   1.163 -	   	  confirm_device	  
   1.164 +	   	  confirm_device
   1.165  	fi
   1.166  }
   1.167  
   1.168  confirm_device()
   1.169  {
   1.170  	echo -n " Which no. is your $DEVICE shown in the above lines (1,2,3,none);  ? "; read choice
   1.171 -	
   1.172 +
   1.173  	case "$choice" in
   1.174  	 [nN*]) DETECTED="no" ;;
   1.175 -	 
   1.176 +
   1.177  	 *) 	dev=`echo "$DEVICES_LIST" | head -$choice | tail -1`
   1.178  			vendorid=`echo "$dev" | awk '{ print $1 }'`
   1.179  			productid=`echo "$dev" | awk '{ print $2 }'`
   1.180  			bus=`grep -B2 ".*$vendorid.*$productid" /proc/bus/usb/devices| grep Bus`
   1.181  			busno=` echo $bus|  awk '{ print $2 }' |cut -d "=" -f 2`
   1.182 -			deviceno=`echo $bus| awk '{ print $8 }' `	
   1.183 +			deviceno=`echo $bus| awk '{ print $8 }' `
   1.184  			HP=`echo $vendor | grep -q -i "Hewlett"`
   1.185 -			DETECTED="yes"		
   1.186 +			DETECTED="yes"
   1.187  			;;
   1.188  	esac
   1.189 -	
   1.190 -	
   1.191 +
   1.192 +
   1.193  }
   1.194  
   1.195  hputil()
   1.196  {
   1.197 -	if [ "$HP" == "1" ]; then 
   1.198 +	if [ "$HP" == "1" ]; then
   1.199  	 	install "hplip"
   1.200  		echo ""
   1.201  		echo -n " Do you want to use hp-setup utility (y/N) ? "; read choice
   1.202  		if [ "$choice" == "y" ]; then
   1.203  		  hp-setup
   1.204  		fi
   1.205 -	fi	
   1.206 +	fi
   1.207  }
   1.208  
   1.209  # udev now should do this correctly
   1.210 @@ -253,67 +253,65 @@
   1.211  		if ls /dev/bus/usb/*$busno/*$deviceno ; then
   1.212  			chmod 666 /dev/bus/usb/*$busno/*$deviceno
   1.213  			chgrp $grp /dev/bus/usb/*$busno/*$deviceno
   1.214 -			echo "========================================"		
   1.215 +			echo "========================================"
   1.216  			echo -e "\033[1m Verify $DEVICE Permissions \033[0m "
   1.217  			echo " Your $DEVICE must be in $grp group with 666 permissions"
   1.218 -			ls -l /dev/bus/usb/*$busno/*$deviceno		
   1.219 -			echo "========================================"			
   1.220 +			ls -l /dev/bus/usb/*$busno/*$deviceno
   1.221 +			echo "========================================"
   1.222  		fi
   1.223 -	fi	
   1.224 -	
   1.225 +	fi
   1.226 +
   1.227  }
   1.228  
   1.229  fix_parallel_permissions()
   1.230  {
   1.231   	if [ -f /usr/lib/cups/backend/parallel ] ; then
   1.232 - 		chmod 0755 /usr/lib/cups/backend/parallel	
   1.233 + 		chmod 0755 /usr/lib/cups/backend/parallel
   1.234   	fi
   1.235  }
   1.236  
   1.237  load_modules()
   1.238  {
   1.239  	tazhw detect-pci
   1.240 -	tazhw detect-usb	
   1.241 +	tazhw detect-usb
   1.242  	sleep 1
   1.243  }
   1.244  
   1.245  udev()
   1.246  {
   1.247 -	
   1.248 +
   1.249  	if [ "$UDEV_RULES" == "yes" ]; then
   1.250  		echo "new udev rules are added by a package"
   1.251  		udevadm trigger
   1.252  		sleep 2
   1.253  	fi
   1.254 -	
   1.255 +
   1.256  }
   1.257  
   1.258  xorg()
   1.259  {
   1.260 -	
   1.261 -	[ -x /usr/bin/Xorg ] || install "xorg" 
   1.262 +
   1.263 +	[ -x /usr/bin/Xorg ] || install "xorg"
   1.264  	echo "Auto configuring Xorg.."
   1.265  	# Xorg auto configuration.
   1.266 -	if [ ! -s /etc/X11/xorg.conf -a -x /usr/bin/Xorg ]; then
   1.267 +	if [ ! -d /etc/X11/xorg.conf.d -a -x /usr/bin/Xorg ]; then
   1.268  		echo "Configuring Xorg..."
   1.269 -		# generate xorg.conf if no xorg.conf (shifting from xvesa to xorg)
   1.270 -		Xorg -configure
   1.271 -		mv -f /root/xorg.conf.new /etc/X11/xorg.conf
   1.272 +		# Populate /etc/X11/xorg.conf.d if it doesn't exist.
   1.273  		sed -i 's|/usr/bin/Xvesa|/usr/bin/Xorg|' /etc/slim.conf
   1.274  		sed -i s/"^xserver_arguments"/'\#xserver_arguments'/ /etc/slim.conf
   1.275  		tazx config-xorg
   1.276  	fi
   1.277 -	
   1.278 +
   1.279  }
   1.280  
   1.281  wvdialbox()
   1.282  {
   1.283 -	# setup your modem  
   1.284 -	#wvdialconf						
   1.285 +	# setup your modem
   1.286 +	#wvdialconf
   1.287  	echo "===================================="
   1.288  	#set username, password, pin
   1.289  	#echo -e "Edit \033[1m /etc/wvdial.conf \033[0m  for phone number, login name, password and pin"
   1.290 -	if [ ! -f /etc/wvdial.conf ]; then 
   1.291 +	if [ ! -f /etc/wvdial.conf ]; then
   1.292  	    APN="apn.yournet.net"
   1.293  	    PHONE="*99#"
   1.294  	    USERNAME="user"
   1.295 @@ -330,7 +328,7 @@
   1.296  		echo "Baud = 460800" >> /etc/wvdial.conf
   1.297  		echo "Init1 = ATZ " >> /etc/wvdial.conf
   1.298  		echo "Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0" >> /etc/wvdial.conf
   1.299 -		echo "Init3 = AT+CGDCONT=1,\"IP\", \"$APN\"" >> /etc/wvdial.conf		
   1.300 +		echo "Init3 = AT+CGDCONT=1,\"IP\", \"$APN\"" >> /etc/wvdial.conf
   1.301  		echo "ISDN = 0" >> /etc/wvdial.conf
   1.302  		echo "Modem Type = Analog Modem" >> /etc/wvdial.conf
   1.303  		echo "" >> /etc/wvdial.conf
   1.304 @@ -342,14 +340,14 @@
   1.305  	#<action>sed -i "s/^\[Dialer.*/[Dialer slitaz]/" /etc/wvdial.conf</action>
   1.306  	#DIALER=`grep Dialer /etc/wvdial.conf | sed \'2d\'|tr \"[]\" \" \"|cut -d \" \" -f 3`
   1.307  	#DIALER=`grep -B1 AT+CPIN /etc/wvdial.conf | sed \'2d\'|tr \"[]\" \" \"|cut -d \" \" -f 3`
   1.308 -	
   1.309 +
   1.310  MAIN_DIALOG="
   1.311  <window title=\"Wvdial Box\" icon-name=\"applications-internet\">
   1.312  <vbox>
   1.313 -	
   1.314 +
   1.315  "
   1.316  	MAIN_DIALOG=${MAIN_DIALOG}'
   1.317 -	   
   1.318 +
   1.319         <hbox>
   1.320  			<text use-markup="true">
   1.321  				<label>"<b>Phone Number:   </b>"</label>
   1.322 @@ -403,8 +401,8 @@
   1.323  				<input>cat /etc/wvdial.conf | grep AT+CGDCONT | cut -d "," -f3 | tr -d "[\" ]"</input>
   1.324  				<variable>APN</variable>
   1.325  			</entry>
   1.326 -		</hbox>	
   1.327 -			
   1.328 +		</hbox>
   1.329 +
   1.330  
   1.331  		<hbox>
   1.332  			<text use-markup="true">
   1.333 @@ -428,32 +426,32 @@
   1.334  				<label>Save Configuration</label>
   1.335  				<input file icon="document-save"></input>
   1.336  				<action>sed -i "s/^Phone.*/Phone = $PHONE/ " /etc/wvdial.conf</action>
   1.337 -				<action>sed -i "s/^Username.*/Username = $USERNAME/ " /etc/wvdial.conf</action>	
   1.338 -				<action>sed -i "s/^Password.*/Password = $PASSWORD/ " /etc/wvdial.conf</action>	
   1.339 +				<action>sed -i "s/^Username.*/Username = $USERNAME/ " /etc/wvdial.conf</action>
   1.340 +				<action>sed -i "s/^Password.*/Password = $PASSWORD/ " /etc/wvdial.conf</action>
   1.341  				<action>sed -i "s/.*AT+CPIN=.*/Init4 = AT+CPIN=$PIN/ " /etc/wvdial.conf</action>
   1.342 -				<action>sed -i "s/.*AT+CGDCONT=.*/Init3 = AT+CGDCONT=1,\"IP\", \"$APN\" /" /etc/wvdial.conf </action>												
   1.343 -				<action>sed -i "s:^Modem.*/dev.*:Modem = $MODEM: " /etc/wvdial.conf</action>	
   1.344 +				<action>sed -i "s/.*AT+CGDCONT=.*/Init3 = AT+CGDCONT=1,\"IP\", \"$APN\" /" /etc/wvdial.conf </action>
   1.345 +				<action>sed -i "s:^Modem.*/dev.*:Modem = $MODEM: " /etc/wvdial.conf</action>
   1.346  			</button>
   1.347 -			
   1.348 +
   1.349  		</hbox>
   1.350 -		<hbox>			
   1.351 +		<hbox>
   1.352  			<button>
   1.353  					<label>Dial Pin Once        </label>
   1.354  					<input file icon="forward"></input>
   1.355 -					<action>xterm -geometry 80x16 -title "Wvdial" -e "echo \"Bringing eth0 down...\"; ifconfig eth0 down; ifconfig eth1 down; echo \"Dialing...\"; wvdial pin; sleep 5"</action>					
   1.356 +					<action>xterm -geometry 80x16 -title "Wvdial" -e "echo \"Bringing eth0 down...\"; ifconfig eth0 down; ifconfig eth1 down; echo \"Dialing...\"; wvdial pin; sleep 5"</action>
   1.357  			</button>
   1.358  			<button>
   1.359  					<label>Start Dialing       </label>
   1.360  					<input file icon="forward"></input>
   1.361 -					<action>xterm -geometry 80x16 -title "Wvdial" -e "echo \"Bringing eth0 down...\"; ifconfig eth0 down; ifconfig eth1 down; echo \"Dialing...\"; wvdial slitaz; sleep 5"</action>					
   1.362 +					<action>xterm -geometry 80x16 -title "Wvdial" -e "echo \"Bringing eth0 down...\"; ifconfig eth0 down; ifconfig eth1 down; echo \"Dialing...\"; wvdial slitaz; sleep 5"</action>
   1.363  			</button>
   1.364 -		</hbox>	' 
   1.365 -		
   1.366 -		
   1.367 -export MAIN_DIALOG=${MAIN_DIALOG}"	
   1.368 +		</hbox>	'
   1.369 +
   1.370 +
   1.371 +export MAIN_DIALOG=${MAIN_DIALOG}"
   1.372  </vbox>
   1.373  </window>"
   1.374 -	gtkdialog --center --program=MAIN_DIALOG 
   1.375 +	gtkdialog --center --program=MAIN_DIALOG
   1.376  }
   1.377  
   1.378  
   1.379 @@ -461,8 +459,8 @@
   1.380  
   1.381  setup()
   1.382  {
   1.383 - 	case "$DEVICE" in 
   1.384 -		printer) 
   1.385 + 	case "$DEVICE" in
   1.386 +		printer)
   1.387  			load_modules
   1.388  			udev
   1.389  			# check parallel or usb printer
   1.390 @@ -481,8 +479,8 @@
   1.391  				if [ "$anser" == "y" ]; then
   1.392  						/etc/init.d/cupsd start
   1.393  						sleep 2
   1.394 -						browser http://localhost:631/						
   1.395 -				else			
   1.396 +						browser http://localhost:631/
   1.397 +				else
   1.398  					echo ""
   1.399  					echo "===================================="
   1.400  						echo -e "Start \033[1m cups \033[0m using :"
   1.401 @@ -492,24 +490,24 @@
   1.402  				fi
   1.403  			else
   1.404  				failed
   1.405 -		    fi 								
   1.406 +		    fi
   1.407  			;;
   1.408 -		scanner) 
   1.409 +		scanner)
   1.410  			load_modules
   1.411  			udev
   1.412  			find_usb_device
   1.413 -			fix_usb_permissions "scanner" 
   1.414 -		  	
   1.415 -		  	if [ "$DETECTED" == "yes" ]; then 	
   1.416 -		  	    #hputil	  		
   1.417 +			fix_usb_permissions "scanner"
   1.418 +
   1.419 +		  	if [ "$DETECTED" == "yes" ]; then
   1.420 +		  	    #hputil
   1.421  				echo ""
   1.422  				echo -n " Do you want to start scanner (y/N) ? "; read anser
   1.423  				echo ""
   1.424  				if [ "$anser" == "y" ]; then
   1.425  						sane-find-scanner # to verify scanner has been found
   1.426  						scanimage -L # List scanners
   1.427 -						xsane #scanner application												
   1.428 -				else			
   1.429 +						xsane #scanner application
   1.430 +				else
   1.431  					echo ""
   1.432  					echo "===================================="
   1.433  						echo -e "Following \033[1m Scanner commands \033[0m  may be of help"
   1.434 @@ -521,22 +519,22 @@
   1.435  				failed
   1.436  		    fi
   1.437  			;;
   1.438 -		webcam) 
   1.439 +		webcam)
   1.440  			load_modules
   1.441  			udev
   1.442 -					   
   1.443 +
   1.444  		   	if [ -n "`ls /dev/video0`" ] ; then
   1.445  				# fix permissions
   1.446  				 chmod 666 /dev/video0
   1.447 -				# ls -l /dev/video0		
   1.448 -				
   1.449 +				# ls -l /dev/video0
   1.450 +
   1.451  				if [ -d /var/lib/tazpkg/installed/mplayer-svn ]; then
   1.452  					echo ""
   1.453  					echo -n " Would you like to test webcam (y/N) ? "; read anser
   1.454  					echo ""
   1.455  					if [ "$anser" == "y" ]; then
   1.456  						mplayer tv:// -tv driver=v4l2:width=320:height=240:device=/dev/video0 -vo x11 &
   1.457 -					fi				
   1.458 +					fi
   1.459  				else
   1.460  				    echo ""
   1.461  					echo -n " Would you like to test webcam by installing mplayer-svn (y/N) ? "; read anser
   1.462 @@ -544,7 +542,7 @@
   1.463  					if [ "$anser" == "y" ]; then
   1.464  						install mplayer-svn
   1.465  						mplayer tv:// -tv driver=v4l2:width=320:height=240:device=/dev/video0 -vo x11 &
   1.466 -					else			
   1.467 +					else
   1.468  						echo ""
   1.469  		       			echo "============================"
   1.470  						echo "webcam is set up; please use mplayer-svn/fswebcam/amsn/skype to view"
   1.471 @@ -555,12 +553,12 @@
   1.472  				failed
   1.473  			fi
   1.474  			;;
   1.475 -		camera) 
   1.476 +		camera)
   1.477  			udev
   1.478  			find_usb_device
   1.479 -			fix_usb_permissions "camera" 
   1.480 -			
   1.481 -			if [ "$DETECTED" == "yes" ]; then 
   1.482 +			fix_usb_permissions "camera"
   1.483 +
   1.484 +			if [ "$DETECTED" == "yes" ]; then
   1.485  				echo ""
   1.486  				echo -n " Do you want to check if gphoto2 can talk to your camera (y/N) ? "; read anser
   1.487  				echo ""
   1.488 @@ -575,7 +573,7 @@
   1.489  						pcmanfm ~/Images/Photos
   1.490  					fi
   1.491  				echo ""
   1.492 -				else			
   1.493 +				else
   1.494  					echo ""
   1.495  					echo "===================================="
   1.496  					echo "camera is set up; please use gphoto2 to import photos"
   1.497 @@ -584,42 +582,42 @@
   1.498  				fi
   1.499  			else
   1.500  				failed
   1.501 -		    fi 
   1.502 +		    fi
   1.503  		    ;;
   1.504 -		bluetooth) 
   1.505 +		bluetooth)
   1.506  			load_modules
   1.507  			udev
   1.508 -					
   1.509 +
   1.510  			echo -n " Do you want to see if the bluetooth is working (y/N) ? "; read anser
   1.511  			echo ""
   1.512  			if [ "$anser" == "y" ]; then
   1.513  				# sanity check: btusb is not loaded automagically for unknown reasons
   1.514 -				if ! lsmod | grep -q btusb ; then 
   1.515 +				if ! lsmod | grep -q btusb ; then
   1.516  					modprobe btusb
   1.517  				fi
   1.518 -				echo "========================================"	
   1.519 +				echo "========================================"
   1.520  				echo -e "\033[1m Bluetooth \033[0m  interfaces"
   1.521  				echo ""
   1.522  				lsusb | grep Bluetooth
   1.523  				# udev should run bluetoothd automatically
   1.524 -				bluetoothd 
   1.525 +				bluetoothd
   1.526  				sleep 1
   1.527  				if hcitool dev | grep -q hci ; then
   1.528 -					echo "========================================"	
   1.529 +					echo "========================================"
   1.530  					echo -e "Following \033[1m Bluetooth commands \033[0m  may be of help "
   1.531  					echo ""
   1.532  					#echo " modprobe btusb"
   1.533  					#echo " /usr/sbin/bluetoothd -nd #for starting bluetooth daemon"
   1.534  					echo " hciconfig -a"
   1.535 -					echo " \"hcitool dev\" : checking local bluetooth devices..."				
   1.536 -		 			echo " \"hcitool scan\" : scanning remote bluetooth devices..."	
   1.537 -		 			echo " \"bluez-simple-agent\" : pairing with remote bluetooth devices..."	 		
   1.538 +					echo " \"hcitool dev\" : checking local bluetooth devices..."
   1.539 +		 			echo " \"hcitool scan\" : scanning remote bluetooth devices..."
   1.540 +		 			echo " \"bluez-simple-agent\" : pairing with remote bluetooth devices..."
   1.541  		 			echo -e " You can manually edit the configuration files in \033[1m /etc/bluetooth \033[0m if need be"
   1.542 -					echo "========================================"	
   1.543 +					echo "========================================"
   1.544  				fi
   1.545  			else
   1.546  				echo ""
   1.547 -				echo "========================================"	
   1.548 +				echo "========================================"
   1.549  				echo -e "Following \033[1m Bluetooth commands \033[0m  may be of help"
   1.550  				echo ""
   1.551  				echo " modprobe btusb"
   1.552 @@ -629,14 +627,14 @@
   1.553  				# Show if the bluetooth is detected
   1.554  		 		echo " hcitool dev # for checking local devices"
   1.555  		 		echo " hcitool scan # for scanning remote devices"
   1.556 -		 		echo " bluez-simple-agent # pairing with remote bluetooth devices"	
   1.557 +		 		echo " bluez-simple-agent # pairing with remote bluetooth devices"
   1.558  		 		echo ""
   1.559  		 		echo -e " You can manually edit the configuration files in \033[1m /etc/bluetooth \033[0m if need be"
   1.560 -				echo ""			
   1.561 -		    	echo "========================================"	
   1.562 -		    fi		   
   1.563 +				echo ""
   1.564 +		    	echo "========================================"
   1.565 +		    fi
   1.566  		    ;;
   1.567 -		3g-modem) 	
   1.568 +		3g-modem)
   1.569  				untested
   1.570  				load_modules
   1.571  				udev
   1.572 @@ -644,167 +642,174 @@
   1.573  		       	echo "===================================="
   1.574  		       	echo "list detected devices"
   1.575  		       	# ls /dev/ttyUSB* /dev/ttyACM* /dev/modem
   1.576 -		       	 
   1.577 +
   1.578  		       	if [ -n "`ls /dev/ttyUSB*`" -o -n "`ls /dev/ttyACM*`" ] ; then
   1.579  				    echo "Detected Modem at:"
   1.580  				    echo "`ls /dev/ttyUSB*`"
   1.581  					echo -n " Do you want to configure wvdial (y/N) ? "; read anser
   1.582  					echo ""
   1.583 -					if [ "$anser" == "y" ]; then	
   1.584 -						wvdialbox		
   1.585 -					else	
   1.586 -						echo "===================================="	 
   1.587 +					if [ "$anser" == "y" ]; then
   1.588 +						wvdialbox
   1.589 +					else
   1.590 +						echo "===================================="
   1.591  						echo "wvdialconf"
   1.592  						echo -e "Edit \033[1m /etc/wvdial.conf \033[0m  for phone number, login name, password and pin"
   1.593 -						echo "wvdial dialername"     		   
   1.594 -						#nameserver `tail -30 /var/log/messages| grep DNS| sed 's/*\([.0-9]*\)$/\1/'` >/etc/resolv.conf 
   1.595 -						echo -e " Add DNS adress of your provider in : \033[1m /etc/resolv.conf  \033[0m "	    
   1.596 -						echo "===================================="					
   1.597 +						echo "wvdial dialername"
   1.598 +						#nameserver `tail -30 /var/log/messages| grep DNS| sed 's/*\([.0-9]*\)$/\1/'` >/etc/resolv.conf
   1.599 +						echo -e " Add DNS adress of your provider in : \033[1m /etc/resolv.conf  \033[0m "
   1.600 +						echo "===================================="
   1.601  					 fi
   1.602  		       	 else
   1.603  		       	    failed
   1.604 -				 fi	       	
   1.605 +				 fi
   1.606  		       ;;
   1.607 -		firewall) echo "Setting IPTABLES_RULES to yes in /etc/firewall.conf"  
   1.608 +		firewall) echo "Setting IPTABLES_RULES to yes in /etc/firewall.conf"
   1.609  				  sed -i 's/^IPTABLES_RULES="no"/IPTABLES_RULES="yes"/' /etc/firewall.conf
   1.610  		          # default is "start"
   1.611 -				 if [ "$STOP" == "yes" ] ; then 
   1.612 +				 if [ "$STOP" == "yes" ] ; then
   1.613  				 	/etc/init.d/firewall stop
   1.614  				 else
   1.615  				 	/etc/init.d/firewall start
   1.616  				 	if [ -d /var/lib/tazpkg/installed/nmap ]; then
   1.617 -				 		echo "===================================="	 
   1.618 -				 	    echo "Probing for open ports..." 
   1.619 +				 		echo "===================================="
   1.620 +				 	    echo "Probing for open ports..."
   1.621  				 		nmap localhost
   1.622 -				 		echo "===================================="	 
   1.623 +				 		echo "===================================="
   1.624  				 	fi
   1.625  				 	echo "adding firewall daemon to start automatically at boot"
   1.626  				 	run_daemon_startup "firewall"
   1.627 -				 	echo "===================================="	 
   1.628 -				 fi 
   1.629 -		
   1.630 -			   ;;			          
   1.631 -		nvidia) if [ "$NON_FREE" == "yes" ] ; then
   1.632 -					if [ -d /var/lib/tazpkg/installed/xorg-xf86-video-nv ]; then
   1.633 -						mv /etc/X11/xorg.conf.backup /etc/X11/xorg.conf
   1.634 -						tazpkg remove xorg-xf86-video-nv						
   1.635 +				 	echo "===================================="
   1.636 +				 fi
   1.637 +
   1.638 +			   ;;
   1.639 +		nvidia)
   1.640 +			if [ "$NON_FREE" == "yes" ] ; then
   1.641 +				if [ -d /var/lib/tazpkg/installed/xorg-xf86-video-nv ]; then
   1.642 +					rm /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
   1.643 +					tazpkg remove xorg-xf86-video-nv
   1.644 +				fi
   1.645 +				load_modules
   1.646 +				#xorg
   1.647 +				echo -n " Do you want to configure X using non-free nvidia driver (y/N) ? "; read anser
   1.648 +				echo ""
   1.649 +				if [ "$anser" == "y" ]; then
   1.650 +					echo "Your previous config is in /etc/X11/xorg.conf.d/60-Device.conf"
   1.651 +					echo "If nvidia fails, you can remove /etc/X11/xorg.conf.d/55-DeviceTweaks.conf to restore previous config."
   1.652 +					Xorg -configure :1 > /dev/null
   1.653 +					nvidia-xconfig -c /root/xorg.conf.new -o /tmp/xorg.conf.nvidia
   1.654 +					sed -e '/Section "Device"/,/EndSection/!d' -e "s/EndSection/EndSection\n/" /tmp/xorg.conf.nvidia > /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
   1.655 +					rm /tmp/xorg.conf.nvidia /root/xorg.conf.new
   1.656 +
   1.657 +					if ! grep -q "NoLogo" /etc/X11/xorg.conf.d/55-DeviceTweaks.conf ; then
   1.658 +						echo "adding to xorg.conf: Option \"NoLogo\" \"True\""
   1.659 +						sed -i 's/BoardName\(.*\)/Boardname \1 \n  Option "NoLogo" "True" /' /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
   1.660  					fi
   1.661 -					load_modules
   1.662 -					#xorg
   1.663 -					echo -n " Do you want to configure X using non-free nvidia driver (y/N) ? "; read anser
   1.664 +
   1.665 +					# mesa-demos to check if acceleration is working
   1.666 +					echo "Checking if nvidia is working ..."
   1.667 +					glxinfo |grep rendering
   1.668 +
   1.669 +					echo "================================"
   1.670 +					echo -e "\033[1m Configure nvidia settings :\033[0m  "
   1.671 +					nvidia-settings
   1.672 +					echo "================================"
   1.673 +				else
   1.674  					echo ""
   1.675 -					if [ "$anser" == "y" ]; then
   1.676 -						echo "your config is backed up at /etc/X11/xorg.conf.backup"
   1.677 -		        		echo "if nvidia fails; please use your backed up xorg.conf"
   1.678 -						nvidia-xconfig				
   1.679 -						
   1.680 -		        		if ! grep -q "NoLogo" /etc/X11/xorg.conf ; then
   1.681 -		        			echo "adding to xorg.conf: Option \"NoLogo\" \"True\""
   1.682 -		        			sed -i 's/BoardName\(.*\)/Boardname \1 \n  Option "NoLogo" "True" /' /etc/X11/xorg.conf
   1.683 -		        		fi
   1.684 -		        		
   1.685 -		        		# mesa-demos to check if acceleration is working
   1.686 -		        		echo "Checking if nvidia is working ..." 
   1.687 -		        		glxinfo |grep rendering	
   1.688 -		        		
   1.689 -		        		echo "================================"
   1.690 -						echo -e "\033[1m Configure nvidia settings :\033[0m  "
   1.691 -		        	    nvidia-settings						
   1.692 -						echo "================================"      		        			        		
   1.693 -					else
   1.694 -						echo ""	
   1.695 -		       			echo "================================"
   1.696 -		       			echo "nvidia-xconfig"
   1.697 -						echo "glxinfo |grep rendering # test nvidia"
   1.698 -						echo "Use: nvidia-settings utility to configure your settings if necessary"
   1.699 -						echo "Option \"NoLogo\" \"True\""
   1.700 -		       			echo "================================"
   1.701 -		       		fi
   1.702 -		       	else
   1.703 -		       		if [ -d /var/lib/tazpkg/installed/nvidia ]; then
   1.704 -		       			mv /etc/X11/xorg.conf.backup /etc/X11/xorg.conf
   1.705 -						tazpkg remove nvidia						
   1.706 -					fi
   1.707 -					load_modules
   1.708 -					#xorg
   1.709 -					echo -n " Do you want to configure X using free nvidia driver (y/N) ? "; read anser
   1.710 +					echo "================================"
   1.711 +					echo "Use 'Xorg -configure :1 && nvidia-xconfig -c /root/xorg.conf.new -o /tmp/xorg.conf.nvidia' to generate a template configuration file."
   1.712 +					echo "glxinfo |grep rendering # test nvidia"
   1.713 +					echo "Use: nvidia-settings utility to configure your settings if necessary"
   1.714 +					echo "Option \"NoLogo\" \"True\""
   1.715 +					echo "================================"
   1.716 +				fi
   1.717 +			else
   1.718 +				if [ -d /var/lib/tazpkg/installed/nvidia ]; then
   1.719 +					rm /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
   1.720 +					tazpkg remove nvidia
   1.721 +				fi
   1.722 +				load_modules
   1.723 +				#xorg
   1.724 +				echo -n " Do you want to configure X using free nvidia driver (y/N) ? "; read anser
   1.725 +				echo ""
   1.726 +				if [ "$anser" == "y" ]; then
   1.727  					echo ""
   1.728 -					if [ "$anser" == "y" ]; then
   1.729 -		       			echo ""	
   1.730 -		       			echo "================================"
   1.731 -		       			#backup your current config
   1.732 -						cp -a /etc/X11/xorg.conf /etc/X11/xorg.conf.backup
   1.733 -						echo "your config is backed up at /etc/X11/xorg.conf.backup"
   1.734 -		        		echo "if nvidia fails; please use your backed up xorg.conf"
   1.735 -		        		echo ""
   1.736 -		        		echo "Replace vesa driver with nv in /etc/X11/xorg.conf"
   1.737 -		        		# free nvidia driver is called nv
   1.738 -		        		sed -i 's/vesa/nv/' /etc/X11/xorg.conf
   1.739 -		        		# mesa-demos to check if acceleration is working
   1.740 -						echo "Checking if nvidia is working ..." 
   1.741 -		        		glxinfo |grep rendering	
   1.742 -						echo "================================"	
   1.743 -					fi	        	
   1.744 -		        fi
   1.745 -				;;
   1.746 +					echo "================================"
   1.747 +					echo "Your previous config is in /etc/X11/xorg.conf.d/60-Device.conf"
   1.748 +					echo "If nvidia fails, you can remove /etc/X11/xorg.conf.d/55-DeviceTweaks.conf to restore previous config."
   1.749 +					echo ""
   1.750 +					echo "Create 55-DeviceTweaks.conf configured with nv driver."
   1.751 +
   1.752 +					# free nvidia driver is called nv
   1.753 +					cp -a /etc/X11/xorg.conf.d/60-Device.conf /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
   1.754 +					sed -i 's/vesa/nv/' /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
   1.755 +
   1.756 +					# mesa-demos to check if acceleration is working
   1.757 +					echo "Checking if nvidia is working ..."
   1.758 +					glxinfo |grep rendering
   1.759 +					echo "================================"
   1.760 +				fi
   1.761 +			fi
   1.762 +		;;
   1.763  		ati)	untested
   1.764 -				if [ "$NON_FREE" == "yes" ] ; then
   1.765 -					if [ -d /var/lib/tazpkg/installed/xorg-xf86-video-ati ]; then
   1.766 -						mv /etc/X11/xorg.conf.backup /etc/X11/xorg.conf
   1.767 -						tazpkg remove xorg-xf86-video-ati						
   1.768 -					fi
   1.769 -					load_modules
   1.770 -					#xorg
   1.771 -					echo -n " Do you want to configure X using non-free catalyst ati(radeon) driver (y/N) ? "; read anser
   1.772 +			if [ "$NON_FREE" == "yes" ] ; then
   1.773 +				if [ -d /var/lib/tazpkg/installed/xorg-xf86-video-ati ]; then
   1.774 +					rm /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
   1.775 +					tazpkg remove xorg-xf86-video-ati
   1.776 +				fi
   1.777 +				load_modules
   1.778 +				#xorg
   1.779 +				echo -n " Do you want to configure X using non-free catalyst ati(radeon) driver (y/N) ? "; read anser
   1.780 +				echo ""
   1.781 +				if [ "$anser" == "y" ]; then
   1.782 +					echo "Your previous config is in /etc/X11/xorg.conf.d/60-Device.conf"
   1.783 +					echo "If ati fails, you can remove /etc/X11/xorg.conf.d/55-DeviceTweaks.conf to restore previous config."
   1.784 +
   1.785 +					# add fglrx driver to xorg.conf
   1.786 +					Xorg -configure :1 > /dev/null
   1.787 +					aticonfig --initial --input=/root/xorg.conf.new --output=/tmp/xorg.conf.ati
   1.788 +					sed -e '/Section "Device"/,/EndSection/!d' -e "s/EndSection/EndSection\n/" /tmp/xorg.conf.ati > /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
   1.789 +					rm /tmp/xorg.conf.ati /root/xorg.conf.new
   1.790 +
   1.791 +					# mesa-demos to check if acceleration is working
   1.792 +					echo "Checking if ati catalyst is working ..."
   1.793 +					glxinfo |grep rendering
   1.794 +				else
   1.795  					echo ""
   1.796 -					if [ "$anser" == "y" ]; then
   1.797 -						#backup your current config
   1.798 -						cp -a /etc/X11/xorg.conf /etc/X11/xorg.conf.backup
   1.799 -						echo "your config is backed up at /etc/X11/xorg.conf.backup"
   1.800 -		        		echo "if ati fails; please use your backed up xorg.conf"
   1.801 -		        		# add fglrx driver to xorg.conf
   1.802 -						aticonfig --initial --input=/etc/X11/xorg.conf						
   1.803 -						# mesa-demos to check if acceleration is working
   1.804 -						echo "Checking if ati catalyst is working ..." 
   1.805 -		        		glxinfo |grep rendering		        		
   1.806 -					else
   1.807 -						echo ""	
   1.808 -		       			echo "================================"
   1.809 -		       			echo -e "\033[1m Configuration :\033[0m  "
   1.810 -		        		echo "Use: aticonfig utility to configure xorg.conf settings if necessary"
   1.811 -		        		echo "aticonfig --initial --input=/etc/X11/xorg.conf"
   1.812 -		        		echo "restart xorg"
   1.813 -		       			echo "glxinfo |grep rendering"
   1.814 -		       			echo "================================"
   1.815 -		       		fi
   1.816 -		       	else
   1.817 -		       		if [ -d /var/lib/tazpkg/installed/catalyst ]; then
   1.818 -						mv /etc/X11/xorg.conf.backup /etc/X11/xorg.conf
   1.819 -						tazpkg remove catalyst
   1.820 -					fi
   1.821 -					load_modules
   1.822 -					#xorg
   1.823 -					echo -n " Do you want to configure X using free ati (radeon) driver (y/N) ? "; read anser
   1.824 +					echo "================================"
   1.825 +					echo -e "\033[1m Configuration :\033[0m  "
   1.826 +					echo "Use: aticonfig utility to generate a template configuration file if necessary"
   1.827 +					echo "Xorg -configure :1 &&	aticonfig --initial --input=/root/xorg.conf.new --output=/tmp/xorg.conf.ati"
   1.828 +					echo "restart xorg"
   1.829 +					echo "glxinfo |grep rendering"
   1.830 +					echo "================================"
   1.831 +				fi
   1.832 +			else
   1.833 +				if [ -d /var/lib/tazpkg/installed/catalyst ]; then
   1.834 +					rm /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
   1.835 +					tazpkg remove catalyst
   1.836 +				fi
   1.837 +				load_modules
   1.838 +				#xorg
   1.839 +				echo -n " Do you want to configure X using free ati (radeon) driver (y/N) ? "; read anser
   1.840 +				echo ""
   1.841 +				if [ "$anser" == "y" ]; then
   1.842  					echo ""
   1.843 -					if [ "$anser" == "y" ]; then
   1.844 -		       			echo ""	
   1.845 -		       			echo "================================"
   1.846 -		       			#backup your current config
   1.847 -						cp -a /etc/X11/xorg.conf /etc/X11/xorg.conf.backup
   1.848 -						echo "your config is backed up at /etc/X11/xorg.conf.backup"
   1.849 -		        		echo "if ati fails; please use your backed up xorg.conf"
   1.850 -		        		echo ""
   1.851 -		        		echo "Replace vesa driver with radeon in /etc/X11/xorg.conf"
   1.852 -		        		# free ati driver is called radeon
   1.853 -		        		sed -i 's/vesa/radeon/' /etc/X11/xorg.conf
   1.854 -						# mesa-demos to check if acceleration is working
   1.855 -						echo "Checking if ati radeon is working ..." 
   1.856 -		        		glxinfo |grep rendering	
   1.857 -						echo "================================"	
   1.858 -					fi	  					
   1.859 -		        fi
   1.860 -				;;		
   1.861 -		
   1.862 +					echo "================================"
   1.863 +					echo "Your previous config is in /etc/X11/xorg.conf.d/60-Device.conf"
   1.864 +					echo "If ati fails, you can remove /etc/X11/xorg.conf.d/55-DeviceTweaks.conf to restore previous config."
   1.865 +					echo ""
   1.866 +					echo "Create 55-DeviceTweaks.conf configured with radeon driver."
   1.867 +
   1.868 +					# free ati driver is called radeon
   1.869 +					cp -a /etc/X11/xorg.conf.d/60-Device.conf /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
   1.870 +					sed -i 's/vesa/nv/' /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
   1.871 +					# mesa-demos to check if acceleration is working
   1.872 +					echo "Checking if ati radeon is working ..."
   1.873 +					glxinfo |grep rendering
   1.874 +					echo "================================"
   1.875 +				fi
   1.876 +			fi
   1.877 +		;;
   1.878  	esac
   1.879  }
   1.880  
   1.881 @@ -812,21 +817,21 @@
   1.882  case "$1" in
   1.883  	help|usage ) 	usage ;;
   1.884  	wvdial) 		wvdialbox ;;
   1.885 -	xorg)  			xorg;;	 
   1.886 -	
   1.887 -	*) 		check_root 
   1.888 +	xorg)  			xorg;;
   1.889 +
   1.890 +	*) 		check_root
   1.891  			echo "COMMAND OPTIONS: $@"
   1.892  			for i in "$@"; do
   1.893 -	   			if [ "$i" == "--non-free" ] ;  then 	NON_FREE="yes"; 				fi 	
   1.894 +	   			if [ "$i" == "--non-free" ] ;  then 	NON_FREE="yes"; 				fi
   1.895  				if [ "$i" == "--suggested" ] ; then 	AUTO_INSTALL_SUGGESTED="yes"; 	fi
   1.896 -				if [ "$i" == "--confirm" ] ;   then 	CONFIRM_SUGGESTED="yes"; 		fi	
   1.897 -				if [ "$i" == "stop" ] ;        then 	STOP="yes"; 					fi					
   1.898 +				if [ "$i" == "--confirm" ] ;   then 	CONFIRM_SUGGESTED="yes"; 		fi
   1.899 +				if [ "$i" == "stop" ] ;        then 	STOP="yes"; 					fi
   1.900  			done
   1.901 -		
   1.902 +
   1.903  			device
   1.904  			#untested
   1.905 -			if [ ! "$NON_FREE_DEPENDS" == "" -a "$NON_FREE" == "yes" ]; then 
   1.906 -			     DEPENDS="$NON_FREE_DEPENDS" 				
   1.907 +			if [ ! "$NON_FREE_DEPENDS" == "" -a "$NON_FREE" == "yes" ]; then
   1.908 +			     DEPENDS="$NON_FREE_DEPENDS"
   1.909  			fi
   1.910  
   1.911  			if [ "$AUTO_INSTALL_SUGGESTED" == "yes" ]; then
   1.912 @@ -840,11 +845,11 @@
   1.913  				echo "===================================="
   1.914  				echo -n " Do you want to install all/few/no optional dependencies (all|few|N) ? "; read anser
   1.915  			fi
   1.916 -				
   1.917 +
   1.918  			install "$DEPENDS"
   1.919 -			case $anser in 
   1.920 +			case $anser in
   1.921  				[aA]*|[yY]|1) 	install "$SUGGESTED" ;;
   1.922 -				[fF]*|2) 		confirm_install "$SUGGESTED" ;;	
   1.923 +				[fF]*|2) 		confirm_install "$SUGGESTED" ;;
   1.924  				*) ;;
   1.925  			esac
   1.926