-
Notifications
You must be signed in to change notification settings - Fork 112
/
daemon.spec
108 lines (75 loc) · 2.85 KB
/
daemon.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
%global groupname daemoner
%global username daemoner
%global homedir /
Name: daemon
Version: 0.2
Release: 1%{?dist}
Summary: Example of daemon
License: GPL
URL: https://github.com/jirihnidek/daemon
Source0: %{name}-%{version}.tar.gz
Requires(pre): shadow-utils
BuildRequires: gcc
BuildRequires: make
BuildRequires: cmake
BuildRequires: systemd
BuildRequires: systemd-rpm-macros
%description
This package contains example of simple UNIX daemon
%pre
getent group %{groupname} >/dev/null || groupadd -r %{groupname}
getent passwd %{username} >/dev/null || \
useradd -r -g %{groupname} -d %{homedir} -s /sbin/nologin \
-c "User used for running example of daemon" %{username}
exit 0
# Section for preparation of build
%prep
# Following macro just has to be here. It unpacks the original source from
# tag.gz archive. It is "interesting" that rpmbuild does not do this
# automatically, when Source0 is defined, but you have to call it explicitly.
%setup -q
# Build section
%build
# We have to use build type "Debug" to be able to create all variants of
# rpm packages (debuginfo, debug source). The normal rpm is stripped from
# debug information. Following macro just run cmake and it generates Makefile
%cmake -DCMAKE_BUILD_TYPE="Debug"
# This macro runs make -f Makefile generated in previous step
%cmake_build
# Install section
%install
# Remove previous build results
rm -rf $RPM_BUILD_ROOT
# This macro runs make -f Makefile install and it installs
# all files to $RPM_BUILD_ROOT
%cmake_install
# This is special section again. You have to list here all files
# that are part of final RPM package. You can specify owner of
# files and permissions to files
%files
# Files and directories owned by root:root
%attr(755,root,root) %{_bindir}/daemon
%attr(755,root,root) %dir %{_sysconfdir}/daemon
%attr(644,root,root) %{_unitdir}/simple-daemon.service
%attr(644,root,root) %{_unitdir}/forking-daemon.service
# File owned by root, but group can read it
%attr(640,root,%{groupname}) %{_sysconfdir}/daemon/daemon.conf
# Files and directories owned by daemoner:daemoner user
%attr(755,%{username},%{groupname}) %{_var}/log/daemon
%attr(755,%{username},%{groupname}) %{_rundir}/daemon
# This is section, where you should describe all important changes
# in RPM
%changelog
* Mon Jan 22 2024 Jiri Hnidek <jhnidek@redhat.com>
- Add initial support for Packit
- Updated version of daemon to 0.2
* Tue Oct 24 2023 Jiri Hnidek <jhnidek@redhat.com>
- Fix building of RPM on COPR
* Wed Sep 29 2021 Jiri Hnidek <jhnidek@redhat.com>
- Use non-root user for runnig daemon
* Mon Sep 27 2021 Jiri Hnidek <jhnidek@redhat.com>
- Use GitHub Actions for building RPM
* Fri Aug 27 2021 Jiri Hnidek <jhnidek@redhat.com>
- RPM package built with tito
* Fri Aug 27 2021 Jiri Hnidek <jhnidek@redhat.com>
- Added first version of daemon.spec