PREUN
/bin/sh
systemctl disable check_mk_agent.socket
systemctl restart sockets.target
POSTIN
/bin/sh
if [ $1 == 1 ]; then
mkdir -p /etc/systemd/system/check_mk_agent.socket.d
if ! [ -f "/etc/systemd/system/check_mk_agent.socket.d/bind.conf" ]; then
cat > /etc/systemd/system/check_mk_agent.socket.d/bind.conf <<'EOF'
[Socket]
BindToDevice=lo
# remove this file to bind to all interfaces, but make sure you set up the firewall properly
EOF
fi
systemctl enable check_mk_agent.socket
systemctl restart sockets.target
fi
POSTUN
/bin/sh
if [ $1 == 0 ]; then
rm -f /etc/systemd/system/check_mk_agent.socket.d/bind.conf
rmdir /etc/systemd/system/check_mk_agent.socket.d 2>/dev/null
fi