Skip to content

Commit 035575e

Browse files
author
Test User
committed
Add replace default build script
1 parent 8274fd9 commit 035575e

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed

scripts/replace-default.sh

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (C) 2006-2024 wolfSSL Inc.
4+
#
5+
# This file is part of wolfProvider.
6+
#
7+
# wolfProvider is free software; you can redistribute it and/or modify
8+
# it under the terms of the GNU General Public License as published by
9+
# the Free Software Foundation; either version 3 of the License, or
10+
# (at your option) any later version.
11+
#
12+
# wolfProvider is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU General Public License
18+
# along with wolfProvider. If not, see <http://www.gnu.org/licenses/>.
19+
#
20+
# This script builds and installs wolfSSL/OpenSSL/wolfProvider packages to
21+
# replace the default provider to always use wolfProvider.
22+
23+
set -e
24+
set -x
25+
26+
echo "=== Building wolfProvider Debian packages ==="
27+
28+
# Install build dependencies
29+
sudo apt-get update
30+
sudo apt-get install -y \
31+
build-essential \
32+
devscripts \
33+
debhelper \
34+
dh-autoreconf \
35+
libtool \
36+
pkg-config \
37+
git \
38+
wget \
39+
curl \
40+
ca-certificates \
41+
openssl \
42+
dpkg-dev \
43+
lintian \
44+
fakeroot \
45+
dh-exec \
46+
equivs \
47+
expect \
48+
xxd
49+
50+
# Ensure the working directory is safe
51+
git config --global --add safe.directory "$PWD"
52+
53+
# Fetch tags (for Debian versioning)
54+
git fetch --tags --force --prune
55+
56+
# Install wolfSSL Debian packages from repo tarball
57+
mkdir -p "/tmp/wolfssl-pkg"
58+
chmod +x debian/install-wolfssl.sh
59+
./debian/install-wolfssl.sh \
60+
--tag v5.8.2-stable \
61+
"/tmp/wolfssl-pkg"
62+
63+
# Stage wolfSSL debs into artifacts directory
64+
mkdir -p "/tmp/wolfprov-packages"
65+
find /tmp/wolfssl-pkg -name "*wolfssl*" -type f -name "*.deb" -exec cp {} /tmp/wolfprov-packages/ \;
66+
67+
# Build Debian packages (wolfProvider + OpenSSL)
68+
yes Y | ./scripts/build-wolfprovider.sh --debian
69+
70+
# Collect package artifacts
71+
mv ../*.deb /tmp/wolfprov-packages/ 2>/dev/null || true
72+
73+
echo "=== Installing packages ==="
74+
75+
# Install wolfSSL first
76+
wolfssl_debs=$(ls -1 /tmp/wolfprov-packages/*wolfssl*.deb 2>/dev/null || true)
77+
if [ -n "$wolfssl_debs" ]; then
78+
sudo apt install -y $wolfssl_debs
79+
fi
80+
81+
# Install OpenSSL packages in dependency order with conflict resolution
82+
libssl3_debs=$(ls -1 /tmp/wolfprov-packages/libssl3_[0-9]*.deb 2>/dev/null || true)
83+
openssl_debs=$(ls -1 /tmp/wolfprov-packages/openssl_[0-9]*.deb 2>/dev/null || true)
84+
libssl_dev_debs=$(ls -1 /tmp/wolfprov-packages/libssl-dev_[0-9]*.deb 2>/dev/null || true)
85+
86+
# Install custom OpenSSL packages
87+
echo "Installing custom OpenSSL packages..."
88+
if [ -n "$libssl3_debs" ]; then
89+
echo "Installing custom libssl3 package..."
90+
sudo dpkg -i $libssl3_debs || sudo apt install -f -y
91+
fi
92+
if [ -n "$openssl_debs" ]; then
93+
echo "Installing custom openssl package..."
94+
sudo dpkg -i $openssl_debs || sudo apt install -f -y
95+
fi
96+
if [ -n "$libssl_dev_debs" ]; then
97+
echo "Installing custom libssl-dev package..."
98+
sudo dpkg -i $libssl_dev_debs || sudo apt install -f -y
99+
fi
100+
101+
# Install wolfProvider main package
102+
wolfprov_main=$(ls -1 /tmp/wolfprov-packages/libwolfprov_[0-9]*.deb 2>/dev/null | head -n1 || true)
103+
if [ -z "$wolfprov_main" ]; then
104+
echo "ERROR: libwolfprov main package not found"
105+
exit 1
106+
fi
107+
sudo dpkg -i "$wolfprov_main" || sudo apt install -f -y
108+
109+
./scripts/verify-debian.sh
110+
111+
echo "=== Replace Default installed! ==="

0 commit comments

Comments
 (0)