36 lines
1.1 KiB
Diff
36 lines
1.1 KiB
Diff
--- edit-xml-catalog.sh 2008-05-14 13:28:16.000000000 +0200
|
|
+++ edit-xml-catalog.sh 2008-05-14 13:54:11.000000000 +0200
|
|
@@ -61,10 +61,8 @@
|
|
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\\
|
|
-<nextCatalog catalog=\"${root}\"/>" \
|
|
- /etc/xml/catalog.tmp >/etc/xml/catalog
|
|
+ sed -i "/<\/catalog>/i\\
|
|
+<nextCatalog catalog=\"${root}\"/>" /etc/xml/catalog
|
|
fi
|
|
prep_catalog "$ROOTCATALOG"
|
|
fi
|
|
@@ -79,6 +77,9 @@
|
|
/<catalog/{s=1}
|
|
END{print "</catalog>"}'
|
|
} >$ROOTCATALOG.tmp
|
|
+ if [ -x /bin/chmod ]; then
|
|
+ /bin/chmod --reference=$ROOTCATALOG $ROOTCATALOG.tmp
|
|
+ fi
|
|
$xmllint --nocatalogs --noout $ROOTCATALOG.tmp \
|
|
&& mv $ROOTCATALOG.tmp $ROOTCATALOG
|
|
}
|
|
@@ -104,6 +105,9 @@
|
|
/<!-- pac_start: $pattern do not remove! -->/{s=1;next}
|
|
{print}" > $ROOTCATALOG.tmp
|
|
fi
|
|
+ if [ -x /bin/chmod ]; then
|
|
+ /bin/chmod --reference=$ROOTCATALOG $ROOTCATALOG.tmp
|
|
+ fi
|
|
$xmllint --nocatalogs --noout $ROOTCATALOG.tmp \
|
|
&& mv $ROOTCATALOG.tmp $ROOTCATALOG
|
|
fi
|