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
5 kx # 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.serial.new:
5 kx if [ -e etc/rc.d/rc.serial ]; then
5 kx cp -a etc/rc.d/rc.serial etc/rc.d/rc.serial.new.incoming
5 kx cat etc/rc.d/rc.serial.new > etc/rc.d/rc.serial.new.incoming
5 kx mv etc/rc.d/rc.serial.new.incoming etc/rc.d/rc.serial.new
5 kx fi
5 kx
5 kx install_file etc/rc.d/rc.serial.new
5 kx install_file etc/rc.d/rc.setterm.new
5 kx install_file etc/serial.conf.new
5 kx
5 kx for cfgfile in chfn.new chsh.new login.new runuser.new runuser-l.new su.new su-l.new ; do
5 kx if [ -r etc/pam.d/$cfgfile ]; then
5 kx install_file etc/pam.d/$cfgfile
5 kx fi
5 kx done
5 kx
5 kx if [ -r etc/default/su.new ]; then
5 kx install_file etc/default/su.new
5 kx fi
5 kx
5 kx
5 kx # We use an relative path to 'proc/sys/kernel/osrelease' because we have to be sure
5 kx # that we are running on the target platform. Only in this case we will use
5 kx # absolute path to coreutils ('/bin/chgrp' and '/bin/chmod') and we have to check
5 kx # is the coreutils already installed.
5 kx if [ -r proc/sys/kernel/osrelease -a -x /bin/chgrp -a -x /bin/chmod ]; then
5 kx /bin/chgrp tty /usr/bin/wall
5 kx /bin/chmod g+s /usr/bin/wall
5 kx /bin/chgrp tty /usr/bin/write
5 kx /bin/chmod g+s /usr/bin/write
5 kx fi
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 $*