postinst is in zabbix-agent 1:2.2.2+dfsg-1ubuntu1.
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 | #!/bin/sh
set -e
# If /tmp/ZABBIX_PACKAGE_DEBUG file exists then enable debugging of this script.
#if [ -e /tmp/ZABBIX_PACKAGE_DEBUG ]; then
# set -x
#fi
CONFFILE="/usr/share/zabbix-agent/zabbix_agentd.conf"
CONFFILE_DEST="/etc/zabbix/zabbix_agentd.conf"
if [ "$1" = "configure" ]; then
if ! getent group zabbix > /dev/null 2>&1 ; then
addgroup --system --quiet zabbix
fi
# Does the user 'zabbix' exist?
if ! getent passwd zabbix > /dev/null 2>&1 ; then
# Not yet. Create it.
adduser --quiet \
--system --disabled-login --ingroup zabbix \
--home /var/run/zabbix/ --no-create-home \
zabbix
else
# Yes, user 'zabbix' exists.
# [This entire fix can be removed after the Wheezy release.]
# Change the home directory from /var/run/zabbix-server
# to /var/run/zabbix (relates to bug #593458).
# Check current home directory of the 'zabbix' user.
if getent passwd zabbix | cut -d: -f6 | grep -q /var/run/zabbix-server; then
# Home directory is still the old /var/run/zabbix-server directory.
# All processes run by the 'zabbix' user must be stopped
# before usermod can change the home directory.
# "zabbix-agent" gets stopped by zabbix-agent.preinst automatically.
echo Moving home directory of user zabbix to /var/run/zabbix/
for component in server proxy; do
if [ -x /etc/init.d/zabbix-$component ]; then
invoke-rc.d zabbix-$component stop
fi
done
# Remove an existing /var/run/zabbix directory just in case
rm -rf /var/run/zabbix
# Move the home directory
usermod -m -d /var/run/zabbix zabbix
# Create the home directory if it did not exist
# (up to 1.8.5-1 the 'zabbix' user had a non-existing home directory)
if [ ! -d /var/run/zabbix ]; then
mkdir /var/run/zabbix
chown zabbix:zabbix /var/run/zabbix
fi
# Change the location of the PID file in the config files
sed -i 's#/var/run/zabbix-.*/#/var/run/zabbix/#' /etc/zabbix/zabbix_*.conf
# Start the processes again
for component in server proxy; do
if [ -x /etc/init.d/zabbix-$component ]; then
invoke-rc.d zabbix-$component start
fi
done
fi
fi
# Use ucf to handle the zabbix_agentd.conf configuration file
ucf $CONFFILE $CONFFILE_DEST
ucfr zabbix-agent $CONFFILE_DEST
# Remove old/wrong home directory before 1.8.5-2
if [ -d /var/run/zabbix-agent ]; then
rm -rf /var/run/zabbix-agent
fi
# Remove old/confusing zabbix_agent.conf file
rm -f /etc/zabbix/zabbix_agent.conf
chown zabbix:zabbix /var/log/zabbix-agent -R
fi
# Automatically added by dh_installinit
if [ -x "/etc/init.d/zabbix-agent" ] || [ -e "/etc/init/zabbix-agent.conf" ]; then
if [ ! -e "/etc/init/zabbix-agent.conf" ]; then
update-rc.d zabbix-agent defaults >/dev/null
fi
invoke-rc.d zabbix-agent start || exit $?
fi
# End automatically added section
# Automatically added by dh_installinit
update-rc.d -f zabbix-agent remove >/dev/null || exit $?
# End automatically added section
# Automatically added by dh_ucf
if [ "$1" = "configure" ]; then
ucf "/usr/share/zabbix-agent/zabbix_agentd.conf" "/etc/zabbix/zabbix_agentd.conf"
ucfr zabbix-agent "/etc/zabbix/zabbix_agentd.conf"
fi
# End automatically added section
|