slitaz-tools rev 628
tazx: code clean-up and more gettextization
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Tue Jun 14 23:36:15 2011 +0200 (2011-06-14) |
parents | fc37e8002ad6 |
children | 0c915e47ea57 |
files | Makefile po/slitaz-tools/slitaz-tools.pot tinyutils/tazx |
line diff
1.1 --- a/Makefile Tue Jun 14 22:53:51 2011 +0200 1.2 +++ b/Makefile Tue Jun 14 23:36:15 2011 +0200 1.3 @@ -21,7 +21,8 @@ 1.4 @echo -n "Generating SliTaz Tools pot file... " 1.5 @xgettext -o po/slitaz-tools/slitaz-tools.pot -L Shell \ 1.6 --package-name="SliTaz Tools" \ 1.7 - ./tinyutils/tazlocale ./tinyutils/tazkeymap ./tinyutils/setmixer 1.8 + ./tinyutils/tazlocale ./tinyutils/tazkeymap ./tinyutils/setmixer \ 1.9 + ./tinyutils/tazx 1.10 @echo "done" 1.11 1.12 boxes-pot:
2.1 --- a/po/slitaz-tools/slitaz-tools.pot Tue Jun 14 22:53:51 2011 +0200 2.2 +++ b/po/slitaz-tools/slitaz-tools.pot Tue Jun 14 23:36:15 2011 +0200 2.3 @@ -8,7 +8,7 @@ 2.4 msgstr "" 2.5 "Project-Id-Version: SliTaz Tools\n" 2.6 "Report-Msgid-Bugs-To: \n" 2.7 -"POT-Creation-Date: 2011-06-14 22:53+0200\n" 2.8 +"POT-Creation-Date: 2011-06-14 23:34+0200\n" 2.9 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 2.10 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 2.11 "Language-Team: LANGUAGE <LL@li.org>\n" 2.12 @@ -50,3 +50,31 @@ 2.13 #: tinyutils/setmixer:53 2.14 msgid "Done" 2.15 msgstr "" 2.16 + 2.17 +#: tinyutils/tazx:32 2.18 +msgid "You must be root to configure X server." 2.19 +msgstr "" 2.20 + 2.21 +#: tinyutils/tazx:162 2.22 +msgid "Tazx dialog helps you to configure your Xorg." 2.23 +msgstr "" 2.24 + 2.25 +#: tinyutils/tazx:163 2.26 +msgid "Window Manager:" 2.27 +msgstr "" 2.28 + 2.29 +#: tinyutils/tazx:164 2.30 +msgid "X server:" 2.31 +msgstr "" 2.32 + 2.33 +#: tinyutils/tazx:165 2.34 +msgid "Install or reconfigure Xorg" 2.35 +msgstr "" 2.36 + 2.37 +#: tinyutils/tazx:166 2.38 +msgid "Install TinyX server Xfbdev" 2.39 +msgstr "" 2.40 + 2.41 +#: tinyutils/tazx:167 2.42 +msgid "Quit Tazx utility" 2.43 +msgstr ""
3.1 --- a/tinyutils/tazx Tue Jun 14 22:53:51 2011 +0200 3.2 +++ b/tinyutils/tazx Tue Jun 14 23:36:15 2011 +0200 3.3 @@ -22,11 +22,16 @@ 3.4 TEXTDOMAIN='slitaz-tools' 3.5 export TEXTDOMAIN 3.6 3.7 +# 3.8 # Functions 3.9 +# 3.10 3.11 # Be sure we're root. 3.12 check_root() { 3.13 - [ $(id -u) != 0 ] && gettext -e "\nYou must be root to configure x.\n\n" && exit 0 3.14 + if [ $(id -u) != 0 ]; then 3.15 + gettext "You must be root to configure X server." 3.16 + echo "" && exit 0 3.17 + fi 3.18 } 3.19 3.20 # Populate xorg.conf.d. 3.21 @@ -44,13 +49,25 @@ 3.22 # Backup existing config. 3.23 tar -cf $xorg_config/../Previous_xorg.conf.d.tar $xorg_config/ &> /dev/null 3.24 3.25 - # Put the differents sections in separate files in the configuration directory. 3.26 - sed -e '/Section "ServerLayout"/,/EndSection/!d' -e "s/EndSection/EndSection\n/" $xorg_template | grep -v Core > $xorg_config/10-ServerLayout.conf 3.27 - sed -e '/Section "Files"/,/EndSection/!d' -e "s/EndSection/EndSection\n/" $xorg_template > $xorg_config/20-Files.conf 3.28 - sed -e '/Section "Module"/,/EndSection/!d' -e "s/EndSection/EndSection\n/" $xorg_template > $xorg_config/30-Module.conf 3.29 - sed -e '/Section "Monitor"/,/EndSection/!d' -e "s/EndSection/EndSection\n/" $xorg_template > $xorg_config/50-Monitor.conf 3.30 - sed -e '/Section "Device"/,/EndSection/!d' -e "s/EndSection/EndSection\n/" $xorg_template > $xorg_config/60-Device.conf 3.31 - sed -e '/Section "Screen"/,/EndSection/!d' -e "s/EndSection/EndSection\n/" $xorg_template > $xorg_config/70-Screen.conf 3.32 + # Put the differents sections in separate files in the config directory. 3.33 + sed -e '/Section "ServerLayout"/,/EndSection/!d' \ 3.34 + -e "s/EndSection/EndSection\n/" $xorg_template | \ 3.35 + grep -v Core > $xorg_config/10-ServerLayout.conf 3.36 + sed -e '/Section "Files"/,/EndSection/!d' \ 3.37 + -e "s/EndSection/EndSection\n/" $xorg_template > \ 3.38 + $xorg_config/20-Files.conf 3.39 + sed -e '/Section "Module"/,/EndSection/!d' \ 3.40 + -e "s/EndSection/EndSection\n/" $xorg_template > \ 3.41 + $xorg_config/30-Module.conf 3.42 + sed -e '/Section "Monitor"/,/EndSection/!d' \ 3.43 + -e "s/EndSection/EndSection\n/" $xorg_template > \ 3.44 + $xorg_config/50-Monitor.conf 3.45 + sed -e '/Section "Device"/,/EndSection/!d' \ 3.46 + -e "s/EndSection/EndSection\n/" $xorg_template > \ 3.47 + $xorg_config/60-Device.conf 3.48 + sed -e '/Section "Screen"/,/EndSection/!d' \ 3.49 + -e "s/EndSection/EndSection\n/" $xorg_template > \ 3.50 + $xorg_config/70-Screen.conf 3.51 3.52 # Remove the template. 3.53 rm $xorg_template 3.54 @@ -86,92 +103,86 @@ 3.55 keymap=${keymap%-lat2} 3.56 keymap=${keymap%-lat6} 3.57 keymap=${keymap%-abnt2} 3.58 - echo ' Option "XkbLayout" "'$keymap\" >> $keyboard_config 3.59 - ;; 3.60 + echo ' Option "XkbLayout" "'$keymap\" >> $keyboard_config ;; 3.61 esac 3.62 3.63 echo 'Endsection' >> $keyboard_config 3.64 3.65 # Create a xorg.conf if needed. 3.66 - [ ! -f /etc/X11/xorg.conf ] && echo "# You can put here your own Xorg configurations. 3.67 - # This configuration file is read before all files in /etc/X11/xorg.conf.d 3.68 - # This file will not be erased by any updates." > /etc/X11/xorg.conf 3.69 + if [ ! -f /etc/X11/xorg.conf ]; then 3.70 + cat > /etc/X11/xorg.conf << EOT 3.71 +# You can put here your own Xorg configurations. This config file is read 3.72 +# before all files in /etc/X11/xorg.conf.d and will NOT be erased by any 3.73 +updates. 3.74 +EOT 3.75 + fi 3.76 } 3.77 3.78 # Install xorg server. 3.79 install_xorg() 3.80 { 3.81 - tazpkg recharge 3.82 + [ -f "/var/lib/tazpkg/packages.list" ] || tazpkg recharge 3.83 exec 3>&1 3.84 value=`$DIALOG --clear --colors --title " Install Xorg " \ 3.85 --menu \ 3.86 "The 'tazx' application helps you to select your X driver." 16 70 5 \ 3.87 - $(grep xorg-xf86-video /var/lib/tazpkg/packages.list | cut -d- -f4 | while read x; do echo $x; echo driver; done) \ 3.88 + $(fgrep xorg-xf86-video /var/lib/tazpkg/packages.list | cut -d- -f4 | while read x; do echo $x; echo driver; done) \ 3.89 "quit" "Quitter" \ 3.90 2>&1 1>&3` 3.91 retval=$? 3.92 exec 3>&- 3.93 - # Continue, exit... 3.94 + 3.95 + # Continue or exit. 3.96 case $retval in 3.97 - 1) 3.98 - echo "Cancel pressed..." 3.99 - exit 0 ;; 3.100 - 255) 3.101 - if test -z "$value"; then 3.102 - echo "ESC pressed..." 3.103 - exit 0 3.104 - fi ;; 3.105 + 0) continue ;; 3.106 + 1|255) exit 0 ;; 3.107 esac 3.108 + 3.109 # Set selected value. 3.110 case $value in 3.111 - quit) 3.112 - echo "Quit..." 3.113 - exit 0 ;; 3.114 + quit) exit 0 ;; 3.115 *) 3.116 - tazpkg get-install xorg-server 3.117 - tazpkg get-install xorg-xf86-video-$value 3.118 - xorg_conf_d 3.119 - XSERVER=Xorg ;; 3.120 + installed=/var/lib/tazpkg/installed/ 3.121 + [ -d "$installed/xorg-server" ] || tazpkg get-install xorg-server 3.122 + [ -d "$installed/xorg-xf86-video-$value" ] || \ 3.123 + tazpkg get-install xorg-xf86-video-$value 3.124 + xorg_conf_d ;; 3.125 esac 3.126 } 3.127 3.128 -# Screen configuration dialog. 3.129 -screen_config_dialog() 3.130 +# Screen configuration dialog. TODO: menus items to enable/disable X on boot 3.131 +# and sed /etc/rcS.conf to remove slim from RUN_DAEMONS. 3.132 +config_dialog() 3.133 { 3.134 exec 3>&1 3.135 value=`$DIALOG \ 3.136 --clear --colors \ 3.137 --title " Configure X " \ 3.138 - --menu \ 3.139 - "The 'tazx' application helps you to configure your Xorg.\n\ 3.140 - Window Manager : \Z2$WM\Zn \n\ 3.141 - X server : \Z2Xorg\Zn" 16 70 5 \ 3.142 - "xorg" "Install or reconfigure Xorg" \ 3.143 - "quit" "Quit Tazx utility" \ 3.144 + --menu "\ 3.145 +$(gettext "Tazx dialog helps you to configure your Xorg.")\n\ 3.146 +$(gettext "Window Manager:") \Z2$WM\Zn \ 3.147 +$(gettext "X server:") \Z2Xorg\Zn" 16 70 5 \ 3.148 + "xorg" "$(gettext "Install or reconfigure Xorg")" \ 3.149 + "xfbdev" "$(gettext "Install TinyX server Xfbdev")" \ 3.150 + "quit" "$(gettext "Quit Tazx utility")" \ 3.151 2>&1 1>&3` 3.152 retval=$? 3.153 exec 3>&- 3.154 - # Continue, exit or help... 3.155 + 3.156 + # Continue or exit. 3.157 case $retval in 3.158 - 0) 3.159 - continue ;; 3.160 - 1) 3.161 - echo "Cancel pressed..." 3.162 - exit 0 ;; 3.163 - 255) 3.164 - if test -n "$value"; then 3.165 - continue 3.166 - else 3.167 - echo "ESC pressed..." 3.168 - exit 0 3.169 - fi ;; 3.170 + 0) continue ;; 3.171 + 1|255) exit 0 ;; 3.172 esac 3.173 + 3.174 # Set selected value. 3.175 case $value in 3.176 xorg) 3.177 install_xorg ;; 3.178 - *) 3.179 - continue ;; 3.180 + xfbdev) 3.181 + # FIXME: Much to do here, for now just install Xfbdev. 3.182 + tazpkg get-install xorg-server-xfbdev ;; 3.183 + *) exit 0 ;; 3.184 esac 3.185 } 3.186 3.187 @@ -376,7 +387,7 @@ 3.188 fi 3.189 if test $(id -u) = 0; then 3.190 echo "xorg" > /etc/X11/screen.conf 3.191 - screen_config_dialog 3.192 + config_dialog 3.193 fi 3.194 wm_config 3.195 creat_xinitrc