-
Notifications
You must be signed in to change notification settings - Fork 41
/
statsd-c.spec.in
80 lines (64 loc) · 1.93 KB
/
statsd-c.spec.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
Name: statsd-c
Version: @VERSION@
Release: 1%{?dist}
Summary: statsd C port
Group: Applications/Internet
License: GPL
URL: https://github.com/jbuchbinder/statsd-c
Vendor: jbuchbinder
Packager: Jeff Buchbinder <[email protected]>
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
%description
Reimplementation of Etsy's infamous "statsd" in C.
%prep
%setup -q
cmake .
%build
make all
%install
# install binaries
%{__mkdir_p} %{buildroot}/usr/sbin
%{__install} -Dp -m0755 statsd %{buildroot}/usr/sbin/statsd-c
%{__mkdir_p} %{buildroot}/usr/bin
%{__install} -Dp -m0755 statsd %{buildroot}/usr/bin/statsd_client
# Install init scripts
%{__install} -Dp -m0755 redhat/statsd-c %{buildroot}%{_initrddir}/%{name}
# State files...
%{__mkdir_p} %{buildroot}%{_localstatedir}/lib/%{name}
# Install default configuration files
%{__mkdir_p} %{buildroot}%{_sysconfdir}/%{name}
%{__install} -Dp -m0644 redhat/config %{buildroot}%{_sysconfdir}/%{name}/config
%{__mkdir_p} %{buildroot}%{_localstatedir}/lock/subsys
touch %{buildroot}%{_localstatedir}/lock/subsys/%{name}
%pre
getent group %{name} >/dev/null || groupadd -r %{name}
getent passwd %{name} >/dev/null || \
useradd -r -g %{name} -d %{_localstatedir}/lib/%{name} \
-s /sbin/nologin -c "%{name} daemon" %{name}
exit 0
%preun
service %{name} stop
exit 0
%postun
if [ $1 = 0 ]; then
chkconfig --del %{name}
getent passwd %{name} >/dev/null && \
userdel -r %{name} 2>/dev/null
fi
exit 0
%post
chkconfig --add %{name}
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc README.md LICENSE TODO VERSION
/usr/sbin/statsd-c
/usr/bin/statsd_client
%{_initrddir}/%{name}
%config %{_localstatedir}/lib/%{name}
%config %{_sysconfdir}/%{name}
%ghost %{_localstatedir}/lock/subsys/%{name}
%changelog