Skip to content

Instantly share code, notes, and snippets.

@Mierdin
Forked from dave-tucker/build-ovs-rpms.sh
Last active August 29, 2015 14:12
Show Gist options
  • Save Mierdin/7cd1ce28c7d850dca4fc to your computer and use it in GitHub Desktop.
Save Mierdin/7cd1ce28c7d850dca4fc to your computer and use it in GitHub Desktop.
#!/bin/bash
# Copyright 2014 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Assumes you have met the pre-reqs here: http://fedoraproject.org/wiki/How_to_create_an_RPM_package
ovs_versions=(1.4.6 1.5.0 1.6.1 1.7.0 1.7.1 1.7.3 1.9.0 1.9.3 \
1.10.0 1.10.2 1.11.0 2.0.0 2.0.1 2.1.0 2.1.1)
for version in ${ovs_versions[@]}; do
ovs="openvswitch-$version"
url="http://openvswitch.org/releases/$ovs.tar.gz"
if [ ! -f ~/rpmbuild/SOURCES/$ovs.tar.gz ]; then
echo "---> Downloading OVS $version"
wget -P ~/rpmbuild/SOURCES $url
fi
cd /tmp
if [! -d $ovs ]; then
echo "---> Extracting OVS"
tar -xzf ~/rpmbuild/SOURCES/$ovs.tar.gz
fi
cd $ovs
echo "---> Building RPM for OVS $version"
if [ -f rhel/openvswitch-fedora.spec ]; then
sed -i '1s/^/%define _unpackaged_files_terminate_build 0\n/' rhel/openvswitch-fedora.spec
rpmbuild -bb rhel/openvswitch-fedora.spec
else
rpmbuild -bb rhel/openvswitch.spec
fi
done
echo "Copying RPMs to build directory"
if [ ! -d /vagrant/build/rpms ]; then
mkdir -p /vagrant/build/rpms
fi
find ~/rpmbuild/RPMS/ -type f -not -iname '*debug*' -exec cp '{}' '/vagrant/build/rpms/' ';'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment