Accepting request 583872 from home:jfajerski:branches:server:monitoring
OBS-URL: https://build.opensuse.org/request/show/583872 OBS-URL: https://build.opensuse.org/package/show/server:monitoring/grafana?expand=0&rev=2
This commit is contained in:
parent
f504c80fe4
commit
24e65ec0cb
21
grafana.spec
21
grafana.spec
@ -18,6 +18,7 @@
|
||||
|
||||
%define GRAFANA_USER %{name}
|
||||
%define GRAFANA_GROUP %{name}
|
||||
%define GRAFANA_HOME %{_datadir}/%{name}
|
||||
|
||||
Name: grafana
|
||||
Version: 5.0.0
|
||||
@ -108,17 +109,10 @@ ln -s %{_bindir}/phantomjs %{buildroot}%{_datadir}/%{name}/tools/phantomjs/phant
|
||||
%pre
|
||||
%service_add_pre %{name}-server.service
|
||||
|
||||
if [ $1 -eq 1 ]; then
|
||||
if ! %{_bindir}/id %{GRAFANA_USER} &>/dev/null; then
|
||||
echo -n "Create a new group %{GRAFANA_GROUP}:"
|
||||
%{_sbindir}/groupadd -r %{GRAFANA_GROUP} ||:
|
||||
echo "... done"
|
||||
echo -n "Create a new user %{GRAFANA_USER}:"
|
||||
%{_sbindir}/useradd -r -g %{GRAFANA_GROUP} -d %{_datadir}/%{name} \
|
||||
-s /sbin/nologin -c "%{GRAFANA_USER} user" %{GRAFANA_GROUP}
|
||||
echo "... done";
|
||||
fi
|
||||
fi
|
||||
echo "Creating user %{GRAFANA_USER} and group %{GRAFANA_GROUP} if not present"
|
||||
getent group %{GRAFANA_GROUP} > /dev/null || groupadd -r %{GRAFANA_GROUP}
|
||||
getent passwd %{GRAFANA_GROUP} > /dev/null || useradd -r -g %{GRAFANA_GROUP} \
|
||||
-d %{GRAFANA_HOME} -s /sbin/nologin -c "%{GRAFANA_USER} user" %{GRAFANA_GROUP}
|
||||
|
||||
%post
|
||||
%{fillup_only -n %{name}-server}
|
||||
@ -129,11 +123,6 @@ fi
|
||||
|
||||
%postun
|
||||
%service_del_postun %{name}-server.service
|
||||
if [ $1 -eq 0 ]; then
|
||||
userdel %{GRAFANA_USER} || logger "User \"%{GRAFANA_USER}\" could not be deleted."
|
||||
groupdel %{GRAFANA_GROUP} || logger "Group \"%{GRAFANA_GROUP}\" could not be deleted."
|
||||
rm -rf %{_localstatedir}/lib/%{name}
|
||||
rm -rf %{_localstatedir}/log/%{name}; fi
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
|
Loading…
Reference in New Issue
Block a user