blob: b7d4de79a0044b5e2c16bd1645fec993eb2c5841 [file] [log] [blame]
Naresh Kambojub0ad7aa2016-11-10 00:33:43 +05301#!/bin/sh
2
3# you should NOT be root
4# run following steps on CentOS as user
5sudo yum -y update
6# build dependencies
7sudo yum -y install autoconf automake binutils bison flex gcc gcc-c++ gettext \
8 libtool sed make patch pkgconfig redhat-rpm-config rpm-build \
9 diffutils coreutils glibc-static
10
11# sslverify=0 to be enabled in all repo files
12# to work with yumdownloader --source
13REPO_FILES="/etc/yum.repos.d/"
14# shellcheck disable=SC2044
15for FILE in $(find "${REPO_FILES}"); do
16 sudo sed -i -e 's/sslverify=1/sslverify=0/g' "${FILE}"
17done
18sudo yum -y clean all
19
20# install openssl dependencies
21sudo yum -y install perl openssl-devel krb5-devel zlib-devel
22
23mkdir -p "${HOME}"/rpmbuild/BUILD
24mkdir -p "${HOME}"/rpmbuild/RPMS
25mkdir -p "${HOME}"/rpmbuild/SOURCES
26mkdir -p "${HOME}"/rpmbuild/SPECS
27mkdir -p "${HOME}"/rpmbuild/SRPMS
28
29echo "%_topdir %(echo $HOME)/rpmbuild" > ~/.rpmmacros
30
31# shellcheck disable=SC2164
32cd "${HOME}"
33# build and install lksctp-tools
34sudo yumdownloader --source lksctp-tools
35
36# get version and release of lksctp-tools
37SCTP_VERSION=$(sudo yum info lksctp-tools | grep Version | head -1| awk '{print $3}')
38SCTP_RELEASE=$(sudo yum info lksctp-tools | grep Release | head -1| awk '{print $3}')
39
40rpmbuild --recompile lksctp-tools-"${SCTP_VERSION}""-""${SCTP_RELEASE}".src.rpm
41# shellcheck disable=SC2164
42cd "${HOME}""/rpmbuild/BUILD/lksctp-tools-""${SCTP_VERSION}"/
43sudo make install
44
45# shellcheck disable=SC2164
46cd "${HOME}"
47sudo yumdownloader --source openssl
48
49# get version and release of openssl
50SSL_VERSION=$(sudo yum info openssl | grep Version | awk '{print $3}')
51SSL_RELEASE=$(sudo yum info openssl | grep Release | awk '{print $3}')
52# run below step, you could see list of dependencies not met and exit
53rpmbuild --rebuild openssl-"${SSL_VERSION}""-""${SSL_RELEASE}".src.rpm
54
55# shellcheck disable=SC2164
56cd "${HOME}"/rpmbuild/SPECS/
57
58sed -i -e 's/BuildRequires: lksctp-tools-devel/# BuildRequires: lksctp-tools-devel/g' openssl.spec
59# build will start from this command
60rpmbuild -ba openssl.spec
61
62# shellcheck disable=SC2164
63cd "${HOME}""/rpmbuild/BUILD/openssl-""${SSL_VERSION}"/
64make
65sudo make install
66make tests