Skip to content

Instantly share code, notes, and snippets.

@olegbuevich
Last active December 2, 2022 19:30
Show Gist options
  • Save olegbuevich/7ae572ef3ceb681c53c3307059aad648 to your computer and use it in GitHub Desktop.
Save olegbuevich/7ae572ef3ceb681c53c3307059aad648 to your computer and use it in GitHub Desktop.
Build openssh 8 rpms for centos 6
#!/bin/bash
set -eu
OPENSSH_VERSION="8.0p1"
sudo yum install -y epel-release
sudo yum install -y mock rpm-build
mkdir -p ~/rpmbuild/SOURCES
cd ~/rpmbuild/SOURCES
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${OPENSSH_VERSION}.tar.gz
tar zxf openssh-${OPENSSH_VERSION}.tar.gz
cp /etc/pam.d/sshd openssh-${OPENSSH_VERSION}/contrib/redhat/sshd.pam
tar cpzf openssh-${OPENSSH_VERSION}.tar.gz openssh-${OPENSSH_VERSION}
sed -i "s/sshd.pam.old/sshd.pam/g" openssh-${OPENSSH_VERSION}/contrib/redhat/openssh.spec
sed -i "s/\(^%define no_x11_askpass\).*$/\1 1/g" openssh-${OPENSSH_VERSION}/contrib/redhat/openssh.spec
sed -i "s/\(^%define no_gnome_askpass\).*$/\1 1/g" openssh-${OPENSSH_VERSION}/contrib/redhat/openssh.spec
sed -i "s/PreReq/Requires/g" openssh-${OPENSSH_VERSION}/contrib/redhat/openssh.spec
sed -i "s/^Source1/#Source1/g" openssh-${OPENSSH_VERSION}/contrib/redhat/openssh.spec
rpmbuild -bs openssh-${OPENSSH_VERSION}/contrib/redhat/openssh.spec
sudo mock -r epel-6-x86_64 --rebuild /home/vagrant/rpmbuild/SRPMS/openssh-${OPENSSH_VERSION}-1.el6.src.rpm
sudo mock -r epel-6-i386 --rebuild /home/vagrant/rpmbuild/SRPMS/openssh-${OPENSSH_VERSION}-1.el6.src.rpm
@matthiashaasesourceforge

see
https://github.com/boypt/openssh-rpms
.
this solves bulding the rpm's:
openssh-9.1p1-2.el6.src.rpm
openssh-9.1p1-2.el6.x86_64.rpm
openssh-clients-9.1p1-2.el6.x86_64.rpm
openssh-debuginfo-9.1p1-2.el6.x86_64.rpm
openssh-server-9.1p1-2.el6.x86_64.rpm
.
without such a lot of issues like the very old script here on this side

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment