PREIN
/bin/sh
if [ $1 = 1 ]; then
getent group ntop >/dev/null || groupadd -r ntop
getent passwd ntop >/dev/null || \
useradd -r -g ntop -d /var/lib/ntop -s /sbin/nologin \
-c "ntop" ntop
fi
PREUN
/bin/sh
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
/bin/systemctl --no-reload disable ntop.service > /dev/null 2>&1 || :
/bin/systemctl stop ntop.service > /dev/null 2>&1 || :
fi
POSTIN
/bin/sh
if [ $1 -eq 1 ] ; then
# Initial installation
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
/sbin/ldconfig
# create new self-signed certificate
if [ ! -f /etc/ntop/ntop-cert.pem ] ; then
#get hosname
FQDN=`hostname`
if [ "x${FQDN}" = "x" ]; then
FQDN=localhost.localdomain
fi
#create key and certificate in one file
cat << EOF | /usr/bin/openssl req -new -newkey rsa:1024 -days 365 -nodes -x509 -keyout /etc/ntop/ntop-cert.pem -out /etc/ntop/ntop-cert.pem 2>/dev/null
--
SomeState
SomeCity
SomeOrganization
SomeOrganizationalUnit
${FQDN}
root@${FQDN}
EOF
fi
POSTUN
/bin/sh
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/bin/systemctl try-restart ntop.service >/dev/null 2>&1 || :
fi
/sbin/ldconfig
Triggers
ntop <
3.4-0.8.pre3
/bin/sh
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply ntop
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save ntop >/dev/null 2>&1 ||:
# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del ntop >/dev/null 2>&1 || :
/bin/systemctl try-restart ntop.service >/dev/null 2>&1 || :