forked from narendergaddam/victoriametrics-rpm
-
Notifications
You must be signed in to change notification settings - Fork 5
/
vmauth.spec
75 lines (61 loc) · 2.49 KB
/
vmauth.spec
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
%define release_arch amd64
%ifarch aarch64
%define release_arch arm64
%endif
Name: vmauth
Version: 1.105.0
Release: 1
Summary: vmauth executes a list of the given alerting or recording rules against configured address. It is heavily inspired by Prometheus implementation and aims to be compatible with its syntax.
Group: Development Tools
License: ASL 2.0
URL: https://github.com/VictoriaMetrics/VictoriaMetrics/releases/download/v%{version}/vmutils-linux-%{release_arch}-v%{version}.tar.gz
Source0: %{name}.service
Source1: %{name}.conf
Source2: config.yml
Requires(pre): /usr/sbin/useradd, /usr/bin/getent, /usr/bin/echo, /usr/bin/chown
Requires(postun): /usr/sbin/userdel
BuildRequires: curl
# Use systemd for fedora >= 18, rhel >=7, SUSE >= 12 SP1 and openSUSE >= 42.1
%define use_systemd (0%{?fedora} && 0%{?fedora} >= 18) || (0%{?rhel} && 0%{?rhel} >= 7) || (!0%{?is_opensuse} && 0%{?suse_version} >=1210) || (0%{?is_opensuse} && 0%{?sle_version} >= 120100)
%if %{use_systemd}
Requires: systemd
BuildRequires: systemd
%endif
%description
vmauth executes a list of the given alerting or recording rules against configured address. It is heavily inspired by Prometheus implementation and aims to be compatible with its syntax.
%prep
curl -L %{url} > vmutils.tar.gz
tar -zxf vmutils.tar.gz
%install
%{__install} -m 0755 -d %{buildroot}%{_bindir}
%{__install} -m 0755 -d %{buildroot}/etc/victoriametrics/vmauth
cp %{SOURCE1} %{buildroot}/etc/victoriametrics/vmauth/
cp %{SOURCE2} %{buildroot}/etc/victoriametrics/vmauth/
%if %{use_systemd}
%{__mkdir} -p %{buildroot}%{_unitdir}
%{__install} -m644 %{SOURCE0} %{buildroot}%{_unitdir}/%{name}.service
%endif
cp vmauth-prod %{buildroot}%{_bindir}/vmauth-prod
%pre
/usr/bin/getent group victoriametrics > /dev/null || /usr/sbin/groupadd -r victoriametrics
/usr/bin/getent passwd victoriametrics > /dev/null || /usr/sbin/useradd -r -m -d /home/victoriametrics -s /bin/bash -g victoriametrics victoriametrics
%post
%if %use_systemd
/usr/bin/echo "Note: /etc/victoriametrics/vmauth/config contains examples. You should change this default config up to your needs and then start systemd service."
%endif
%preun
%if %use_systemd
/usr/bin/systemctl stop %{name}
%endif
%postun
%if %use_systemd
/usr/bin/systemctl daemon-reload
%endif
%files
%{_bindir}/vmauth-prod
%dir %attr(0775, victoriametrics, victoriametrics) /etc/victoriametrics/vmauth
%config /etc/victoriametrics/vmauth/vmauth.conf
%config /etc/victoriametrics/vmauth/config.yml
%if %{use_systemd}
%{_unitdir}/vmauth.service
%endif