postinst is in hddtemp 0.3-beta15-53.
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 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | #!/bin/sh
# postinst script for hddtemp
set -e
conffile="/etc/default/hddtemp"
update_config_file()
{
db_field=$1
config_field=$2
RET=false
db_get $db_field
if [ -n "$RET" ] ; then
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
fi
}
# Source debconf library -- we have a Depends line
# to make sure it is there...
. /usr/share/debconf/confmodule
db_version 2.0
case "$1" in
configure)
if [ -f $conffile ] ; then
sed -i -e 's/^[ ]*DAEMON/RUN_DAEMON/g' \
-e 's/^[ ]*SYSLOG/RUN_SYSLOG/g' \
-e 's/^# Master system-wide hddtemp switch.*/# hddtemp network daemon switch. If set to true, hddtemp will listen/' \
-e 's/^# set to true. STOP THE SERVICE.*/# for incoming connections./' \
-e 's/^# Logging period.*temperatures.$/# Logging period (in seconds) for the temperatures. If set to a value\n# different than 0, hddtemp will run as a daemon periodically logging\n# the temperatures through syslog/' \
$conffile
if ! grep -q RUN_SYSLOG $conffile ; then
cat << EOF >> $conffile
# Logging period (in seconds) for the temperatures. If set to a value
# different than 0, hddtemp will run as a daemon periodically logging
# the temperatures through syslog
RUN_SYSLOG="0"
EOF
fi
if ! grep -q OPTIONS $conffile ; then
cat << EOF >> $conffile
# Other options to pass to hddtemp
OPTIONS=""
EOF
fi
if ! grep -q DISKS_NOPROBE $conffile ; then
cat << EOF >> $conffile
# List of devices you want to use with hddtemp, but that would not be
# probed for a working sensor.
DISKS_NOPROBE=""
EOF
fi
else
cat << EOF > $conffile
# Defaults for hddtemp initscript (/etc/init.d/hddtemp)
# This is a POSIX shell fragment
# [automatically edited by postinst, do not change line format ]
# hddtemp network daemon switch. If set to true, hddtemp will listen
# for incoming connections.
RUN_DAEMON="true"
# List of devices you want to use with hddtemp. If none specified,
# hddtemp will probe standard devices.
#DISKS="/dev/hda"
# List of devices you want to use with hddtemp, but that would not be
# probed for a working sensor.
DISKS_NOPROBE=""
# IP address of the interface on which you want hddtemp to be bound
# on. If none specified, goes to 127.0.0.1. Use 0.0.0.0 to bind hddtemp
# on all interfaces.
INTERFACE="127.0.0.1"
# Port number on which you want hddtemp to listen on. If none specified,
# the port 7634 is used.
PORT="7634"
# Database file to use. If none specified, /etc/hddtemp.db is used.
#DATABASE="/etc/hddtemp.db"
# Separator to use between fields. The default separator is '|'.
#SEPARATOR="|"
# Logging period (in seconds) for the temperatures. If set to a value
# different than 0, hddtemp will run as a daemon periodically logging
# the temperatures through syslog
RUN_SYSLOG="0"
# Other options to pass to hddtemp
OPTIONS=""
EOF
fi
update_config_file hddtemp/daemon RUN_DAEMON
update_config_file hddtemp/syslog RUN_SYSLOG
update_config_file hddtemp/interface INTERFACE
update_config_file hddtemp/port PORT
if ! dpkg-statoverride --list /usr/sbin/hddtemp 1>/dev/null 2>&1; then
# check if we are installing suid or not
RET=false
db_get hddtemp/SUID_bit
if [ "$RET" = "true" ]; then
chmod 4755 /usr/sbin/hddtemp
ln -sf /usr/sbin/hddtemp /usr/bin/hddtemp
ln -sf ../man8/hddtemp.8.gz /usr/share/man/man1/hddtemp.1.gz
else
chmod 0755 /usr/sbin/hddtemp
rm -f /usr/bin/hddtemp
rm -f /usr/share/man/man8/hddtemp.1.gz
fi
fi
db_stop
rm -f /etc/logcheck/ignore.d.workstation/hddtemp
;;
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.
# Automatically added by dh_installinit/11.1.2ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
if [ -x "/etc/init.d/hddtemp" ]; then
update-rc.d hddtemp defaults >/dev/null
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
invoke-rc.d hddtemp $_dh_action || exit 1
fi
fi
# End automatically added section
exit 0
|