241 kx #!/bin/sh
241 kx
241 kx # Preserve new files
241 kx install_file() {
241 kx NEW="$1"
241 kx OLD="`dirname $NEW`/`basename $NEW .new`"
241 kx # If there's no file by that name, mv it over:
241 kx if [ ! -r $OLD ]; then
241 kx mv $NEW $OLD
241 kx elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
241 kx rm $NEW
241 kx fi
241 kx # Otherwise, we leave the .new copy for the admin to consider...
241 kx }
241 kx
241 kx
241 kx # arg 1: the new package version
241 kx pre_install() {
241 kx /bin/true
241 kx }
241 kx
241 kx # arg 1: the new package version
241 kx post_install() {
241 kx #
241 kx # NOTE:
241 kx # 'install-info' can work using relative paths and we can make use build machine
241 kx # utility during installation to the some partition and use target 'install-info'
241 kx # during installation directly on the running target machine.
241 kx #
241 kx if [ -x /usr/bin/install-info ] ; then
241 kx install-info --info-dir=usr/share/info usr/share/info/libgtop2.info.gz 2>/dev/null
241 kx elif ! grep "(libgtop2)" usr/share/info/dir 1> /dev/null 2> /dev/null ; then
241 kx cat << EOF >> usr/share/info/dir
241 kx
241 kx Libraries:
241 kx * LibGTop2: (libgtop2). Library to get system specific data such as
241 kx cpu and memory usage, active processes
241 kx EOF
241 kx fi
241 kx }
241 kx
241 kx # arg 1: the new package version
241 kx # arg 2: the old package version
241 kx pre_update() {
241 kx /bin/true
241 kx }
241 kx
241 kx # arg 1: the new package version
241 kx # arg 2: the old package version
241 kx post_update() {
241 kx post_install
241 kx }
241 kx
241 kx # arg 1: the old package version
241 kx pre_remove() {
241 kx if [ -x /usr/bin/install-info ] ; then
241 kx install-info --delete --info-file=usr/share/info/libgtop2.info.gz --dir-file=usr/share/info/dir 2> /dev/null || /bin/true
241 kx fi
241 kx }
241 kx
241 kx # arg 1: the old package version
241 kx post_remove() {
241 kx /bin/true
241 kx }
241 kx
241 kx
241 kx operation=$1
241 kx shift
241 kx
241 kx $operation $*