mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/boypt/openssh-rpms.git
synced 2026-09-20 08:03:38 +08:00
Important Version Updates (#19)
* Important Version Updates - Add dockerfile support for centos 8 series. - Modify Dockerfile.centos to add CentOS 8 support and fix the problem of CentOS 5 series not being able to build. - Modify modify_yum_source.sh to add CentOS 8 support and fix CentOS 5 series yum source problem. * Update CentOS Stream support INT ✘ base - Changed compile.sh to add support for CentOS Stream 8/9 series. - Modified docker.README.md to add Stream series description. - Modified Dockerfile.amazonlinux to add cleanup operations and reduce image size. - Modify Dockerfile.centos, add cleanup operation, reduce image size - Added Dockerfile.centos-stream to support Stream series build images. - Added modify_dnf_source.pl to add Stream series yum source modification function. - Modified README.md to add Stream series test pass information and correct formatting and word spelling errors. --------- Co-authored-by: Rex Zhou <zhouruixi@goldwind.com>
This commit is contained in:
16
README.md
16
README.md
@@ -6,7 +6,7 @@ Similar Project: [Backport OpenSSH for Debian / Ubuntu distros](https://github.c
|
||||
|
||||
## Supported (tested) Distro:
|
||||
|
||||
- CentOS 5/6/7/8/Stream 8
|
||||
- CentOS 5/6/7/8/Stream 8/9
|
||||
- Amazon Linux 1/2/2023
|
||||
- UnionTech OS Server 20
|
||||
- openEuler 22.03 (LTS-SP1)
|
||||
@@ -36,14 +36,14 @@ yum install -y gcc44
|
||||
1. Install build requirements listed above.
|
||||
2. Edit `version.env` file if necessary.
|
||||
3. Download source packages.
|
||||
```bash
|
||||
./pullsrc.sh
|
||||
```
|
||||
if any error comes up, manally download the source files into the `downloads` dir.
|
||||
```bash
|
||||
./pullsrc.sh
|
||||
```
|
||||
if any error comes up, manually download the source files into the `downloads` dir.
|
||||
4. Run the script to build RPMs.
|
||||
```bash
|
||||
./compile.sh
|
||||
```
|
||||
```bash
|
||||
./compile.sh
|
||||
```
|
||||
|
||||
### Install RPMs
|
||||
|
||||
|
||||
@@ -37,8 +37,9 @@ GUESS_DIST() {
|
||||
fi
|
||||
|
||||
local dist=$(rpm --eval '%{?dist}' | tr -d '.')
|
||||
|
||||
|
||||
# fallback to el7
|
||||
[[ $dist == "el9" ]] && dist="el7"
|
||||
[[ $dist == "el8" ]] && dist="el7"
|
||||
[[ $dist == "an7" ]] && dist="el7"
|
||||
[[ $dist == "an8" ]] && dist="el7"
|
||||
@@ -145,7 +146,7 @@ if [[ -z $arg1 ]]; then
|
||||
rpm -q gcc44 && export CC=gcc44
|
||||
;;
|
||||
*)
|
||||
echo "Distro undefined, please specify manualy: el5 el6 el7 amzn1 amzn2 amzn2023"
|
||||
echo "Distro undefined, please specify manually: el5 el6 el7 amzn1 amzn2 amzn2023"
|
||||
echo -e "\nCurrent OS:"
|
||||
[[ -f /etc/os-release ]] && cat /etc/os-release
|
||||
[[ -f /etc/redhat-release ]] && cat /etc/redhat-release
|
||||
|
||||
@@ -23,9 +23,9 @@ COMPONENT="$SERVER/cloudteam/openssh-rpm-builder"
|
||||
|
||||
```shell
|
||||
# Specify build versions
|
||||
VERSIONS=("7" "6" "5")
|
||||
VERSIONS=("8" "7" "6" "5")
|
||||
# Define whether to enable Tsinghua University mirror source. (Very useful for Chinese users)
|
||||
CHINA_MIRROR=0 # Setting this variable to non-zero means enabling
|
||||
CHINA_MIRROR=1 # Setting this variable to non-zero means enabling
|
||||
|
||||
for VERSION in "${VERSIONS[@]}"
|
||||
do
|
||||
@@ -45,7 +45,7 @@ echo 'The building has been completed!'
|
||||
|
||||
```shell
|
||||
# Specify build versions
|
||||
VERSIONS=("7" "6" "5")
|
||||
VERSIONS=("8" "7" "6" "5")
|
||||
|
||||
for VERSION in "${VERSIONS[@]}"
|
||||
do
|
||||
@@ -63,6 +63,52 @@ echo 'The building has been completed!'
|
||||
echo 'Push has been completed!'
|
||||
```
|
||||
|
||||
#### CentOS Stream
|
||||
|
||||
##### Build images
|
||||
|
||||
```shell
|
||||
# Specify build versions
|
||||
VERSIONS=("9" "8")
|
||||
# Define whether to enable Tsinghua University mirror source. (Very useful for Chinese users)
|
||||
CHINA_MIRROR=1 # Setting this variable to non-zero means enabling
|
||||
|
||||
for VERSION in "${VERSIONS[@]}"
|
||||
do
|
||||
echo "Building version: ${VERSION}"
|
||||
# Build docker image
|
||||
docker build \
|
||||
-t $COMPONENT:centos-stream$VERSION \
|
||||
--build-arg VERSION_NUM=$VERSION \
|
||||
--build-arg CHINA_MIRROR=$CHINA_MIRROR \
|
||||
-f docker/Dockerfile.centos-stream .
|
||||
done
|
||||
|
||||
echo 'The building has been completed!'
|
||||
```
|
||||
|
||||
##### Push images
|
||||
|
||||
```shell
|
||||
# Specify build versions
|
||||
VERSIONS=("9" "8")
|
||||
|
||||
for VERSION in "${VERSIONS[@]}"
|
||||
do
|
||||
echo "Pushing version: ${VERSION}"
|
||||
# Tag image
|
||||
docker tag $COMPONENT:centos-stream$VERSION $COMPONENT:centos-stream.$VERSION
|
||||
docker tag $COMPONENT:centos-stream$VERSION $COMPONENT:centos-stream.$VERSION.$(date +%Y%m%d)
|
||||
docker tag $COMPONENT:centos-stream$VERSION $COMPONENT:el$VERSION
|
||||
# Push image
|
||||
docker push $COMPONENT:centos-stream$VERSION
|
||||
docker push $COMPONENT:centos-stream.$VERSION
|
||||
docker push $COMPONENT:centos-stream.$VERSION.$(date +%Y%m%d)
|
||||
docker push $COMPONENT:el$VERSION
|
||||
done
|
||||
echo 'Push has been completed!'
|
||||
```
|
||||
|
||||
#### Amazon Linux
|
||||
|
||||
##### Build images
|
||||
@@ -71,7 +117,7 @@ echo 'The building has been completed!'
|
||||
# Specify build versions
|
||||
VERSIONS=("2023" "2" "1")
|
||||
# Define whether to enable China mirror source. (Very useful for Chinese users)
|
||||
CHINA_MIRROR=0 # Setting this variable to non-zero means enabling
|
||||
CHINA_MIRROR=1 # Setting this variable to non-zero means enabling
|
||||
|
||||
for VERSION in "${VERSIONS[@]}"
|
||||
do
|
||||
@@ -135,7 +181,7 @@ docker run -it --rm \
|
||||
OUT_PATH="$PWD"
|
||||
|
||||
# Specify the name of tags.
|
||||
IMAGE_TAGS=("amzn2023" "amzn2" "amzn1" "el7" "el6" "el5")
|
||||
IMAGE_TAGS=("amzn2023" "amzn2" "amzn1" "el9" "el8" "el7" "el6" "el5")
|
||||
|
||||
for IMAGE_TAG in "${IMAGE_TAGS[@]}"
|
||||
do
|
||||
|
||||
@@ -21,6 +21,7 @@ RUN if [ "$CHINA_MIRROR" != "0" ]; then \
|
||||
fi && \
|
||||
yum groupinstall -y "Development Tools" && \
|
||||
yum install -y rpm-build pam-devel krb5-devel zlib-devel libXt-devel libX11-devel perl perl-IPC-Cmd && \
|
||||
yum clean all && \
|
||||
find . -type f -name '.keep' -delete && \
|
||||
bash ./pullsrc.sh
|
||||
|
||||
|
||||
@@ -9,16 +9,32 @@ WORKDIR /data
|
||||
# Copy all files
|
||||
COPY . /data
|
||||
|
||||
RUN if [ "$CHINA_MIRROR" != "0" ]; then \
|
||||
RUN if [ "$VERSION_NUM" = "8" ]; then \
|
||||
MIRROR_URL="https://vault.centos.org" && \
|
||||
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
|
||||
-e "s|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=${MIRROR_URL}/8.4.2105|g" \
|
||||
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=${MIRROR_URL}/8.4.2105|g" \
|
||||
-i /etc/yum.repos.d/CentOS-*.repo; \
|
||||
elif [ "$VERSION_NUM" = "5" ]; then \
|
||||
MIRROR_URL="http://archive.kernel.org" && \
|
||||
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
|
||||
-e "s|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=${MIRROR_URL}/centos-vault/5.11|g" \
|
||||
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=${MIRROR_URL}/centos-vault/5.11|g" \
|
||||
-i.bak /etc/yum.repos.d/*.repo; \
|
||||
fi && \
|
||||
if [ "$CHINA_MIRROR" != "0" ]; then \
|
||||
bash ./docker/modify_yum_source.sh; \
|
||||
fi && \
|
||||
if [ "$VERSION_NUM" = "7" ] || [ "$VERSION_NUM" = "6" ]; then \
|
||||
yum install -y perl-IPC-Cmd; \
|
||||
if [ "$VERSION_NUM" = "8" ]; then \
|
||||
yum install -y perl perl-IPC-Cmd; \
|
||||
elif [ "$VERSION_NUM" = "7" ] || [ "$VERSION_NUM" = "6" ]; then \
|
||||
yum install -y perl-IPC-Cmd imake; \
|
||||
elif [ "$VERSION_NUM" = "5" ]; then \
|
||||
yum install -y gcc44; \
|
||||
yum install -y gcc44 imake; \
|
||||
fi && \
|
||||
yum groupinstall -y "Development Tools" && \
|
||||
yum install -y imake rpm-build pam-devel krb5-devel zlib-devel libXt-devel libX11-devel gtk2-devel && \
|
||||
yum install -y rpm-build pam-devel krb5-devel zlib-devel libXt-devel libX11-devel gtk2-devel && \
|
||||
yum clean all && \
|
||||
find . -type f -name '.keep' -delete && \
|
||||
LINE_NO=$(grep -n -- "--define 'skip_x11_askpass 1'" /data/compile.sh | cut -d: -f1) && \
|
||||
sed -i "$LINE_NO a\--define \"debug_package %{nil}\" \\\\" ./compile.sh && \
|
||||
|
||||
25
docker/Dockerfile.centos-stream
Normal file
25
docker/Dockerfile.centos-stream
Normal file
@@ -0,0 +1,25 @@
|
||||
# Official: https://quay.io/repository/centos/centos?tab=tags
|
||||
ARG VERSION_NUM="9"
|
||||
FROM quay.io/centos/centos:stream$VERSION_NUM
|
||||
ARG CHINA_MIRROR=0
|
||||
LABEL Author="Rex Zhou <zrx879582094@gmail.com>"
|
||||
|
||||
WORKDIR /data
|
||||
|
||||
# Copy all files
|
||||
COPY . /data
|
||||
|
||||
RUN if [ "$CHINA_MIRROR" != "0" ]; then \
|
||||
yum install -y perl && \
|
||||
perl /data/docker/modify_dnf_source.pl /etc/yum.repos.d/*.repo; \
|
||||
fi && \
|
||||
yum clean all && yum makecache && \
|
||||
yum groupinstall -y "Development Tools" && \
|
||||
yum install -y rpm-build pam-devel krb5-devel zlib-devel libXt-devel libX11-devel gtk2-devel && \
|
||||
yum clean all && \
|
||||
find . -type f -name '.keep' -delete && \
|
||||
LINE_NO=$(grep -n -- "--define 'skip_x11_askpass 1'" /data/compile.sh | cut -d: -f1) && \
|
||||
sed -i "$LINE_NO a\--define \"debug_package %{nil}\" \\\\" ./compile.sh && \
|
||||
bash ./pullsrc.sh
|
||||
|
||||
CMD ["bash", "/data/compile.sh"]
|
||||
37
docker/modify_dnf_source.pl
Normal file
37
docker/modify_dnf_source.pl
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use autodie;
|
||||
|
||||
my $mirrors = 'https://mirrors.tuna.tsinghua.edu.cn/centos-stream';
|
||||
|
||||
if (@ARGV < 1) {
|
||||
die "Usage: $0 <filename1> <filename2> ...\n";
|
||||
}
|
||||
|
||||
while (my $filename = shift @ARGV) {
|
||||
my $backup_filename = $filename . '.bak';
|
||||
rename $filename, $backup_filename;
|
||||
|
||||
open my $input, "<", $backup_filename;
|
||||
open my $output, ">", $filename;
|
||||
|
||||
while (<$input>) {
|
||||
s/^metalink/# metalink/;
|
||||
|
||||
if (m/^name/) {
|
||||
my (undef, $repo, $arch) = split /-/;
|
||||
$repo =~ s/^\s+|\s+$//g;
|
||||
($arch = defined $arch ? lc($arch) : '') =~ s/^\s+|\s+$//g;
|
||||
|
||||
if ($repo =~ /^Extras/) {
|
||||
$_ .= "baseurl=${mirrors}/SIGs/\$releasever-stream/extras" . ($arch eq 'source' ? "/${arch}/" : "/\$basearch/") . "extras-common\n";
|
||||
} else {
|
||||
$_ .= "baseurl=${mirrors}/\$releasever-stream/$repo" . ($arch eq 'source' ? "/" : "/\$basearch/") . ($arch ne '' ? "${arch}/tree/" : "os") . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
print $output $_;
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,17 @@
|
||||
|
||||
RELEASE_VER=$(rpm --eval '%{?dist}')
|
||||
[ -z "$RELEASE_VER" ] && RELEASE_VER=".el5"
|
||||
MIRROR_URL="https://mirrors.tuna.tsinghua.edu.cn"
|
||||
MIRROR_URL="http://mirrors.tuna.tsinghua.edu.cn"
|
||||
AWS_REGION="cn-northwest-1"
|
||||
|
||||
case $RELEASE_VER in
|
||||
.el8)
|
||||
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
|
||||
-e "s|^baseurl=https://vault.centos.org|baseurl=${MIRROR_URL}/centos-vault|g" \
|
||||
-i.bak /etc/yum.repos.d/CentOS-*.repo && \
|
||||
rm -rf /var/cache/yum/ && \
|
||||
yum makecache timer
|
||||
;;
|
||||
.el7)
|
||||
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
|
||||
-e "s|^#baseurl=http://mirror.centos.org/centos|baseurl=${MIRROR_URL}/centos|g" \
|
||||
@@ -22,17 +29,14 @@ case $RELEASE_VER in
|
||||
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
|
||||
-e "s|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=${MIRROR_URL}/centos-vault/6.10|g" \
|
||||
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=${MIRROR_URL}/centos-vault/6.10|g" \
|
||||
-i.bak \
|
||||
/etc/yum.repos.d/CentOS-*.repo && \
|
||||
-i.bak /etc/yum.repos.d/CentOS-*.repo && \
|
||||
rm -rf /var/cache/yum/ && \
|
||||
yum makecache fast
|
||||
;;
|
||||
.el5)
|
||||
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
|
||||
-e "s|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=${MIRROR_URL}/centos-vault/5.11|g" \
|
||||
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=${MIRROR_URL}/centos-vault/5.11|g" \
|
||||
-i.bak \
|
||||
/etc/yum.repos.d/*.repo && \
|
||||
-e "s|^baseurl=http://archive.kernel.org|baseurl=${MIRROR_URL}|g" \
|
||||
-i.bak /etc/yum.repos.d/*.repo && \
|
||||
rm -rf /var/cache/yum/ && \
|
||||
yum makecache fast
|
||||
;;
|
||||
@@ -44,6 +48,9 @@ case $RELEASE_VER in
|
||||
echo "amazonaws.com.cn" > /etc/yum/vars/awsdomain
|
||||
echo "$AWS_REGION" > /etc/yum/vars/awsregion
|
||||
;;
|
||||
.amzn2023)
|
||||
echo "Amazon Linux 2023 is NOT need to change any settings."
|
||||
;;
|
||||
*)
|
||||
echo "rpm dist undefined, please specify: el5 el6 el7"
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user