gconf-merge-schema 874 B

1234567891011121314151617181920212223242526272829303132333435
  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
  6. OUTFILE="$1"
  7. DOMAIN=""
  8. shift
  9. if [ "$1" = "--domain" ]; then
  10. shift
  11. DOMAIN=$1
  12. shift
  13. fi
  14. echo '<?xml version="1.0"?>' > "$OUTFILE"
  15. echo '<gconfschemafile><schemalist>' >> "$OUTFILE"
  16. while [ "$1" ]; do
  17. if [ -f "$1" ]; then
  18. sed -e '/<?xml/d' \
  19. -e 's|<gconfschemafile>||g' \
  20. -e 's|</gconfschemafile>||g' \
  21. -e 's|<schemalist>||g' \
  22. -e 's|</schemalist>||g' "$1" >> "$OUTFILE"
  23. fi
  24. shift
  25. done
  26. echo '</schemalist></gconfschemafile>' >> "$OUTFILE"
  27. if [ "$DOMAIN" != "" ]; then
  28. 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"
  29. fi