Skip to content

Commit 15856e1

Browse files
committed
update spec file to handle reload of service
1 parent 1855bcb commit 15856e1

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

rpm/SPECS/crowdsec-custom-bouncer.spec

+18-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ rm -rf %{buildroot}
5050
%config(noreplace) /etc/crowdsec/bouncers/%{name}.yaml
5151

5252

53-
%post
53+
%post -p /bin/bash
5454
systemctl daemon-reload
5555

5656

@@ -89,6 +89,20 @@ echo "please enter the binary path in '/etc/crowdsec/bouncers/crowdsec-custom-bo
8989
* Wed Jun 30 2021 Shivam Sandbhor <[email protected]>
9090
- First initial packaging
9191

92-
%preun
93-
systemctl stop crowdsec-custom-bouncer || echo "cannot stop service"
94-
systemctl disable crowdsec-custom-bouncer || echo "cannot disable service"
92+
%preun -p /bin/bash
93+
94+
if [ "$1" == "0" ] ; then
95+
systemctl stop crowdsec-custom-bouncer || echo "cannot stop service"
96+
systemctl disable crowdsec-custom-bouncer || echo "cannot disable service"
97+
fi
98+
99+
100+
101+
%postun -p /bin/bash
102+
103+
if [ "$1" == "1" ] ; then
104+
systemctl restart crowdsec-custom-bouncer || echo "cannot restart service"
105+
elif [ "$1" == "0" ] ; then
106+
systemctl stop crowdsec-custom-bouncer
107+
systemctl disable crowdsec-custom-bouncer
108+
fi

0 commit comments

Comments
 (0)