Working version with SUSE macros
[shibboleth/cpp-sp.git] / shibboleth.spec.in
index b6f89d8..82b309a 100644 (file)
@@ -8,7 +8,9 @@ License:        Apache 2.0
 URL:           http://shibboleth.internet2.edu/
 Source:     %{name}-sp-%{version}.tar.gz
 BuildRoot:     %{_tmppath}/%{name}-%{version}-root
+PreReq:     openssl
 %if 0%{?suse_version} > 1030
+PreReq:         %{insserv_prereq}
 BuildRequires:  libXerces-c-devel >= 2.8.0
 BuildRequires:  libxml-security-c-devel >= 1.4.0
 BuildRequires:  libxmltooling-devel >= 1.2
@@ -122,9 +124,12 @@ fi
 
 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "suse"
        # %{_initddir} not yet in RHEL5, use deprecated %{_initrddir}
-       mkdir -p $RPM_BUILD_ROOT%{_initrddir}
-       %{__cp} -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/shibd-%{_vendor} $RPM_BUILD_ROOT%{_initrddir}/shibd
-       %{__chmod} 755 $RPM_BUILD_ROOT%{_initrddir}/shibd
+       install -d -m 0755 $RPM_BUILD_ROOT%{_initrddir}
+       install -m 0755 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/shibd-%{_vendor} $RPM_BUILD_ROOT%{_initrddir}/shibd
+%if "%{_vendor}" == "suse"
+       install -d -m 0755 $RPM_BUILD_ROOT/%{_sbindir}
+       %{__ln_s} -f %{_initrddir}/shibd $RPM_BUILD_ROOT%{_sbindir}/rcshibd
+%endif
 %endif
 
 %check
@@ -153,13 +158,8 @@ sh ./keygen.sh -b
 %endif
 %if "%{_vendor}" == "suse"
     # This adds the proper /etc/rc*.d links for the script
-    /sbin/chkconfig --add shibd
-    cd /usr/sbin && ln -s /etc/init.d/shibd rcshibd
-    # On upgrade, restart components if they're already running.
-    if [ "$1" -gt "1" ] ; then
-        /etc/init.d/shibd status 1>/dev/null && /etc/init.d/shibd restart 1>/dev/null
-        %{!?_without_builtinapache:/etc/init.d/apache2 status 1>/dev/null && /etc/init.d/apache2 restart 1>/dev/null}
-    fi
+    cd /
+    %insserv_force_if_yast shibd
 %endif
 
 %preun
@@ -170,15 +170,18 @@ sh ./keygen.sh -b
        fi
 %endif
 %if "%{_vendor}" == "suse"
-    if [ "$1" = 0 ] ; then
-        /sbin/service shibd stop >/dev/null 2>&1
-        /sbin/chkconfig --del shibd
-        cd /usr/sbin && %{__rm} -f rcshibd
-    fi
+    %stop_on_removal shibd
 %endif
 
+%postun
 %ifnos solaris2.8 solaris2.9 solaris2.10
-%postun -p /sbin/ldconfig
+/sbin/ldconfig
+%endif
+%if "%{_vendor}" == "suse"
+cd /
+%restart_on_update shibd
+%{!?_without_builtinapache:%restart_on_update apache2}
+%{insserv_cleanup}
 %endif
 
 %posttrans
@@ -212,7 +215,10 @@ sh ./keygen.sh -b
 %config(noreplace) %{_sysconfdir}/%{name}/*.html
 %config(noreplace) %{_sysconfdir}/%{name}/*.logger
 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "suse"
-%attr(755, root, root) %{_initrddir}/shibd
+%config %{_initrddir}/shibd
+%endif
+%if "%{_vendor}" == "suse"
+%{_sbindir}/rcshibd
 %endif
 %{_sysconfdir}/%{name}/*.dist
 %{_sysconfdir}/%{name}/apache*.config