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.
This commit is contained in:
Andrius Štikonas 2010-07-06 16:03:55 +03:00
parent 24043679a2
commit f92f926032
2 changed files with 16 additions and 14 deletions

View File

@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
source `dirname $0`/ths-variables source "`dirname $0`/ths-variables"
source $THS source $THS
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
@ -29,10 +29,12 @@ else
messages="$potrunk" messages="$potrunk"
pot="$pottrunk" pot="$pottrunk"
fi fi
wdir="`pwd`"
cd $pot cd $pot
for dir in `ls`; do for dir in `ls`; do
cd $dir cd "$dir"
podir="../../$messages/$dir" podir="$wdir/$messages/$dir"
if [ ! -e "$podir" ]; then if [ ! -e "$podir" ]; then
mkdir "$podir" mkdir "$podir"
svn add "$podir" svn add "$podir"

View File

@ -101,17 +101,17 @@ fi
## MAIN LOOP ## MAIN LOOP
for updfile in $newtrans for updfile in $newtrans
do 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 if [ "$option_verbose" = "Y" ]; then
echo 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 "cannot determine the right one,"
echo "SKIPPING..." echo "SKIPPING..."
fi fi
continue continue
fi 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 if [ "$option_verbose" = "Y" ]; then
echo echo
echo "Strange, there is more than one version of translation `basename $updfile`," 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 [ `cd $tpl_tree; find ${updfile}t 2> /dev/null | wc -l` -lt 1 ]; then
if [ "$option_verbose" = "Y" ]; then if [ "$option_verbose" = "Y" ]; then
echo 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..." echo "SKIPPING..."
find ${updfile}t -print find ${updfile}t -print
fi fi
@ -135,20 +135,20 @@ if [ `cd $tpl_tree; find ${updfile}t 2> /dev/null | wc -l` -lt 1 ]; then
fi 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
echo "File `basename $updfile` is completely newly translated," echo "File `basename $updfile` is completely newly translated,"
echo "COPYING it to the appropriate place..." echo "COPYING it to the appropriate place..."
#finding the appropriate #finding the appropriate
tplfile=`cd $tpl_tree; find ${updfile}t` tplfile=`cd "$tpl_tree"; find ${updfile}t`
secdir=`dirname $tplfile` secdir=`dirname "$tplfile"`
cp $upd_dir/$updfile $tra_tree/$secdir/$updfile cp "$upd_dir/$updfile" "$tra_tree/$secdir/$updfile"
fi fi
# perform msgmerge and other actions # perform msgmerge and other actions
trafile=`cd $tra_tree; find $updfile` trafile=`cd "$tra_tree"; find "$updfile"`
tplfile=`cd $tpl_tree; find ${updfile}t` tplfile=`cd "$tpl_tree"; find "${updfile}t"`
mv $tra_tree/$trafile $tra_tree/${trafile}.old mv "$tra_tree/$trafile" "$tra_tree/${trafile}.old"
if [ ! "$option_new_as_secondary" = "Y" ]; then if [ ! "$option_new_as_secondary" = "Y" ]; then
if [ "$option_verbose" = "Y" ]; then if [ "$option_verbose" = "Y" ]; then