1 # Honyecomb is a noarch package, so this isn't necessary. It's also very slow.
3 %define _version %(./version)
4 %define _release %(./release)
8 # The Fedora/CentOS packaging guidelines *require* the use of a disttag. Honeycomb's
9 # RPM build doesn't do anything Fedora/CentOS specific, so the disttag is
10 # unnecessary and unused in our case, but both the docs and the pros (apevec)
11 # agree that we should include it.
12 # See: https://fedoraproject.org/wiki/Packaging:DistTag
15 Summary: fd.io Honeycomb
16 Group: Applications/Communications
19 Source0: vpp-integration-distribution-%{_version}-SNAPSHOT-hc.zip
20 Source1: honeycomb.service
21 Requires: vpp, vpp-plugins, java >= 1:1.8.0
22 # Required for creating honeycomb group
23 Requires(pre): shadow-utils
24 # Required for configuring systemd
25 BuildRequires: systemd
28 # Create `honeycomb` user/group
29 # Short circuits if the user/group already exists
30 # Home dir must be a valid path for various files to be created in it
31 getent passwd honeycomb > /dev/null || useradd honeycomb -M -d $RPM_BUILD_ROOT/opt/%name
32 getent group honeycomb > /dev/null || groupadd honeycomb
33 getent group vpp > /dev/null && usermod -a -G vpp honeycomb
39 # Extract Source0 (Honeycomb archive)
40 %autosetup -n vpp-integration-distribution-%{_version}-SNAPSHOT
43 # Create directory in build root for Honeycomb
44 mkdir -p $RPM_BUILD_ROOT/opt/%name
45 # Copy Honeycomb from archive to its dir in build root
46 cp -r ../vpp-integration-distribution-%{_version}-SNAPSHOT/* $RPM_BUILD_ROOT/opt/%name
47 # Create directory in build root for systemd .service file
48 mkdir -p $RPM_BUILD_ROOT/%{_unitdir}
49 # Copy Honeycomb's systemd .service file to correct dir in build root
51 cp ${RPM_BUILD_ROOT}/../../%{name}.service $RPM_BUILD_ROOT/%{_unitdir}/%name.service
54 # When the RPM is removed, the subdirs containing new files wouldn't normally
55 # be deleted. Manually clean them up.
56 # Warning: This does assume there's no data there that should be preserved
58 rm -rf $RPM_BUILD_ROOT/opt/%name
62 # Honeycomb will run as honeycomb:honeycomb, set as user:group for honeycomb dir, don't override mode
63 %attr(-,honeycomb,honeycomb) /opt/%name
64 # Configure systemd unitfile user/group/mode
65 %attr(0644,root,root) %{_unitdir}/%name.service