forked from kloudsense/cloudera_exporter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cloudera_exporter.spec
59 lines (42 loc) · 1.25 KB
/
cloudera_exporter.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
Name: cloudera_exporter
Version: %{version_num}
Release: 1%{?dist}
Summary: Cloudera prometheus exporter
License: GPLv3
Source0: %{name}-%{version}.tar.gz
BuildRequires: golang
BuildRequires: systemd-rpm-macros
BuildRequires: make
Provides: %{name} = %{version}
%description
Cloudera prometheus exporter
%global debug_package %{nil}
%prep
%autosetup
%build
go build -v -o %{name}
%pre
# add a group
/usr/bin/getent group %{name} || /usr/sbin/groupadd -r %{name}
# add an user
/usr/bin/getent passwd %{name} || /usr/sbin/useradd %{name} -g %{name} --system --no-create-home --home /nonexistent
%install
mkdir -p %{buildroot}%{_sysconfdir}/%{name}
install -Dpm 0755 %{name} %{buildroot}%{_bindir}/%{name}
install -Dpm 0600 conf/config.ini.example %{buildroot}%{_sysconfdir}/%{name}/config.ini
install -Dpm 644 rpm/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
%check
# go test should be here... :)
%post
%systemd_post %{name}.service
%preun
%systemd_preun %{name}.service
%files
%defattr(-, %{name},%{name})
%dir %{_sysconfdir}/%{name}
%{_bindir}/%{name}
%{_unitdir}/%{name}.service
%config(noreplace) %{_sysconfdir}/%{name}/config.ini
%changelog
* Wed May 19 2021 John Doe - 1.0
- First release%changelog