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
# along with this program. If not, see <http://www.gnu.org/licenses/>.
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"

View File

@ -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