# HG changeset patch # User Christophe Lincoln # Date 1308087375 -7200 # Node ID b8be57e0e90b4f7904fcffc299b3d13bb514dcc6 # Parent fc37e8002ad6ddae07eee54df909b4e32808c70a tazx: code clean-up and more gettextization diff -r fc37e8002ad6 -r b8be57e0e90b Makefile --- a/Makefile Tue Jun 14 22:53:51 2011 +0200 +++ b/Makefile Tue Jun 14 23:36:15 2011 +0200 @@ -21,7 +21,8 @@ @echo -n "Generating SliTaz Tools pot file... " @xgettext -o po/slitaz-tools/slitaz-tools.pot -L Shell \ --package-name="SliTaz Tools" \ - ./tinyutils/tazlocale ./tinyutils/tazkeymap ./tinyutils/setmixer + ./tinyutils/tazlocale ./tinyutils/tazkeymap ./tinyutils/setmixer \ + ./tinyutils/tazx @echo "done" boxes-pot: diff -r fc37e8002ad6 -r b8be57e0e90b po/slitaz-tools/slitaz-tools.pot --- a/po/slitaz-tools/slitaz-tools.pot Tue Jun 14 22:53:51 2011 +0200 +++ b/po/slitaz-tools/slitaz-tools.pot Tue Jun 14 23:36:15 2011 +0200 @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: SliTaz Tools\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-14 22:53+0200\n" +"POT-Creation-Date: 2011-06-14 23:34+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -50,3 +50,31 @@ #: tinyutils/setmixer:53 msgid "Done" msgstr "" + +#: tinyutils/tazx:32 +msgid "You must be root to configure X server." +msgstr "" + +#: tinyutils/tazx:162 +msgid "Tazx dialog helps you to configure your Xorg." +msgstr "" + +#: tinyutils/tazx:163 +msgid "Window Manager:" +msgstr "" + +#: tinyutils/tazx:164 +msgid "X server:" +msgstr "" + +#: tinyutils/tazx:165 +msgid "Install or reconfigure Xorg" +msgstr "" + +#: tinyutils/tazx:166 +msgid "Install TinyX server Xfbdev" +msgstr "" + +#: tinyutils/tazx:167 +msgid "Quit Tazx utility" +msgstr "" diff -r fc37e8002ad6 -r b8be57e0e90b tinyutils/tazx --- a/tinyutils/tazx Tue Jun 14 22:53:51 2011 +0200 +++ b/tinyutils/tazx Tue Jun 14 23:36:15 2011 +0200 @@ -22,11 +22,16 @@ TEXTDOMAIN='slitaz-tools' export TEXTDOMAIN +# # Functions +# # Be sure we're root. check_root() { - [ $(id -u) != 0 ] && gettext -e "\nYou must be root to configure x.\n\n" && exit 0 + if [ $(id -u) != 0 ]; then + gettext "You must be root to configure X server." + echo "" && exit 0 + fi } # Populate xorg.conf.d. @@ -44,13 +49,25 @@ # Backup existing config. tar -cf $xorg_config/../Previous_xorg.conf.d.tar $xorg_config/ &> /dev/null - # Put the differents sections in separate files in the configuration directory. - sed -e '/Section "ServerLayout"/,/EndSection/!d' -e "s/EndSection/EndSection\n/" $xorg_template | grep -v Core > $xorg_config/10-ServerLayout.conf - sed -e '/Section "Files"/,/EndSection/!d' -e "s/EndSection/EndSection\n/" $xorg_template > $xorg_config/20-Files.conf - sed -e '/Section "Module"/,/EndSection/!d' -e "s/EndSection/EndSection\n/" $xorg_template > $xorg_config/30-Module.conf - sed -e '/Section "Monitor"/,/EndSection/!d' -e "s/EndSection/EndSection\n/" $xorg_template > $xorg_config/50-Monitor.conf - sed -e '/Section "Device"/,/EndSection/!d' -e "s/EndSection/EndSection\n/" $xorg_template > $xorg_config/60-Device.conf - sed -e '/Section "Screen"/,/EndSection/!d' -e "s/EndSection/EndSection\n/" $xorg_template > $xorg_config/70-Screen.conf + # Put the differents sections in separate files in the config directory. + sed -e '/Section "ServerLayout"/,/EndSection/!d' \ + -e "s/EndSection/EndSection\n/" $xorg_template | \ + grep -v Core > $xorg_config/10-ServerLayout.conf + sed -e '/Section "Files"/,/EndSection/!d' \ + -e "s/EndSection/EndSection\n/" $xorg_template > \ + $xorg_config/20-Files.conf + sed -e '/Section "Module"/,/EndSection/!d' \ + -e "s/EndSection/EndSection\n/" $xorg_template > \ + $xorg_config/30-Module.conf + sed -e '/Section "Monitor"/,/EndSection/!d' \ + -e "s/EndSection/EndSection\n/" $xorg_template > \ + $xorg_config/50-Monitor.conf + sed -e '/Section "Device"/,/EndSection/!d' \ + -e "s/EndSection/EndSection\n/" $xorg_template > \ + $xorg_config/60-Device.conf + sed -e '/Section "Screen"/,/EndSection/!d' \ + -e "s/EndSection/EndSection\n/" $xorg_template > \ + $xorg_config/70-Screen.conf # Remove the template. rm $xorg_template @@ -86,92 +103,86 @@ keymap=${keymap%-lat2} keymap=${keymap%-lat6} keymap=${keymap%-abnt2} - echo ' Option "XkbLayout" "'$keymap\" >> $keyboard_config - ;; + echo ' Option "XkbLayout" "'$keymap\" >> $keyboard_config ;; esac echo 'Endsection' >> $keyboard_config # Create a xorg.conf if needed. - [ ! -f /etc/X11/xorg.conf ] && echo "# You can put here your own Xorg configurations. - # This configuration file is read before all files in /etc/X11/xorg.conf.d - # This file will not be erased by any updates." > /etc/X11/xorg.conf + if [ ! -f /etc/X11/xorg.conf ]; then + cat > /etc/X11/xorg.conf << EOT +# You can put here your own Xorg configurations. This config file is read +# before all files in /etc/X11/xorg.conf.d and will NOT be erased by any +updates. +EOT + fi } # Install xorg server. install_xorg() { - tazpkg recharge + [ -f "/var/lib/tazpkg/packages.list" ] || tazpkg recharge exec 3>&1 value=`$DIALOG --clear --colors --title " Install Xorg " \ --menu \ "The 'tazx' application helps you to select your X driver." 16 70 5 \ - $(grep xorg-xf86-video /var/lib/tazpkg/packages.list | cut -d- -f4 | while read x; do echo $x; echo driver; done) \ + $(fgrep xorg-xf86-video /var/lib/tazpkg/packages.list | cut -d- -f4 | while read x; do echo $x; echo driver; done) \ "quit" "Quitter" \ 2>&1 1>&3` retval=$? exec 3>&- - # Continue, exit... + + # Continue or exit. case $retval in - 1) - echo "Cancel pressed..." - exit 0 ;; - 255) - if test -z "$value"; then - echo "ESC pressed..." - exit 0 - fi ;; + 0) continue ;; + 1|255) exit 0 ;; esac + # Set selected value. case $value in - quit) - echo "Quit..." - exit 0 ;; + quit) exit 0 ;; *) - tazpkg get-install xorg-server - tazpkg get-install xorg-xf86-video-$value - xorg_conf_d - XSERVER=Xorg ;; + installed=/var/lib/tazpkg/installed/ + [ -d "$installed/xorg-server" ] || tazpkg get-install xorg-server + [ -d "$installed/xorg-xf86-video-$value" ] || \ + tazpkg get-install xorg-xf86-video-$value + xorg_conf_d ;; esac } -# Screen configuration dialog. -screen_config_dialog() +# Screen configuration dialog. TODO: menus items to enable/disable X on boot +# and sed /etc/rcS.conf to remove slim from RUN_DAEMONS. +config_dialog() { exec 3>&1 value=`$DIALOG \ --clear --colors \ --title " Configure X " \ - --menu \ - "The 'tazx' application helps you to configure your Xorg.\n\ - Window Manager : \Z2$WM\Zn \n\ - X server : \Z2Xorg\Zn" 16 70 5 \ - "xorg" "Install or reconfigure Xorg" \ - "quit" "Quit Tazx utility" \ + --menu "\ +$(gettext "Tazx dialog helps you to configure your Xorg.")\n\ +$(gettext "Window Manager:") \Z2$WM\Zn \ +$(gettext "X server:") \Z2Xorg\Zn" 16 70 5 \ + "xorg" "$(gettext "Install or reconfigure Xorg")" \ + "xfbdev" "$(gettext "Install TinyX server Xfbdev")" \ + "quit" "$(gettext "Quit Tazx utility")" \ 2>&1 1>&3` retval=$? exec 3>&- - # Continue, exit or help... + + # Continue or exit. case $retval in - 0) - continue ;; - 1) - echo "Cancel pressed..." - exit 0 ;; - 255) - if test -n "$value"; then - continue - else - echo "ESC pressed..." - exit 0 - fi ;; + 0) continue ;; + 1|255) exit 0 ;; esac + # Set selected value. case $value in xorg) install_xorg ;; - *) - continue ;; + xfbdev) + # FIXME: Much to do here, for now just install Xfbdev. + tazpkg get-install xorg-server-xfbdev ;; + *) exit 0 ;; esac } @@ -376,7 +387,7 @@ fi if test $(id -u) = 0; then echo "xorg" > /etc/X11/screen.conf - screen_config_dialog + config_dialog fi wm_config creat_xinitrc