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