119 kx #!/bin/sh
119 kx
119 kx # Preserve new files
119 kx install_file() {
119 kx NEW="$1"
119 kx OLD="`dirname $NEW`/`basename $NEW .new`"
119 kx # If there's no file by that name, mv it over:
119 kx if [ ! -r $OLD ]; then
119 kx mv $NEW $OLD
119 kx elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
119 kx rm $NEW
119 kx fi
119 kx # Otherwise, we leave the .new copy for the admin to consider...
119 kx }
119 kx
119 kx
119 kx # arg 1: the new package version
119 kx pre_install() {
119 kx /bin/true
119 kx }
119 kx
119 kx # arg 1: the new package version
119 kx post_install() {
119 kx if [ ! -e etc/xml/catalog ]; then
119 kx xmlcatalog --noout --create etc/xml/catalog
119 kx fi &&
119 kx xmlcatalog --noout --add "delegatePublic" \
119 kx "-//OASIS//ENTITIES DocBook XML" \
119 kx "file:///etc/xml/docbook" \
119 kx etc/xml/catalog &&
119 kx xmlcatalog --noout --add "delegatePublic" \
119 kx "-//OASIS//DTD DocBook XML" \
119 kx "file:///etc/xml/docbook" \
119 kx etc/xml/catalog &&
119 kx xmlcatalog --noout --add "delegateSystem" \
119 kx "http://www.oasis-open.org/docbook/" \
119 kx "file:///etc/xml/docbook" \
119 kx etc/xml/catalog &&
119 kx xmlcatalog --noout --add "delegateURI" \
119 kx "http://www.oasis-open.org/docbook/" \
119 kx "file:///etc/xml/docbook" \
119 kx etc/xml/catalog
119 kx }
119 kx
119 kx # arg 1: the new package version
119 kx # arg 2: the old package version
119 kx pre_update() {
119 kx /bin/true
119 kx }
119 kx
119 kx # arg 1: the new package version
119 kx # arg 2: the old package version
119 kx post_update() {
119 kx post_install
119 kx }
119 kx
119 kx # arg 1: the old package version
119 kx pre_remove() {
119 kx /bin/true
119 kx }
119 kx
119 kx # arg 1: the old package version
119 kx post_remove() {
121 kx if [ -e etc/xml/catalog ]; then
121 kx xmlcatalog --noout --del "file:///etc/xml/docbook" etc/xml/catalog
121 kx fi
119 kx }
119 kx
119 kx
119 kx operation=$1
119 kx shift
119 kx
119 kx $operation $*