3 # Common paths used in this script
4 # NB: Name will need to be updated for both ODL and RMP version bumps
5 rpm_name="opendaylight-0.2.1-5.fc20.noarch.rpm"
6 rpm_out_path="$HOME/rpmbuild/RPMS/noarch/$rpm_name"
7 src_name="distribution-karaf-0.2.1-Helium-SR1.1.tar.gz"
8 src_cache_path="$HOME/$src_name"
11 # Install required software, add user to mock group for rpmbuild
12 sudo yum install -y @development-tools fedora-packager
13 sudo usermod -a -G mock $USER
15 # Configure rpmbuild dir
18 # Put ODL source archive location required by rpmbuild
19 if [ -f $src_cache_path ]; then
20 echo "Using cached version of ODL at $src_cache_path"
21 cp $src_cache_path $HOME/rpmbuild/SOURCES/$src_name
23 echo "No cached ODL found, downloading from Nexus..."
24 curl -o $HOME/rpmbuild/SOURCES/$src_name https://nexus.opendaylight.org/content/groups/public/org/opendaylight/integration/distribution-karaf/0.2.1-Helium-SR1.1/$src_name
27 # Put systemd unit file archive in rpmbuild's SOURCES dir
28 # Need `-L` to follow redirects
29 curl -L -o $HOME/rpmbuild/SOURCES/opendaylight-systemd-$sysd_commit.tar.gz https://github.com/dfarrell07/opendaylight-systemd/archive/$sysd_commit/opendaylight-systemd-$sysd_commit.tar.gz
31 # Put ODL RPM .spec file in location required by rpmbuild
32 cp opendaylight.spec $HOME/rpmbuild/SPECS
35 cd $HOME/rpmbuild/SPECS
36 rpmbuild -ba opendaylight.spec
38 # Confirm RPM found in expected location
39 if [ -f $rpm_out_path ]; then
41 echo "Should be at: $rpm_out_path"
43 echo "RPM seems to have failed. :(" &>2