From f92f926032b8c4acdfc9516427388ab993bed227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Tue, 6 Jul 2010 16:03:55 +0300 Subject: [PATCH] Make init-po-files script work better with symlinks. "cd ../podir" doesn't know that the folder is accessed via symlink so it returs parent of the real folder not the folder where symlink exists. This shoudn't change anything in the absence of symlinks. Also add a few more quotes to guard against shell expansion. --- init-po-files | 8 +++++--- poupdate | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/init-po-files b/init-po-files index 756943a..51cefc1 100755 --- a/init-po-files +++ b/init-po-files @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -source `dirname $0`/ths-variables +source "`dirname $0`/ths-variables" source $THS if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then @@ -29,10 +29,12 @@ else messages="$potrunk" pot="$pottrunk" fi + +wdir="`pwd`" cd $pot for dir in `ls`; do - cd $dir - podir="../../$messages/$dir" + cd "$dir" + podir="$wdir/$messages/$dir" if [ ! -e "$podir" ]; then mkdir "$podir" svn add "$podir" diff --git a/poupdate b/poupdate index c7b4b38..a6fdade 100755 --- a/poupdate +++ b/poupdate @@ -101,17 +101,17 @@ fi ## MAIN LOOP for updfile in $newtrans do -if [ `cd $tpl_tree; find ${updfile}t 2> /dev/null | wc -l` -gt 1 ]; then +if [ `cd "$tpl_tree"; find ${updfile}t 2> /dev/null | wc -l` -gt 1 ]; then if [ "$option_verbose" = "Y" ]; then echo - echo "Strange, there is more than one template for `basename $updfile`," + echo "Strange, there is more than one template for `basename "$updfile"`," echo "cannot determine the right one," echo "SKIPPING..." fi continue fi -if [ `cd $tpl_tree; find ${updfile} 2> /dev/null | wc -l` -gt 1 ]; then +if [ `cd "$tpl_tree"; find ${updfile} 2> /dev/null | wc -l` -gt 1 ]; then if [ "$option_verbose" = "Y" ]; then echo echo "Strange, there is more than one version of translation `basename $updfile`," @@ -126,7 +126,7 @@ fi if [ `cd $tpl_tree; find ${updfile}t 2> /dev/null | wc -l` -lt 1 ]; then if [ "$option_verbose" = "Y" ]; then echo - echo "File `basename $updfile` does not belong to this translation project," + echo "File `basename "$updfile"` does not belong to this translation project," echo "SKIPPING..." find ${updfile}t -print fi @@ -135,20 +135,20 @@ if [ `cd $tpl_tree; find ${updfile}t 2> /dev/null | wc -l` -lt 1 ]; then fi -if [ `cd $tra_tree; find ${updfile} 2> /dev/null | wc -l` -lt 1 ]; then +if [ `cd "$tra_tree"; find ${updfile} 2> /dev/null | wc -l` -lt 1 ]; then echo echo "File `basename $updfile` is completely newly translated," echo "COPYING it to the appropriate place..." #finding the appropriate - tplfile=`cd $tpl_tree; find ${updfile}t` - secdir=`dirname $tplfile` - cp $upd_dir/$updfile $tra_tree/$secdir/$updfile + tplfile=`cd "$tpl_tree"; find ${updfile}t` + secdir=`dirname "$tplfile"` + cp "$upd_dir/$updfile" "$tra_tree/$secdir/$updfile" fi # perform msgmerge and other actions - trafile=`cd $tra_tree; find $updfile` - tplfile=`cd $tpl_tree; find ${updfile}t` - mv $tra_tree/$trafile $tra_tree/${trafile}.old +trafile=`cd "$tra_tree"; find "$updfile"` +tplfile=`cd "$tpl_tree"; find "${updfile}t"` +mv "$tra_tree/$trafile" "$tra_tree/${trafile}.old" if [ ! "$option_new_as_secondary" = "Y" ]; then if [ "$option_verbose" = "Y" ]; then