slitaz-tools rev 918

tazx: Add driver autodetect and bpp-edit features.
Auto: 2nd-level Dialog-item
or Command (tazx auto) without writing xorg.conf.d/
bpp: both generates xorg.conf.d:
(tazx bpp 16) or (tazx bpp) dialog
optimize (tazbox tazapps) speed.
Using existing i18n strings for new.
Fix fr.po syntax typos.
author Xander Ziiryanoff <psychomaniak@xakep.ru>
date Fri Nov 14 21:18:57 2014 +0000 (2014-11-14)
parents 0e6196e79283
children 14a1aa90effb
files po/slitaz-tools/fr.po po/tazbox/fr.po tazbox/tazbox tinyutils/tazx
line diff
     1.1 --- a/po/slitaz-tools/fr.po	Wed Nov 05 23:27:35 2014 +0100
     1.2 +++ b/po/slitaz-tools/fr.po	Fri Nov 14 21:18:57 2014 +0000
     1.3 @@ -201,7 +201,7 @@
     1.4  #: tinyutils/terminal:15
     1.5  #, sh-format
     1.6  msgid "Width and height of terminal window ($GEOMETRY)"
     1.7 -msgstr "Largeur et hauteur du terminal ($GEOMETRY)""
     1.8 +msgstr "Largeur et hauteur du terminal ($GEOMETRY)"
     1.9  
    1.10  #: tinyutils/terminal:16
    1.11  #, sh-format
    1.12 @@ -421,7 +421,7 @@
    1.13  
    1.14  #: tinyutils/hwsetup:443
    1.15  msgid "Would you like to test webcam by installing mplayer-svn"
    1.16 -msgstr "voulez vous tester la webcam en installant mplayer-svn""
    1.17 +msgstr "voulez vous tester la webcam en installant mplayer-svn"
    1.18  
    1.19  #: tinyutils/hwsetup:450
    1.20  msgid "Webcam is set up; please use mplayer-svn/fswebcam/amsn/skype to view"
    1.21 @@ -442,7 +442,7 @@
    1.22  #: tinyutils/hwsetup:483
    1.23  #, sh-format
    1.24  msgid "Quick start guide: $guide_url"
    1.25 -msgstr "Guide succinct : $guide_url""
    1.26 +msgstr "Guide succinct : $guide_url"
    1.27  
    1.28  #: tinyutils/hwsetup:494
    1.29  msgid "Do you want to see if the bluetooth is working"
    1.30 @@ -499,7 +499,7 @@
    1.31  
    1.32  #: tinyutils/hwsetup:558
    1.33  msgid "Do you want to configure wvdial"
    1.34 -msgstr "Voulez vous configurer wvdial""
    1.35 +msgstr "Voulez vous configurer wvdial"
    1.36  
    1.37  #: tinyutils/hwsetup:567
    1.38  #, sh-format
     2.1 --- a/po/tazbox/fr.po	Wed Nov 05 23:27:35 2014 +0100
     2.2 +++ b/po/tazbox/fr.po	Fri Nov 14 21:18:57 2014 +0000
     2.3 @@ -349,7 +349,6 @@
     2.4  
     2.5  #: tazbox/tazbox:660
     2.6  msgid "SliTaz default applications"
     2.7 -msgstr ""
     2.8  msgstr "Applications SliTaz par défaut"
     2.9  
    2.10  #: tazbox/tazbox:662
     3.1 --- a/tazbox/tazbox	Wed Nov 05 23:27:35 2014 +0100
     3.2 +++ b/tazbox/tazbox	Fri Nov 14 21:18:57 2014 +0000
     3.3 @@ -631,7 +631,7 @@
     3.4  
     3.5  		for a in FILE_MANAGERS BROWSERS EDITORS TERMINALS WINDOW_MANAGERS;
     3.6  		do
     3.7 -			eval $(expr $a=$(echo $(/usr/bin/tazx get-applist ${a%%S} \
     3.8 +			eval $(expr $a=$(echo $(LC_ALL=C tazx get-applist ${a%%S} \
     3.9  			only-installed yad) | sed 's/ /!/g ; s/!!//g; s/ //g'))
    3.10  		done
    3.11  
     4.1 --- a/tinyutils/tazx	Wed Nov 05 23:27:35 2014 +0100
     4.2 +++ b/tinyutils/tazx	Fri Nov 14 21:18:57 2014 +0000
     4.3 @@ -23,8 +23,8 @@
     4.4  export TEXTDOMAIN='slitaz-tools' #i18n
     4.5  : ${DIALOG=dialog --timeout 60}
     4.6  
     4.7 -# Default value.
     4.8 -WM=${WINDOW_MANAGER}
     4.9 +WM_i18n=$(_n 'Window Manager:'| sed s/://)
    4.10 +INST_i18n=$(_n 'Install Xorg' | sed 's|Xorg||;s|X.org||;s| ||')
    4.11  
    4.12  # Default user for config files in Live mode, id is 1000 since it is
    4.13  # created by /etc/init.d/bootopts.sh.
    4.14 @@ -138,7 +138,7 @@
    4.15  	exec 3>&-
    4.16  	# Continue or exit.
    4.17  	case $retval in
    4.18 -		0) continue ;;
    4.19 +		0|3) continue ;;
    4.20  		1|255) exit 0 ;;
    4.21  	esac
    4.22  }
    4.23 @@ -148,9 +148,10 @@
    4.24  	[ -f "/var/lib/tazpkg/packages.list" ] || tazpkg recharge
    4.25  	exec 3>&1
    4.26  	value=$($DIALOG \
    4.27 -		--clear --colors \
    4.28 +		--clear --colors --scrollbar --default-item "$1" \
    4.29  		--title " $(_n 'Install Xorg') " \
    4.30  		--menu "$(_n 'Tazx helps you to select your X driver.')" 16 70 8 \
    4.31 +		Auto_select "$(_n 'Auto configuring Xorg...' | sed 's/X//;s/org//;s|...$||;s| |_|')" \
    4.32  	$(fgrep xorg-xf86-video /var/lib/tazpkg/packages.list | cut -d- -f4 | \
    4.33  		while read x; do echo $x; _ 'driver'; done) \
    4.34  	"quit" "$(_n 'Quit')" \
    4.35 @@ -161,13 +162,34 @@
    4.36  	case $value in
    4.37  		quit) exit 0 ;;
    4.38  		*)
    4.39 +			[ ! $value = Auto_select ] || autoselect_driver IN_List
    4.40  			inst_pkg xorg-server
    4.41  			inst_pkg xorg-xf86-video-$value
    4.42  			xorg_conf_d ;;
    4.43  	esac
    4.44  }
    4.45  
    4.46 +autoselect_driver() {
    4.47 +	inst_pkg pciutils
    4.48 +for v in AMD ATI Intel NVIDIA SiS VMware; do
    4.49 +	hw=$(echo $(lspci | grep VGA | grep $v | sed s/[^aA-zZ]//g)--)
    4.50 +	if [ ! $hw = -- ]; then case $v in
    4.51 +		AMD|ATI)d=ati;;
    4.52 +		Intel)	d=intel;;
    4.53 +		NVIDIA)	d=nouveau;;
    4.54 +		SiS)	d=sis;;
    4.55 +		VMware)	d=vmware;;
    4.56 +	esac ; fi
    4.57 +done
    4.58 +	DEVICE=$(_ 'driver')
    4.59 +	[ ! $(echo $d | wc -w) = 0 ] || \
    4.60 +	$DIALOG --colors --msgbox "\Z1 $(_n 'Failed to setup $DEVICE') \Zn (unknown hardware)" 5 68
    4.61 +
    4.62 +	[ $1 = sh ] || install_xorg $d
    4.63 +}
    4.64 +
    4.65  inst_pkg() {
    4.66 +	pkg="$@" && colorize 5 $(_ 'Installing pkg: $pkg')
    4.67  	CMD="sudo tazpkg -gi $@"
    4.68  	test $(id -u) = 0 && CMD="tazpkg -gi $@"
    4.69  	[ -d "$installed/$@" ] || $CMD
    4.70 @@ -176,17 +198,15 @@
    4.71  apps_dialog() {
    4.72  	. ${user_conf}
    4.73  	exec 3>&1
    4.74 -	app=$($DIALOG --clear --colors \
    4.75 -		--extra-label "$(_n 'Edit')" \
    4.76 -		--backtitle "{ $(_n '\Z3SliTaz applications config\Zn') }" \
    4.77 -		--inputmenu " " 22 52 18 WINDOW_MANAGER $WINDOW_MANAGER \
    4.78 -	$(for a in EDITOR BROWSER TERMINAL FILE_MANAGER; do
    4.79 -		eval n=$"$a" ; echo "$a $n";
    4.80 +	app=$($DIALOG --clear --colors --backtitle "$msg" \
    4.81 +		--title "{\Z3 $(_n '${INST_i18n}: ${WM_i18n} + applications') \Zn}" \
    4.82 +		--inputmenu "" 21 52 18 \
    4.83 +	$(for a in WINDOW_MANAGER EDITOR BROWSER TERMINAL FILE_MANAGER; do
    4.84 +		eval n='$'"$a" ; echo "$a $n";
    4.85  	done) 2>&1 1>&3)
    4.86  	dialog_end
    4.87  	case $app in
    4.88 -		RENAMED*)
    4.89 -			appname=$(echo $app | cut -d " " -f3)
    4.90 +		RENAME*)appname=$(echo $app | cut -d " " -f3)
    4.91  			app=$(echo $app | cut -d " " -f2) ;;
    4.92  		*)
    4.93  			app_name_dialog only-installed d a-item ;;
    4.94 @@ -195,53 +215,46 @@
    4.95  		[ ! $appname = show_ALL ] || app_name_dialog full-list d
    4.96  		if [ ! $(busybox which ${appname} 2>/dev/null) ]; then
    4.97  			inst_pkg $appname
    4.98 -			if [ ! -d "$installed/$appname" ]; then
    4.99 -			pknm=$(tazpkg search-pkgname /bin/$appname \
   4.100 -			| grep -Ev '=|:| |/bin/')
   4.101 -			inst_pkg $pknm
   4.102 -			fi
   4.103 +		[ -d "$installed/$appname" ] || inst_pkg \
   4.104 +		$(tazpkg search-pkgname /bin/$appname | grep -Ev '=|:| |/bin/')
   4.105  		else
   4.106 -		sed '/'${app}'/s|=.*$|="'${appname}'"|' -i ${user_conf}
   4.107 +			sed '/'${app}'/s|=.*$|="'${appname}'"|' -i ${user_conf}
   4.108  		fi
   4.109  	fi
   4.110 -	apps_dialog
   4.111 +	msg=''; apps_dialog
   4.112  }
   4.113  
   4.114  app_name_dialog() {
   4.115 -	bt="" sz=28 ; [ $1 = full-list ] || sz=20 \
   4.116 -	bt=$(_n 'select "Show_ALL" to install additional programs')
   4.117 +	sz=28 ; [ $1 = full-list ] || sz=18
   4.118  	exec 3>&1
   4.119 -	appname=$($DIALOG --clear --colors \
   4.120 -	--backtitle "\Z1${bt}\Zn" --title "${app}" \
   4.121 +	appname=$($DIALOG --clear --colors --title "${app}" \
   4.122  	--menu "" $sz 50 24 $(gen_applist $app $@) 2>&1 1>&3) \
   4.123  	dialog_end
   4.124  }
   4.125  
   4.126  gen_applist() {
   4.127  . ${user_conf}
   4.128 -FILE_MANAGERS=" clex caja emelfm2 mc pathfinder pcmanfm pcmanfm-qt ranger spacefm thunar xfe ytree"
   4.129 -BROWSERS=" arora chrome cream dillo elinks firefox iron links lynx midori netsurf \
   4.130 - opera QtWeb qupzilla retawq seamonkey surf tazweb"
   4.131 -EDITORS=" adie beaver emacs geany jed joe juffed ht le leafpad mcedit mousepad mp-5 \
   4.132 +FILE_MANAGERS="clex caja emelfm2 mc pathfinder pcmanfm pcmanfm-qt ranger spacefm thunar xfe ytree"
   4.133 +BROWSERS="arora chrome cream dillo elinks firefox firefox-official iron links lynx \
   4.134 + midori netsurf opera QtWeb qupzilla retawq seamonkey surf tazweb"
   4.135 +EDITORS="adie beaver emacs geany jed joe juffed ht le leafpad mcedit mousepad mp-5 \
   4.136   nano qedit SciTE vi vim xedit xfw zile"
   4.137 -TERMINALS=" aterm evilvte lxterminal mrxvt qterminal sakura stjerm tilda urxvt vte \
   4.138 +TERMINALS="aterm evilvte lxterminal mrxvt qterminal sakura stjerm tilda urxvt vte \
   4.139   xterm yeahconsole"
   4.140 -WINDOW_MANAGERS=" awesome blackbox dwm echinus enlightenment fluxbox icewm-session jwm \
   4.141 - lxde-session karmen matchbox openbox-session pekwm ratpoison startlxqt xfwm4"
   4.142 +WINDOW_MANAGERS="awesome blackbox compiz dwm echinus enlightenment fluxbox icewm jwm \
   4.143 + lxde-session lxqt karmen matchbox openbox-session pekwm ratpoison xfwm4"
   4.144  
   4.145  	eval list='$'"$1"S
   4.146  	eval current='$'"$1"
   4.147 -for i in $current $(echo $list" " | sed "s| "$current" | |g") $4 ; do
   4.148 +for i in $current $(echo ' '$list' ' | sed "s| "$current" | |g") $4 ; do
   4.149  	t="<--" ; [ $(busybox which $i 2>/dev/null) ] || t=---
   4.150  	if [ $2 = only-installed ] && [ $t = --- ]; then
   4.151  		case $i in
   4.152 -		a-item) i=show_ALL t=$(_n 'Get more apps') ;;
   4.153 +		a-item) i=show_ALL t="+"${INST_i18n};;
   4.154  		*) i=" " t=" " ;; esac
   4.155  	fi
   4.156 -	instmsg=$(_n 'install')
   4.157 -	t=$(echo $t | sed "s|---|$instmsg|g ; s| |_|g")
   4.158  	echo "$i"
   4.159 -	[ $3 = yad ] || echo -e "$t"
   4.160 +	[ $3 = yad ] || echo -e "$(echo $t | sed "s|---|${INST_i18n}|g ; s| ||g")"
   4.161  done
   4.162  }
   4.163  
   4.164 @@ -253,13 +266,14 @@
   4.165  	exec 3>&1
   4.166  	value=$($DIALOG \
   4.167  		--clear --colors \
   4.168 +		--shadow \
   4.169  		--title "{ $(_n 'SliTaz Xorg config') }" \
   4.170  		--menu "" 16 72 10 \
   4.171  	"xorg"        "$(_n 'Install or reconfigure Xorg')" \
   4.172  	"xorg-light"  "$(_n 'Install Xorg server (light version)')" \
   4.173 -	"onboot"      "$(_n 'AutoStart Xorg by SLiM on boot') ...| $LM" \
   4.174 +	"onboot"      "$(_n 'AutoStart Xorg by SLiM on boot') ...| \Z5$LM\Zn" \
   4.175  	"slim"        "$(_n '(Re)Start Simple Login Manager now')" \
   4.176 -	"wm_apps"     "$(_n 'Select & install WM|DE + applications')" \
   4.177 +	"wm_apps"     "$(_n '${INST_i18n}: ${WM_i18n} + applications')" \
   4.178  	"quit"        "$(_n 'Quit Tazx utility')" \
   4.179  	2>&1 1>&3)
   4.180  	dialog_end
   4.181 @@ -310,6 +324,7 @@
   4.182  			mkdir -p $(dirname $user_conf); cp ${apps_conf} ${user_conf}
   4.183  		fi
   4.184  	fi
   4.185 +	[ -f "$HOME/.xinitrc" ] || inst_pkg slitaz-configs-base --forced
   4.186  }
   4.187  
   4.188  # Commands
   4.189 @@ -343,17 +358,32 @@
   4.190  		echo "Generating: 40-Keyboard.conf"
   4.191  		keyboard_conf ;;
   4.192  	
   4.193 -	*help) 
   4.194 -		echo "Usage: $(basename $0) [install-xorg|config-xorg|init|keyboard]" ;;
   4.195 -		
   4.196 -	
   4.197  	get-applist)
   4.198  		slitaz_apps_conf
   4.199  		gen_applist $2 $3 $4 ;;
   4.200 +	auto)
   4.201 +		autoselect_driver sh
   4.202 +		inst_pkg xorg-server
   4.203 +		inst_pkg xorg-xf86-video-${d} ;;
   4.204 +	bpp)
   4.205 +		check_root
   4.206 +		xorg_conf_d
   4.207 +		case "$2" in 8|15|16|24) colors=$2 ;;
   4.208 +		*)	exec 3>&1 && colors=$($DIALOG --menu " " 12 12 12 \
   4.209 +			24 truecolor 16 hicolor 15 hicolor 8 256colors 2>&1 1>&3) ; dialog_end ;;
   4.210 +		esac
   4.211 +		sed 's|Monitor.*"$|&\n\tDefaultDepth '$colors'|' -i ${xorg_config}/70-Screen.conf
   4.212 +		;;
   4.213 +	*help)
   4.214 +		echo "Usage: $(basename $0) [install-xorg|bpp|auto|config-xorg|init|keyboard]" ;;
   4.215  	*)
   4.216  		# User can get a new .xinitrc with tazx from cmdline.
   4.217 -		if [ $(id -u) == 0 ]; then config_dialog
   4.218 -		else	slitaz_apps_conf ; apps_dialog
   4.219 +		if [ $(id -u) == 0 ]; then
   4.220 +			slitaz_apps_conf
   4.221 +			config_dialog
   4.222 +		else	msg="\Z1 $(_n 'Run tazx as root if you need to configure xorg') \Zn"
   4.223 +			slitaz_apps_conf
   4.224 +			apps_dialog
   4.225  		fi
   4.226  		# gen_xsession
   4.227  		;;