updated on Sun Jan 15 16:02:00 UTC 2012
[aur-mirror.git] / mate-conf / mateconf-merge-schema
blob328275501c7c80975e9336cd203fc926dd4efc99
1 #!/bin/bash
2 if [ ! "$1" -a ! "$2" ]; then
3 echo "Usage: $0 output.schemas [--domain gettextdomain] file1.schemas [file2.schemas [...]]"
4 exit 1
5 fi
7 OUTFILE="$1"
8 DOMAIN=""
9 shift
11 if [ "$1" = "--domain" ]; then
12 shift
13 DOMAIN=$1
14 shift
17 echo '<?xml version="1.0"?>' > "$OUTFILE"
18 echo '<mateconfschemafile><schemalist>' >> "$OUTFILE"
20 while [ "$1" ]; do
21 if [ -f "$1" ]; then
22 sed -e '/<?xml/d' \
23 -e 's|<mateconfschemafile>||g' \
24 -e 's|</mateconfschemafile>||g' \
25 -e 's|<schemalist>||g' \
26 -e 's|</schemalist>||g' "$1" >> "$OUTFILE"
28 shift
29 done
31 echo '</schemalist></mateconfschemafile>' >> "$OUTFILE"
32 if [ "$DOMAIN" != "" ]; then
33 sed -ri "s/^([[:space:]]*)(<locale name=\"C\">)/\1<gettext_domain>$DOMAIN<\/gettext_domain>\n\1\2/; /^[[:space:]]*<locale name=\"[^C]/,/^[[:space:]]*<\/locale>[[:space:]]*\$/ d; /^$/d; s/<\/schema>$/&\n/" "$OUTFILE"