-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathinstall-openssl_3.sh
More file actions
104 lines (85 loc) · 2.69 KB
/
install-openssl_3.sh
File metadata and controls
104 lines (85 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
set -euo pipefail
VERSION="3.6.1"
BUILD_ROOT="/root/rpmbuild"
# Установка зависимостей
echo "Installing dependencies..."
dnf -y install \
curl \
make \
gcc \
perl \
perl-IPC-Cmd \
rpm-build \
perl-FindBin \
perl-Text-Template \
perl-Test-Simple \
zlib-devel \
ca-certificates \
perl-libwww-perl
# Удаление ненужных зависимостей
dnf -y remove openssl || true
# Подготовка окружения
mkdir -p "${BUILD_ROOT}"/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
# Загрузка исходников
echo "Downloading OpenSSL ${VERSION} source..."
curl -sSfL "https://www.openssl.org/source/openssl-${VERSION}.tar.gz" \
-o "${BUILD_ROOT}/SOURCES/openssl-${VERSION}.tar.gz"
# Загрузка файла с контрольной суммой
echo "Downloading SHA256 checksum..."
curl -sSfL "https://www.openssl.org/source/openssl-${VERSION}.tar.gz.sha256" \
-o "${BUILD_ROOT}/SOURCES/openssl-${VERSION}.tar.gz.sha256"
# Проверка контрольной суммы
echo "Verifying SHA256 checksum..."
cd "${BUILD_ROOT}/SOURCES"
sha256sum -c openssl-${VERSION}.tar.gz.sha256
if [ $? -ne 0 ]; then
echo "ERROR: SHA256 checksum verification failed!"
echo "The downloaded file may be corrupted or tampered with."
exit 1
fi
echo "Checksum verification successful!"
# Создание SPEC-файла
cat << 'EOF' > "${BUILD_ROOT}/SPECS/openssl.spec"
Summary: OpenSSL %{version} for CentOS/RHEL
Name: openssl
Version: %{?version}%{!?version:3.6.1}
Release: 1%{?dist}
Obsoletes: openssl < %{version}
Conflicts: openssl < %{version}
Provides: openssl = %{version}-%{release}
URL: https://www.openssl.org/
License: Apache-2.0
%define debug_package %{nil}
Source0: openssl-%{version}.tar.gz
# Зависимости
BuildRequires: make gcc perl perl-IPC-Cmd zlib-devel perl-libwww-perl
Requires: perl-libwww-perl
%description
OpenSSL RPM for version %{version} on CentOS/RHEL
%prep
%setup -q
%build
./config --prefix=/usr/openssl --openssldir=/usr/openssl zlib
make -j$(nproc)
%install
rm -rf %{buildroot}
%make_install
install -d %{buildroot}/usr/bin
install -d %{buildroot}/usr/lib64
ln -sf ../openssl/bin/openssl %{buildroot}/usr/bin/openssl
ln -sf ../openssl/lib64/libssl.so.3 %{buildroot}/usr/lib64/libssl.so.3
ln -sf ../openssl/lib64/libcrypto.so.3 %{buildroot}/usr/lib64/libcrypto.so.3
%files
/usr/bin/openssl
/usr/lib64/libssl.so.3
/usr/lib64/libcrypto.so.3
/usr/openssl
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
EOF
# Сборка RPM
cd "${BUILD_ROOT}/SPECS"
rpmbuild -ba --define "version ${VERSION}" openssl.spec
echo "Build completed! RPM packages:"
find "${BUILD_ROOT}/RPMS" -name "*.rpm"