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 # Keep same perms on rc.udev.new:
5 kx if [ -e etc/rc.d/rc.udev ]; then
5 kx cp -a etc/rc.d/rc.udev etc/rc.d/rc.udev.new.incoming
5 kx cat etc/rc.d/rc.udev.new > etc/rc.d/rc.udev.new.incoming
5 kx mv etc/rc.d/rc.udev.new.incoming etc/rc.d/rc.udev.new
5 kx fi
5 kx
5 kx # There's no reason for a user to edit rc.udev, so overwrite it:
5 kx if [ -r etc/rc.d/rc.udev.new ]; then
5 kx mv etc/rc.d/rc.udev.new etc/rc.d/rc.udev
5 kx fi
5 kx
5 kx # This should catch *all* files in /etc/modprobe.d/ and move them over to
5 kx # have .conf extensions
5 kx for modfile in `ls etc/modprobe.d/ | grep -v "\.\(conf\|bak\|orig\|new\)"`; do
5 kx if [ "$modfile" = README ]; then
5 kx true # do nothing
5 kx elif [ -e etc/modprobe.d/$modfile -a ! -e etc/modprobe.d/$modfile.conf ]; then
5 kx mv etc/modprobe.d/$modfile etc/modprobe.d/$modfile.conf
5 kx elif [ -e etc/modprobe.d/$modfile -a -e etc/modprobe.d/$modfile.conf ]; then
5 kx mv etc/modprobe.d/$modfile etc/modprobe.d/$modfile.bak
5 kx fi
5 kx done
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 $*