2007-12-02 14:23:45 -06:00
|
|
|
#! /bin/sh
|
|
|
|
|
2007-12-23 14:18:07 -06:00
|
|
|
gsed=`which gsed 2>/dev/null`
|
2007-12-13 13:48:55 -06:00
|
|
|
if [ -x "$gsed" ]; then
|
|
|
|
sed=$gsed
|
2007-12-07 13:23:59 -06:00
|
|
|
ext_opt=-r
|
|
|
|
else
|
|
|
|
sed=sed
|
|
|
|
case `uname` in
|
|
|
|
Darwin|*BSD)
|
|
|
|
ext_opt=-E
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
ext_opt=-r
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2007-12-02 14:23:45 -06:00
|
|
|
if [ $# != 2 ]; then
|
|
|
|
echo "usage: $0 src_file dst_file" > /dev/stderr
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
src="$1"
|
|
|
|
dst="$2"
|
|
|
|
|
|
|
|
do_xml() {
|
2007-12-07 13:23:59 -06:00
|
|
|
$sed -e 's@<_@<@g' -e 's@</_@</@g' "$src" > "$dst.tmp" || exit 1
|
2007-12-02 14:23:45 -06:00
|
|
|
mv "$dst.tmp" "$dst" || exit1
|
|
|
|
}
|
|
|
|
|
|
|
|
do_desktop() {
|
2007-12-07 13:23:59 -06:00
|
|
|
$sed $ext_opt -e 's@^_(\w+)=@\1=@g' "$src" > "$dst.tmp" || exit 1
|
2007-12-02 14:23:45 -06:00
|
|
|
mv "$dst.tmp" "$dst" || exit1
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$src" in
|
|
|
|
*.xml.in)
|
|
|
|
do_xml
|
|
|
|
;;
|
2008-09-13 00:22:26 -05:00
|
|
|
*.desktop.in|*.ini.in)
|
2007-12-02 14:23:45 -06:00
|
|
|
do_desktop
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "unknown file type: $src" > /dev/stderr
|
|
|
|
exit 1
|
|
|
|
esac
|