-
Notifications
You must be signed in to change notification settings - Fork 0
/
new-quic
executable file
·93 lines (87 loc) · 3.14 KB
/
new-quic
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
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")" || { echo "Can't CD to $0 ... this should not happen." ; exit 1 ; } ; pwd -P)"
if [ -f "${SCRIPT_DIR}/overrides" ]; then
# shellcheck source=/dev/null
source "${SCRIPT_DIR}/overrides"
fi
# shellcheck source=/dev/null
source "${SCRIPT_DIR}/common-functions.sh"
QUICTLS_SRC_DIR="${SCRIPT_DIR}/$1"
MAKE_COUNT="$(make_cpu_count)"
add_bin_to_path() {
if [ -d /opt/quictls/lib64 ]; then
QUICTLS_LIB=/opt/quictls/lib64
else
QUICTLS_LIB=/opt/quictls/lib
fi
rm -f /usr/local/bin/qssl
cat << EOF > /usr/local/bin/qssl
#!/bin/sh
LD_LIBRARY_PATH=${QUICTLS_LIB}
export LD_LIBRARY_PATH
/opt/quictls/bin/openssl \$*
EOF
chmod +x /usr/local/bin/qssl
}
#CONFARGS="--prefix=/opt/quictls enable-tls1_3 enable-ktls enable-fips no-idea no-mdc2 no-rc5 no-zlib no-ssl3 enable-unit-test no-ssl3-method enable-rfc3779 enable-cms no-capieng threads"
CONFARGS="enable-tls1_3 no-idea no-mdc2 no-rc5 no-zlib no-ssl3 enable-unit-test no-ssl3-method enable-rfc3779 enable-cms no-capieng threads"
if [ "$(uname -i)" == "x86_64" ]; then
CONFARGS="${CONFARGS} enable-ec_nistp_64_gcc_128"
fi
if [ -z "$1" ]; then
die "Command needs an argument, the subdirectory with quictls source"
fi
log_info "- Beginning pull/build of quictls"
if [ -e "${QUICTLS_SRC_DIR}" ]; then
if [ -d "${QUICTLS_SRC_DIR}" ]; then
cd "${QUICTLS_SRC_DIR}" || die "Unable to cd to ${QUICTLS_SRC_DIR}"
git checkout master > /dev/null 2>&1
fetch_from_git "quictls"
if [ -z "${NEW_QUIC_BRANCH}" ]; then
# Use default branch.
git checkout "$(git remote show origin | grep 'HEAD branch' | cut -d' ' -f5)"
# Use latest 1.xi +quic branch:
#NEW_QUIC_BRANCH="$(git remote show origin | grep -Ew "^\s+OpenSSL_1.*quic" | sort -V | tail -n1 | awk '{print $1}')"
# Use latest 3.x +quic branch:
#NEW_QUIC_BRANCH="$(git remote show origin | grep -Ew "^\s+openssl-3.*quic.*" | sort -V | tail -n1 | awk '{print $1}')"
fi
log_info "Changing branch to '${NEW_QUIC_BRANCH}'"
git checkout "${NEW_QUIC_BRANCH}" 2>&1
fetch_from_git "quictls"
log_info "Cleaning quictls repo"
make -s distclean
log_info "Configuring quictls"
# shellcheck disable=SC2086
./config --prefix="/opt/quictls" ${CONFARGS}
RETVAL="$?"
if [ "$RETVAL" -eq 0 ]; then
log_info "Building quictls, may take a few minutes"
log_info "Using ${MAKE_COUNT} threads with make"
make -s -j "${MAKE_COUNT}"
RETVAL="$?"
if [ "$RETVAL" -eq 0 ]; then
rm -rf /opt/old.quictls
mv /opt/quictls /opt/old.quictls
log_info "Installing quictls"
make -s install_sw install_ssldirs
RETVAL="$?"
if [ "$RETVAL" -eq 0 ]; then
bash -c "$(declare -f add_bin_to_path); add_bin_to_path"
rm -rf /opt/quictls/ssl/certs
ln -s /etc/ssl/certs /opt/quictls/ssl/certs
make -s distclean
else
die "Install failed!"
fi
else
die "Build failed!"
fi
else
die "Configure failed!"
fi
else
die "location (${QUICTLS_SRC_DIR}) is not a directory."
fi
else
die "location (${QUICTLS_SRC_DIR}) does not exist."
fi