commit ccff4b15e23227cc43bff2d416ce434a2e5724aad6d2e3cea9803c31b4e2e045 Author: OBS User unknown Date: Mon Jan 15 23:36:52 2007 +0000 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/sgml-skel?expand=0&rev=1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/edit-xml-catalog.sh b/edit-xml-catalog.sh new file mode 100644 index 0000000..581c216 --- /dev/null +++ b/edit-xml-catalog.sh @@ -0,0 +1,122 @@ +#!/bin/bash + +# $0 $for_root_catalog add|del +export LC_ALL=C + +usage="\ +$0 [-a|-d] [--add|--del] [-c|--catalog /etc/xml/CATALOG] CATALOG_FRAGMENT_FILE" +# TEMP=$(getopt -o ac:dghv \ +# --long add,cat:,catalog:,del,delete,group,help,verbose \ +# -n "$0" -- "$@") +# # Note the quotes around `$TEMP': they are essential! +# eval set -- "$TEMP" + +ROOTCATALOG=/etc/xml/catalog +mode=add +while test $# -gt 0; do +# while true ; do + case "$1" in + -h|--help) echo "$usage"; exit 0 ;; + -a|--add) mode=add; shift ;; + -c|--cat*) if test $# -gt 1; then ROOTCATALOG="$2"; shift 2; + else echo "$usage"; exit 1; fi ;; + -d|--del*) mode=del; shift ;; + -g|--group) marker=group; shift ;; + -v|--verbose) verbose="-v"; echo=echo; shift ;; + --) shift ; break ;; + *) break ;; + # *) echo "Internal error!" ; exit 1 ;; + esac +done +FOR_ROOT_CAT=$1 + +[ -z "$FOR_ROOT_CAT" ] && { echo $usage; exit 1; } + +xmlcat=/usr/bin/xmlcatalog +xmllint=/usr/bin/xmllint + +for b in $xmlcat $xmllint; do + [ -x $b ] || { echo "error: $b does not exist" ; exit 1; } +done + +prep_catalog () { + local cat=$1 + [ -s $cat ] || rm -f $cat + if [ -r $cat ]; then + if grep -q '"urn:oasis:names:tc:entity:xmlns:xml:catalog"/>' $cat; then + rm -f $cat + fi + fi + if [ ! -r $cat ] ; then + $xmlcat --create | sed 's:/>:>\ +:' >$cat + # echo Failed creating XML Catalog root $1 + fi +} + +# Check /etc/xml/catalog +prep_catalog /etc/xml/catalog + +if [ "$ROOTCATALOG" != /etc/xml/catalog ]; then + root=${ROOTCATALOG#/etc/xml/} + if ! grep -q "nextCatalog.*catalog=\"${root}\"" /etc/xml/catalog; then + cp /etc/xml/catalog /etc/xml/catalog.tmp + sed "/<\/catalog>/i\\ +" \ + /etc/xml/catalog.tmp >/etc/xml/catalog + fi + prep_catalog "$ROOTCATALOG" +fi + +add_entry () { + { + sed '/<\/catalog>/d' $ROOTCATALOG + $xmllint --nocatalogs --format ${FOR_ROOT_CAT} \ + | awk '\ +/<\/catalog>/{next} +s == 1 {print} +/"}' + } >$ROOTCATALOG.tmp + $xmllint --nocatalogs --noout $ROOTCATALOG.tmp \ + && mv $ROOTCATALOG.tmp $ROOTCATALOG +} + +del_entry () { + pattern=$FOR_ROOT_CAT + echo $pattern + if [ -r $ROOTCATALOG ]; then + # Either delete ... + # or ... + if [ "$marker" = "group" ]; then + $xmllint --nocatalogs --format $ROOTCATALOG \ + | awk "\ +/<\/group>/ && s == 1 {s=0;next} +s == 1 {next} +//{s=1;next} +{print}" > $ROOTCATALOG.tmp + else + $xmllint --nocatalogs --format $ROOTCATALOG \ + | awk "\ +//{s=0;next} +s == 1 {next} +//{s=1;next} +{print}" > $ROOTCATALOG.tmp + fi + $xmllint --nocatalogs --noout $ROOTCATALOG.tmp \ + && mv $ROOTCATALOG.tmp $ROOTCATALOG + fi +} + +case "$mode" in + del) + del_entry + ;; + add) + [ -r ${FOR_ROOT_CAT} ] || { echo \"$FOR_ROOT_CAT\" does not exist; exit 1; } + add_entry + ;; + *) +esac + +exit diff --git a/install-catalog.in b/install-catalog.in new file mode 100644 index 0000000..d8eba46 --- /dev/null +++ b/install-catalog.in @@ -0,0 +1,163 @@ +#!/bin/sh +# Script to install a catalog in the centralized SGML catalog +# Send any comments to Eric Bischoff +# This program is under GPL license. See LICENSE file for details. + +# Set help message +SGML_HELP_MESSAGE="Usage: `basename $0` [