Sophie

Sophie

distrib > PLD > ac > amd64 > by-pkgid > 3f5e8ec9dece2280e7acf309d9094643 > scriptlet

smokeping-2.0.9-1.noarch.rpm

PREUN

/bin/sh
if [ "$1" = 0 ]; then
	{
if [ -f /var/lock/subsys/smokeping ]; then
/sbin/service smokeping stop 1>&2 || :;
fi };	/sbin/chkconfig --del smokeping
fi

POSTIN

/bin/sh
if [ "$1" = "1" ]; then

firstgate=`route -n |awk '$1=="0.0.0.0" && $4 ~ /G/ {print $2}' | head -n 1`
echo "
+ gateway
 menu   = Default Gateway
 title  = Default Gateway Router
 host   = $firstgate

+ dns
 menu   = DNS Servers
 title  = Domain Name Servers
        " >> /etc/smokeping/config
for dns in `awk '$1 ~ /^nameserver/ {print $2}' /etc/resolv.conf | LC_ALL=C sort -u` ; do
((dnscnt++))
echo "++ dns$dnscnt
  menu  = DNS Server $dnscnt
  title = Domain Name Server $dnscnt
  host  = $dns
        " >> /etc/smokeping/config
done

[ "$HOSTNAME" ] && /bin/sed -i -e "s|localhost|$HOSTNAME|g" /etc/smokeping/config

fi

/sbin/chkconfig --add smokeping
{
skip_auto_restart() {
[ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
[ -f /etc/sysconfig/smokeping ] && . /etc/sysconfig/smokeping
echo ${RPM_SKIP_AUTO_RESTART:-no}
};
if [ $(skip_auto_restart) = no ]; then
if [ -f /var/lock/subsys/smokeping ]; then
/sbin/service smokeping restart 1>&2 || :;
else
echo 'Run "/sbin/service smokeping start" to start smokeping service.'
fi
fi };

Triggers

lighttpd

/bin/sh
 
if [ "$1" = "1" ] && [ "$2" = "1" ]; then
	/usr/sbin/webapp register lighttpd smokeping
fi
# reload webserver if the config symlink is there and skip reload if webserver is upgraded
if [ -L /etc/lighttpd/webapps.d/smokeping.conf ] && [ "$2" -lt "2" ]; then
	{
skip_auto_restart() {
[ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
[ -f /etc/sysconfig/lighttpd ] && . /etc/sysconfig/lighttpd
echo ${RPM_SKIP_AUTO_RESTART:-no}
};
if [ $(skip_auto_restart) = no ]; then
if [ -f /var/lock/subsys/lighttpd ]; then
/sbin/service lighttpd reload 1>&2 || :;
fi
fi };
fi

lighttpd

/bin/sh
 
# remove link if either of the packages are gone 
if [ -n "" ] || [ "$1" = "0" ] || [ "$2" = "0" ] && [ -L /etc/lighttpd/webapps.d/smokeping.conf ]; then 
	/usr/sbin/webapp unregister lighttpd smokeping
	{
skip_auto_restart() {
[ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
[ -f /etc/sysconfig/lighttpd ] && . /etc/sysconfig/lighttpd
echo ${RPM_SKIP_AUTO_RESTART:-no}
};
if [ $(skip_auto_restart) = no ]; then
if [ -f /var/lock/subsys/lighttpd ]; then
/sbin/service lighttpd reload 1>&2 || :;
fi
fi };
fi

smokeping < 2.0.5-0.3

/bin/sh
# we put trigger on main package, because we can't trigger in new package
# this will create .rpmnew files when one installs -cgi package. but that's more than okay
if [ -f /etc/httpd/httpd.conf/99_smokeping.conf.rpmsave ]; then
	install -d /etc/webapps/smokeping
	mv -f /etc/httpd/httpd.conf/99_smokeping.conf.rpmsave /etc/webapps/smokeping/httpd.conf
fi

{
skip_auto_restart() {
[ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
[ -f /etc/sysconfig/httpd ] && . /etc/sysconfig/httpd
echo ${RPM_SKIP_AUTO_RESTART:-no}
};
if [ $(skip_auto_restart) = no ]; then
if [ -f /var/lock/subsys/httpd ]; then
/sbin/service httpd reload 1>&2 || :;
fi
fi };

RPM_SCRIPTVERBOSITY=5 
[ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm 
if [ -x /usr/bin/banner.sh ]; then 
	CMD="/usr/bin/banner.sh --stderr $([ $RPM_SCRIPTVERBOSITY -ge 5 ] && echo -s) -m smokeping" 
else 
	CMD="cat >&2" 
fi 
eval $CMD << EOF 
The CGI program is available as smokeping-cgi package.
EOF