Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > 2a51ba2c76b9a8a97d677ee6474779a7 > scriptlet

mod_antihak-0.3.1c-9mdk.ppc.rpm

PREIN

/bin/sh
#Check config file sanity
if [ -e /usr/sbin/ap13chkconfig ]; then /usr/sbin/ap13chkconfig;fi

POSTIN

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

if [ `fgrep "apache ALL= NOPASSWD: /sbin/iptables" /etc/sudoers | wc -l` = 0 ]
then
	echo "apache ALL= NOPASSWD: /sbin/iptables" >> /etc/sudoers
fi

#We're in Install mode, add module to the config files
for config in /etc/httpd/conf/{httpd,httpd-perl}.conf; do
	if [ -x /usr/sbin/advxaddmod -a -e $config ]; then
		/usr/sbin/advxaddmod $config \
		extramodules/mod_antihak.so mod_antihak.c antihak_module
	fi
done
if [ -e /usr/sbin/ADVXctl ]; then /usr/sbin/ADVXctl update;fi
fi

if [ $1 -gt 1 ]; then 
#We're in *upgrade mode*. Since we can't be sure the configuration files
#are sane, remove module from the conf files to clean them, re-add again 
#in a way that the older module we're replacing won't try to erase (the 
#post scripts were broken on some packages), and finally clean the module
#specific config file so it's compatible with the upgrade.
for config in /etc/httpd/conf/{httpd,httpd-perl}.conf; do
	if [ -x /usr/sbin/advxdelmod -a -e $config ]; then
		/usr/sbin/advxdelmod $config \
		extramodules/mod_antihak.so mod_antihak.c antihak_module \
		$config
	fi
	if [ -x /usr/sbin/advxaddmod -a -e $config ]; then
		/usr/sbin/advxaddmod $config \
		extramodules/mod_antihak.so mod_antihak.c antihak_module
	fi
done
if [ -e /usr/sbin/ADVXctl ]; then /usr/sbin/ADVXctl update;fi
fi

POSTUN

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

if [ `fgrep "apache ALL= NOPASSWD: /sbin/iptables" /etc/sudoers | wc -l` != 0 ]
then
        alias FIXME="perl -pi -e"
	FIXME 's|apache ALL= NOPASSWD: /sbin/iptables\n||' /etc/sudoers
fi


for config in /etc/httpd/conf/{httpd,httpd-perl}.conf; do
	if [ -x /usr/sbin/advxdelmod -a -e $config ]; then
		/usr/sbin/advxdelmod $config \
		extramodules/mod_antihak.so mod_antihak.c antihak_module
	fi
done
if [ -e /usr/sbin/ADVXctl ]; then /usr/sbin/ADVXctl update;fi
fi