postinst is in sysstat 10.2.0-1.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | #! /bin/sh
# vim:ts=4:et
# $Id: sysstat.postinst 1524 2011-06-15 05:30:00Z robert $
set -e
S_VERSION="9.1.6-1"
PACKAGE="sysstat"
DEFAULT="/etc/default/$PACKAGE"
ENABLED="false"
### manage_default_file: manages $DEFAULT file with ucf ###
manage_default_file() {
ENABLED="$1"
if [ "$ENABLED" != "true" ] && [ "$ENABLED" != "false" ] ; then
echo "Internal error in the sysstat's postinst: \$ENABLED=$ENABLED" 1>&2;
exit 1;
fi
# Generate temporary files
def_file=`tempfile -p sstat -s .def`
md5_file=`tempfile -p sstat -s .md5`
# Fill new temporary default file
cat > "$def_file" << EOF
#
# Default settings for /etc/init.d/sysstat, /etc/cron.d/sysstat
# and /etc/cron.daily/sysstat files
#
# Should sadc collect system activity informations? Valid values
# are "true" and "false". Please do not put other values, they
# will be overwritten by debconf!
ENABLED="$ENABLED"
EOF
# Fill historical md5sums file
cat > "$md5_file" << EOF
a02e85973f7fdb600c97bb8c2d95b99c v5.0.3-1-false
17858d506362e304f3f079adaeb6db8c v5.0.3-1-true
6f9a02d4f43d60e5c6b276708851f614 v5.1.1-2-false
2898e78bd579e4635ff28f7d77e82968 v5.1.1-2-true
1f9894df4e750f0b77db3813d1aab7f6 v5.1.3-1-false
efebd191fca58d10975faf2389aaffc0 v5.1.3-1-true
efebd191fca58d10975faf2389aaffc0 default
EOF
# Finally, run ucf
ucf --three-way \
--debconf-ok \
--sum-file "$md5_file" \
"$def_file" "$DEFAULT"
ucfr "$PACKAGE" "$DEFAULT"
[ -e "$DEFAULT" ] && chmod 644 "$DEFAULT"
rm -f "$def_file" "$md5_file"
}
### Main ###
. /usr/share/debconf/confmodule
if [ "$1" = "configure" ] ; then
if dpkg --compare-versions "$2" lt-nl "9.0.6-2~"; then
# removing old stop links
rm -f /etc/rc0.d/K20sysstat /etc/rc6.d/K20sysstat /etc/rc1.d/K01sysstat
fi
if dpkg --compare-versions "$2" lt-nl "$S_VERSION"; then
RET=""
db_get sysstat/remove_files || true
if [ "$RET" = "true" ]; then
echo "Removing old statistics from /var/log/sysstat." 1>&2
find /var/log/sysstat -maxdepth 2 \( -name 'sa[0-9][0-9]' -o -name 'sa[0-9][0-9].gz' \
-o -name 'sa[0-9][0-9].bz2' \) -exec rm -f {} \;
fi
fi
# show the question next time
db_reset sysstat/remove_files || true
db_get sysstat/enable || true
ENABLED="$RET"
manage_default_file "$ENABLED"
# must be called *after* manage_default_file, which uses ucf --debconf-ok
db_stop || true
if ! update-alternatives --display sar 2>/dev/null | grep -q '^/usr/bin/sar\.sysstat'; then
update-alternatives --install /usr/bin/sar sar /usr/bin/sar.sysstat 0 \
--slave /usr/share/man/man1/sar.1.gz sar.1.gz \
/usr/share/man/man1/sar.sysstat.1.gz
fi
# execute sa1 in a subshell not to clobber the postinst script with potentially
# unsafe values from "$DEFAULT"
if [ "$ENABLED" = "true" ] && [ -x /usr/lib/sysstat/sa1 ] ; then
( set +e ; /usr/lib/sysstat/sa1 1 1 )&
fi
fi
# Automatically added by dh_installinit
if [ -x "/etc/init.d/sysstat" ]; then
if [ ! -e "/etc/init/sysstat.conf" ]; then
update-rc.d sysstat start 20 2 3 4 5 . >/dev/null
fi
fi
# End automatically added section
exit 0
|