5 kx #!/bin/sh
5 kx
5 kx # Preserve new files
5 kx install_file() {
5 kx NEW="$1"
5 kx OLD="`dirname $NEW`/`basename $NEW .new`"
5 kx # If there's no file by that name, mv it over:
5 kx if [ ! -r $OLD ]; then
5 kx mv $NEW $OLD
5 kx elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
5 kx rm $NEW
5 kx fi
5 kx # Otherwise, we leave the .new copy for the admin to consider...
5 kx }
5 kx
5 kx
5 kx # arg 1: the new package version
5 kx pre_install() {
5 kx /bin/true
5 kx }
5 kx
5 kx # arg 1: the new package version
5 kx post_install() {
5 kx # Leave any new rc files with the same permissions as the old ones:
5 kx if [ -e etc/rc.d/rc.cgconfig ]; then
5 kx if [ -x etc/rc.d/rc.cgconfig ]; then
5 kx chmod 755 etc/rc.d/rc.cgconfig.new
5 kx else
5 kx chmod 644 etc/rc.d/rc.cgconfig.new
5 kx fi
5 kx fi
5 kx if [ -e etc/rc.d/rc.cgred ]; then
5 kx if [ -x etc/rc.d/rc.cgred ]; then
5 kx chmod 755 etc/rc.d/rc.cgred.new
5 kx else
5 kx chmod 644 etc/rc.d/rc.cgred.new
5 kx fi
5 kx fi
5 kx
5 kx # Then install_file() them:
5 kx install_file etc/rc.d/rc.cgconfig.new
5 kx install_file etc/rc.d/rc.cgred.new
5 kx
5 kx # install_file() the other configuration files:
5 kx install_file etc/cgconfig.conf.new
5 kx install_file etc/cgred.conf.new
5 kx install_file etc/cgrules.conf.new
5 kx install_file etc/cgsnapshot_blacklist.conf.new
5 kx
5 kx # If there are already installed config files, get rid of the .new ones.
5 kx # There will still be fresh samples in the docs.
5 kx rm -f etc/cgconfig.conf.new etc/cgred.conf.new etc/cgrules.conf.new etc/cgsnapshot_blacklist.conf.new
5 kx }
5 kx
5 kx # arg 1: the new package version
5 kx # arg 2: the old package version
5 kx pre_update() {
5 kx /bin/true
5 kx }
5 kx
5 kx # arg 1: the new package version
5 kx # arg 2: the old package version
5 kx post_update() {
5 kx post_install
5 kx }
5 kx
5 kx # arg 1: the old package version
5 kx pre_remove() {
5 kx /bin/true
5 kx }
5 kx
5 kx # arg 1: the old package version
5 kx post_remove() {
5 kx /bin/true
5 kx }
5 kx
5 kx
5 kx operation=$1
5 kx shift
5 kx
5 kx $operation $*