Convert chkconfig calls to SuSE macros.
authorScott Cantor <cantor.2@osu.edu>
Tue, 18 Aug 2009 15:13:06 +0000 (15:13 +0000)
committerScott Cantor <cantor.2@osu.edu>
Tue, 18 Aug 2009 15:13:06 +0000 (15:13 +0000)
shibboleth.spec.in

index b6f89d8..c18ff11 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_prere
 BuildRequires:  libXerces-c-devel >= 2.8.0
 BuildRequires:  libxml-security-c-devel >= 1.4.0
 BuildRequires:  libxmltooling-devel >= 1.2
@@ -123,8 +125,11 @@ 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%{_sysconfdir}/%{name}/shibd-%{_vendor} $RPM_BUILD_ROOT%{_initrddir}/shibd
+%if "%{_vendor}" == "suse"
+       install -d -m 0755 $RPM_BUILD_ROOT/%{_sbindir}
+       %{__ln} -sf $RPM_BUILD_ROOT%{_initrddir}/shibd $RPM_BUILD_ROOT/%{_sbindir}/rcshibd
+%endif
 %endif
 
 %check
@@ -153,13 +158,7 @@ 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
+    %insserv_force_if_yast shibd
 %endif
 
 %preun
@@ -170,15 +169,16 @@ 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"
+%restart_on_update shibd apache2
+%insserv_cleanup
 %endif
 
 %posttrans
@@ -212,7 +212,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