postinst is in cpu 1.4.3-11.2ubuntu2.
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 | #! /bin/sh
# postinst script for cpu
#
# see: dh_installdeb(1)
test $DEBIAN_SCRIPT_DEBUG && set -v -x
set -e
# Source debconf library.
CONFIG=/etc/cpu/cpu.conf
#CONFIG=/home/paul/cpu.conf
update_var() {
_field="$1" _value="$2"
_record=`printf "%-23s = %s" "$_field" "$_value"`
sed "s|^$_field.*|$_record|" $CONFIG > $CONFIG.tmp && \
mv $CONFIG.tmp $CONFIG
}
escape() {
# escape sed meta chars and pattern delimiter (|)
echo "$*" | sed 's|[\|\$\&\.\*\%\^\+\?]|\\&|g'
}
case "$1" in
configure)
. /usr/share/debconf/confmodule
db_get cpu/do_debconf || true; DO_DEBCONF=$RET
if [ "$DO_DEBCONF" = "true" ]; then
db_get cpu/ldap/LDAP_URI || true; LDAP_URI=`escape "$RET"`
db_get cpu/ldap/BIND_DN || true; BIND_DN=`escape "$RET"`
db_get cpu/ldap/BIND_PASS || true; BIND_PASS=`escape "$RET"`
db_get cpu/ldap/USER_BASE || true; USER_BASE=`escape "$RET"`
db_get cpu/ldap/GROUP_BASE || true; GROUP_BASE=`escape "$RET"`
fi
# Set the umask to 026 so ucf will create the file with the right mode,
# but won't override eventual changes by the sysadm
umask 026
# this due to debconf not releasing stdin (refer to #193694)
ucf --debconf-ok /usr/share/doc/cpu/examples/cpu.conf $CONFIG
if [ "$DO_DEBCONF" = "true" ]; then
update_var LDAP_URI "$LDAP_URI"
update_var BIND_DN "$BIND_DN"
update_var BIND_PASS "$BIND_PASS"
update_var USER_BASE "$USER_BASE"
update_var GROUP_BASE "$GROUP_BASE"
if [ -e /var/cache/cracklib/cracklib_dict.pwd ]; then
sed "s/^#CRACKLIB_DICTIONARY/CRACKLIB_DICTIONARY/" $CONFIG > \
$CONFIG.tmp && mv $CONFIG.tmp $CONFIG
else
sed "s/^CRACKLIB_DICTIONARY/#CRACKLIB_DICTIONARY/" $CONFIG > \
$CONFIG.tmp && mv $CONFIG.tmp $CONFIG
fi
fi
db_stop
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
exit 0
|