File: scrub-dsssl-catalog-cruft

package info (click to toggle)
jade 1.2.1-43
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,808 kB
  • ctags: 16,989
  • sloc: cpp: 120,657; sh: 10,452; ansic: 8,228; perl: 378; makefile: 296; sed: 5
file content (31 lines) | stat: -rw-r--r-- 838 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh

set -e

# catalog info based on dsssl/catalog

CAT=/etc/sgml.catalog
# the _FIX makes it actually put in the dsssl.cat instead of the davenport one
SIG="9ed965b566274159f9ea7c7feb9cc48c_FIX"
SBEG="-- SGML BEGIN dsssl.cat"
SEND="-- SGML END dsssl.cat"
SIGNBEG="$SBEG $SIG --"
SIGNEND="$SEND $SIG --"

# *always* ditch the old crufty entries.
if grep -q "^$SBEG" $CAT && grep -q "^$SEND" $CAT; then
    echo "Cleaning out DSSSL DTD entries from $CAT on $1."
    sed -e "/$SBEG/,/$SEND/d" < $CAT > ${CAT}.new
    mv ${CAT}.new ${CAT}
else
    if grep -q "fot.dtd" $CAT && \
       grep -q "dsssl.dtd" $CAT && \
       grep -q "style-sheet.dtd" $CAT
    then
	echo "Untagged entries found, cleaning"
	grep -v "fot.dtd" < $CAT | \
	  grep -v "dsssl.dtd" | \
	  grep -v "style-sheet.dtd" > ${CAT}.new
	mv ${CAT}.new ${CAT}
    fi
fi