1 # ODL is a noarch package, so this isn't necessary. It's also very slow.
6 # The Fedora/CentOS packaging guidelines *require* the use of a disttag. ODL's
7 # RPM build doesn't do anything Fedora/CentOS specific, so the disttag is
8 # unnecessary and unused in our case, but both the docs and the pros (apevec)
9 # agree that we should include it.
10 # See: https://fedoraproject.org/wiki/Packaging:DistTag
11 Release: 2.201601200134.el7
13 Summary: OpenDaylight SDN Controller
14 Group: Applications/Communications
16 URL: http://www.opendaylight.org
17 Source0: https://nexus.opendaylight.org/content/groups/public/org/opendaylight/integration/distribution-karaf/0.4.0-beryllium-daily-v201601200134/distribution-karaf-0.4.0-beryllium-daily-v201601200134.tar.gz
18 Source1: %name-c6d7ee1f21d62ff8ffb741c7a12c3d8d3aa3d6ed.service.tar.gz
20 # Required for ODL at run time
21 Requires: java >= 1:1.7.0
22 # Required for creating odl group
23 Requires(pre): shadow-utils
24 # Required for configuring systemd
25 BuildRequires: systemd
28 # Create `odl` 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 odl > /dev/null || useradd odl -M -d $RPM_BUILD_ROOT/opt/%name
32 getent group odl > /dev/null || groupadd odl
35 OpenDaylight beryllium-daily-v201601200134
38 # Extract Source0 (ODL archive)
39 %autosetup -n distribution-karaf-0.4.0-beryllium-daily-v201601200134
40 # Extract Source1 (systemd config)
41 %autosetup -T -D -b 1 -c -n %name-c6d7ee1f21d62ff8ffb741c7a12c3d8d3aa3d6ed.service
44 # Create directory in build root for ODL
45 mkdir -p $RPM_BUILD_ROOT/opt/%name
46 # Copy ODL from archive to its dir in build root
47 cp -r ../distribution-karaf-0.4.0-beryllium-daily-v201601200134/* $RPM_BUILD_ROOT/opt/%name
48 # Create directory in build root for systemd .service file
49 mkdir -p $RPM_BUILD_ROOT/%{_unitdir}
50 # Copy ODL's systemd .service file to correct dir in build root
51 cp ../../BUILD/%name-c6d7ee1f21d62ff8ffb741c7a12c3d8d3aa3d6ed.service/%name-c6d7ee1f21d62ff8ffb741c7a12c3d8d3aa3d6ed.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 # ODL will run as odl:odl, set as user:group for ODL dir, don't override mode
63 %attr(-,odl,odl) /opt/%name
64 # Configure systemd unitfile user/group/mode
65 %attr(0644,root,root) %{_unitdir}/%name.service
69 * Wed Jan 22 2016 Daniel Farrell <dfarrell@redhat.com> - 4.0.0-2.201601200134
70 - Make RPM upgrade properly