[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    l10n/scripts
From:       Nicolas Goutte <nicolasg () snafu ! de>
Date:       2006-03-04 13:39:48
Message-ID: 1141479588.901358.21351.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 515650 by goutte:

- avoid Bash-isms ( $(), export VAR=something ...)
- avoid creating sub-shells for little use


 M  +27 -24    makeScreenshots  


--- trunk/l10n/scripts/makeScreenshots #515649:515650
@@ -107,8 +107,9 @@
 SHOTS_DIR="$HOME/images"
 LANGUAGES="en"
 
-export KDEXECUTORDIR="$HOME/bin/kdexecutor"
-export LD_LIBRARY_PATH=$KDEXECUTORDIR/lib:$LD_LIBRARY_PATH
+KDEXECUTORDIR="$HOME/bin/kdexecutor"
+LD_LIBRARY_PATH=$KDEXECUTORDIR/lib:$LD_LIBRARY_PATH
+export KDEXECUTORDIR LD_LIBRARY_PATH
 
 #######################################################
 # make screenshots for each LANG in LANGUAGES
@@ -118,21 +119,22 @@
 # If we didn't set the language list explicitly, set it to all languages with
 # a translation of this program installed, can't be done before the end of the
 # commandline parsing ($NAMEx != x) needs to be true
-if (test "$LANGUAGES" == "en"); then 
+if test "$LANGUAGES" = "en"; then 
   get_language_list;
 fi;  
 
 for language in $LANGUAGES; do
-  echo "Making '$language' screenshots ($(ls -1 $SCRIPT_DIR/$NAME*.kdx | \
-        wc -l) kdexecutor-scripts to run)...";
+  echo "Making '$language' screenshots (`ls -1 $SCRIPT_DIR/$NAME*.kdx | \
+        wc -l` kdexecutor-scripts to run)...";
 
-  export LANG=$language;
-  export KDE_LANG=$language;
+  LANG=$language
+  KDE_LANG=$language
+  export LANG KDE_LANG
   mkdir -p "$SHOTS_DIR/$NAME/$language";
   cd $SHOTS_DIR/$NAME/$language;
 
   # if we are using absolute paths
-  if (echo $SCRIPT_DIR | grep "^/"); then
+  if echo $SCRIPT_DIR | grep "^/"; then
     SCRIPT_LIST=`ls $SCRIPT_DIR/$NAME*.kdx`;
     SCRIPT_CONFIG=$SCRIPT_DIR/screenshots_config
   # if not, take into account that we went down 2 dirs
@@ -158,9 +160,9 @@
 ############################################################
 download_kdexecutor () {
   # determine name of version to download based on gcc version
-  if (gcc -v 2>&1 | grep 2.95 > /dev/null); then 
+  if gcc -v 2>&1 | grep 2.95 > /dev/null; then 
     name=kdexecutor-2.1.1-linux-g++2.95-KDE-mt-qt-3.2.0;
-  elif (gcc -v 2>&1 | grep 2.96 > /dev/null); then 
+  elif gcc -v 2>&1 | grep 2.96 > /dev/null; then 
     name=kdexecutor-2.1.1-linux-g++2.96-KDE-mt-qt-3.2.0;
   else  
     name=kdexecutor-2.1.1-linux-g++3-KDE-mt-qt-3.2.0;
@@ -172,8 +174,9 @@
   rm $name.tar.bz2;
 
   # set KDEXECUTORDIR in this script
-  export KDEXECUTORDIR=~/$name;
-  export LD_LIBRARY_PATH=$KDEXECUTORDIR/lib:$LD_LIBRARY_PATH
+  KDEXECUTORDIR=~/$name
+  LD_LIBRARY_PATH=$KDEXECUTORDIR/lib:$LD_LIBRARY_PATH
+  export KDEXECUTORDIR LD_LIBRARY_PATH
   sed -i s%KDEXECUTORDIR=\".*\"%KDEXECUTORDIR=\"$KDEXECUTORDIR\"% $0;
 }
 
@@ -206,7 +209,7 @@
 ##############################################################################
 get_language_list () {
   for directory in `kde-config --path locale | sed "s/:/ /g"`; do
-    if (test -e $directory); then
+    if test -e $directory; then
       for subdir in `ls  -1 -p $directory | grep "/$"`; do
         if (test -e ${directory}${subdir}LC_MESSAGES/${NAME}.mo); then
           LANG=`echo $subdir | sed "s%/$%%"`;
@@ -234,7 +237,7 @@
 # Parse command line arguments
 # print help if there are no arguments
 #######################################
-while (test $# -ge 1); do
+while test $# -ge 1; do
   case $1 in
     -\?|-h|--help)
       print_help;
@@ -242,7 +245,7 @@
     ;;
 
     -l|--languagelist)
-      if(test $# -ge 2); then
+      if test $# -ge 2; then
         LANGUAGES="`echo $2 | sed 's/,/ /g'`";
         shift; shift;
       else
@@ -257,7 +260,7 @@
     ;;
     
     --script-dir)
-      if(test $# -ge 2); then
+      if test $# -ge 2; then
         SCRIPT_DIR="$2";
         shift;shift;
       else
@@ -267,7 +270,7 @@
     ;;
 
     --screenshot-dir)
-      if(test $# -ge 2); then
+      if test $# -ge 2; then
         SHOTS_DIR="$2";
         shift;shift;
       else
@@ -277,7 +280,7 @@
     ;;
 
     *)
-      if(test $# -eq 1); then
+      if test $# -eq 1; then
         NAME=$1;
         ## don't use which in case program isn't in the PATH
         # [ASK] don't use whereis either, that does naughty things if there's
@@ -295,12 +298,12 @@
 
 # if we don't have a valid KDEXECUTORDIR, ask the user if he wants to download 
 # the program (as this probably means it isn't installed)
-if (test -z "$KDEXECUTORDIR") || (test ! -e $KDEXECUTORDIR);then
+if test -z "$KDEXECUTORDIR" -o ! -e $KDEXECUTORDIR; then
   kdialog --yesno "The KDEXECUTORDIR variable of this script is unset or \
 points to a nonexisting directory. This probably means that you haven't \
 downloaded KD Executor yet.\nDo you want to try to download and install \
 KD Executor (it will be unpacked and installed in your homedir)?.";
-  if (test $? -eq 0); then
+  if test $? -eq 0; then
     download_kdexecutor;
   else
     kdialog --msgbox "This script needs KD Executor to run. Please download \
@@ -313,20 +316,20 @@
 # Execute each script for $NAME once for each language in LANGUAGES. 
 # If there are no scripts for $NAME ask the user if he wants to create one now. 
 # (it will then be executed for each language after that.
-if (ls -1 $SCRIPT_DIR/$NAME*.kdx > /dev/null 2>&1); then
+if ls -1 $SCRIPT_DIR/$NAME*.kdx > /dev/null 2>&1; then
   do_screenshots;
 else
   kdialog --yesno "There is no kdexecutor script present in $SCRIPT_DIR for \
 taking screenshots of $NAME.\nDo you want to start kdexcecutor in record mode \
 and create one?";
-  if (test $? -eq 0); then
+  if test $? -eq 0; then
 
     # warn if there already exist .png files in . 
-    if (ls -1 *.png > /dev/null 2>&1); then
+    if ls -1 *.png > /dev/null 2>&1; then
       kdialog --yesno "There are .png files present in the current directory. \
 This script will remove these files together with the temporary screenshots \
 you will be making.\nAre you sure you want to continue?";
-      if (test $? -eq 0); then
+      if test $? -eq 0; then
         execute;
       else
         exit;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic