]> git.pld-linux.org Git - packages/rpm-build-macros.git/commitdiff
1.685: add nrpe.d support to %nagios_nrpe macro auto/th/rpm-build-macros-1.685-1
authorElan Ruusamäe <glen@delfi.ee>
Tue, 28 Jan 2014 20:02:37 +0000 (20:02 +0000)
committerElan Ruusamäe <glen@delfi.ee>
Tue, 28 Jan 2014 20:03:43 +0000 (20:03 +0000)
rpm-build-macros.spec
rpm.macros

index 9b3636799d0e1e8ecb917f8461af4f482eb62a6a..930df97e6281ce12420180781b2f39b8712880f6 100644 (file)
@@ -5,7 +5,7 @@
 %if "%{pld_release}" == "ac"
 %define        with_rpm4       1
 %endif
-%define                rpm_macros_rev  1.684
+%define                rpm_macros_rev  1.685
 %define                find_lang_rev   1.36
 Summary:       PLD Linux RPM build macros
 Summary(pl.UTF-8):     Makra do budowania pakietów RPM dla Linuksa PLD
index 303c0c39690a07013adafdc13f29eb66cc11191d..82c3763e262b60b44a577a73b50d3f80d4e99676 100644 (file)
@@ -2170,20 +2170,25 @@ else: \
 # Requirements:
 # Requires:                    grep
 # Requires:                    sed >= 4.0
-# BuildRequires:       rpmbuild(macros) >= 1.552
+# BuildRequires:       rpmbuild(macros) >= 1.685
 %nagios_nrpe(a:d:c:f:) {\
-       m=$(md5sum < /etc/nagios/nrpe.cfg); \
+       if %{__grep} -q '^include_dir=/etc/nagios/nrpe.d' /etc/nagios/nrpe.cfg && [ -d /etc/nagios/nrpe.d ]; then \
+               file=/etc/nagios/nrpe.d/%{-a*}%{-d*}.cfg; \
+       else \
+               file=/etc/nagios/nrpe.cfg; \
+       fi; \
+       m=$(test -f $file && md5sum < $file); \
        %{-a:# on -a and config exists \
        if [ -f /etc/nagios/nrpe.cfg ]; then \
-               if ! %{__grep} -q '^command\[%{-a*}\]' /etc/nagios/nrpe.cfg; then \
-                               %{__sed} -ne 's/^[ \t]*command_line[ \t]\+\(.\+\)/command[%{-a*}]=\1/p' %{-f*} >> /etc/nagios/nrpe.cfg; \
+               if [ ! -f $file ] || ! %{__grep} -q '^command\[%{-a*}\]' $file; then \
+                       %{__sed} -ne 's/^[ \t]*command_line[ \t]\+\(.\+\)/command[%{-a*}]=\1/p' %{-f*} >> $file; \
                fi; \
        fi;} \
        %{-d:# on package remove, -d and config exists \
-       if [ "$1" = "0" -a -f /etc/nagios/nrpe.cfg ]; then \
-               %{__sed} -i -e '/^[ \t]*command\[%{-d*}\]/d' /etc/nagios/nrpe.cfg; \
+       if [ "$1" = "0" -a -f $file ]; then \
+               %{__sed} -i -e '/^[ \t]*command\[%{-d*}\]/d' $file; \
        fi;} \
-       if [ "$m" != "$(md5sum < /etc/nagios/nrpe.cfg)" ]; then \
+       if [ "$m" != "$(md5sum < $file)" ]; then \
                %service -q nrpe restart; \
        fi; \
 }%{nil}
This page took 0.053774 seconds and 4 git commands to generate.