Summary: Package that uses Apache configuration Name: template-apache-package Version: 0.1 Release: 0.7 License: Public Domain Group: Applications/WWW BuildArch: noarch BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) %define _apache1dir /etc/apache %define _apache2dir /etc/httpd %description This spec is for demonstrating triggers used for linking package config to apache1/apache2 configuration dir. %prep %install rm -rf $RPM_BUILD_ROOT install -d $RPM_BUILD_ROOT%{_sysconfdir} cat >> $RPM_BUILD_ROOT%{_sysconfdir}/apache-%{name}.conf <= 1.3.33-2 %{?debug:set -x; echo "triggerin apache1 %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} if [ -d %{_apache1dir}/conf.d ]; then ln -sf %{_sysconfdir}/apache-%{name}.conf %{_apache1dir}/conf.d/99_%{name}.conf if [ -f /var/lock/subsys/apache ]; then /etc/rc.d/init.d/apache restart 1>&2 fi fi %triggerun -- apache1 >= 1.3.33-2 %{?debug:set -x; echo "triggerun apache1 %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} # remove link if eighter of the packages are gone if [ "$1" = "0" ] || [ "$2" = "0" ]; then if [ -d %{_apache1dir}/conf.d ]; then rm -f %{_apache1dir}/conf.d/99_%{name}.conf if [ -f /var/lock/subsys/apache ]; then /etc/rc.d/init.d/apache restart 1>&2 fi fi fi %triggerin -- apache >= 2.0.0 %{?debug:set -x; echo "triggerin apache2 %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} if [ -d %{_apache2dir}/httpd.conf ]; then ln -sf %{_sysconfdir}/apache-%{name}.conf %{_apache2dir}/httpd.conf/99_%{name}.conf if [ -f /var/lock/subsys/httpd ]; then /etc/rc.d/init.d/httpd restart 1>&2 fi fi %triggerun -- apache >= 2.0.0 %{?debug:set -x; echo "triggerun apache2 %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} # remove link if eighter of the packages are gone if [ "$1" = "0" ] || [ "$2" = "0" ]; then if [ -d %{_apache2dir}/httpd.conf ]; then rm -f %{_apache2dir}/httpd.conf/99_%{name}.conf if [ -f /var/lock/subsys/httpd ]; then /etc/rc.d/init.d/httpd restart 1>&2 fi fi fi