postinst is in distcc 3.1-6.
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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | #!/bin/sh
# postinst script for distcc
set -e
conffile="/etc/default/distcc"
DISTCC_USER=distccd
DISTCC_LOGFILE=/var/log/distccd.log
update_config_file()
{
db_field=$1
config_field=$2
RET=false
db_get $db_field
if grep -q "^[ ]*$config_field" $conffile ; then
# keep any admin changes, while replacing the variable content
sed "s#^[ ]*$config_field=\".*\"#$config_field=\"$RET\"#" < $conffile > $conffile.new &&
mv $conffile.new $conffile
else
echo "$config_field=\"$RET\"" >> $conffile
fi
}
update_symlinks()
{
echo "Updating symlinks in /usr/lib/distcc ..." >&2
update-distcc-symlinks
}
. /usr/share/debconf/confmodule
db_version 2.0
case "$1" in
configure)
if [ ! -f $conffile ] ; then
cat << EOF > $conffile
# Defaults for distcc initscript
# sourced by /etc/init.d/distcc
#
# should distcc be started on boot?
#
# STARTDISTCC="true"
STARTDISTCC="false"
#
# Which networks/hosts should be allowed to connect to the daemon?
# You can list multiple hosts/networks separated by spaces.
# Networks have to be in CIDR notation, f.e. 192.168.1.0/24
# Hosts are represented by a single IP Adress
#
# ALLOWEDNETS="127.0.0.1"
ALLOWEDNETS="127.0.0.1"
#
# Which interface should distccd listen on?
# You can specify a single interface, identified by it's IP address, here.
#
# LISTENER="127.0.0.1"
LISTENER="127.0.0.1"
#
# You can specify a (positive) nice level for the distcc process here
#
# NICE="10"
NICE="10"
#
# You can specify a maximum number of jobs, the server will accept concurrently
#
# JOBS=""
JOBS=""
#
# Enable Zeroconf support?
# If enabled, distccd will register via mDNS/DNS-SD.
# It can then automatically be found by zeroconf enabled distcc clients
# without the need of a manually configured host list.
#
# ZEROCONF="true"
ZEROCONF="true"
EOF
fi
update_config_file distcc/daemon STARTDISTCC
update_config_file distcc/daemon-allow ALLOWEDNETS
update_config_file distcc/daemon-listen LISTENER
update_config_file distcc/daemon-nice NICE
update_config_file distcc/daemon-jobs JOBS
update_config_file distcc/daemon-zeroconf ZEROCONF
# create distcc user
adduser --quiet --system \
--home / --no-create-home $DISTCC_USER
if [ ! -s $DISTCC_LOGFILE ]; then
touch $DISTCC_LOGFILE
chown ${DISTCC_USER}:adm $DISTCC_LOGFILE
chmod 640 $DISTCC_LOGFILE
fi
db_stop
update_symlinks
;;
triggered)
update_symlinks
exit 0
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# Automatically added by dh_installinit
if [ -x "/etc/init.d/distcc" ]; then
if [ ! -e "/etc/init/distcc.conf" ]; then
update-rc.d distcc defaults >/dev/null
fi
invoke-rc.d distcc start || exit $?
fi
# End automatically added section
exit 0
|