fix %post, %preun and %postun
Jason Barnett committed
Jul 28, 2016 at 19:30 UTC
e46b07d8ac3e3a595052eff9ac59e1dc1299452c
1 file changed
+15
-2
netdata.spec.in
+15
-2
@@ -115,14 +115,27 @@ exit 0
115
%post
116
# Register the netdata service
117
/sbin/chkconfig --add netdata
118
-# Start the netdata service
119
-/sbin/service netdata start
118
+# Only gets run on initial install (not upgrades or uninstalls)
119
+if [ $1 = 1 ]; then
120
+ # Start the netdata service
121
+ /sbin/service netdata start
122
+fi
123
+exit 0
124
125
%preun
126
+# Only gets run on uninstall (not upgrades)
127
if [ $1 = 0 ]; then
128
/sbin/service netdata stop > /dev/null 2>&1
129
/sbin/chkconfig --del netdata
130
fi
131
+exit 0
132
+
133
+%postun
134
+# Only gets run on upgrade (not uninstalls)
135
+if [ $1 != 0 ]; then
136
+ /sbin/service netdata condrestart 2>&1 > /dev/null
137
+fi
138
+exit 0
139
%endif
140
141
%clean