2021-04-23 04:53:32 +00:00
|
|
|
#!/bin/sh
|
2020-08-05 17:00:52 +00:00
|
|
|
|
2022-08-26 06:26:06 +00:00
|
|
|
PACKAGES=""
|
|
|
|
|
2021-10-22 03:00:05 +00:00
|
|
|
. .github/configs $@
|
|
|
|
|
2021-09-29 09:30:59 +00:00
|
|
|
case "`./config.guess`" in
|
2022-08-12 05:08:47 +00:00
|
|
|
*cygwin)
|
2022-08-26 06:26:06 +00:00
|
|
|
PACKAGER=setup
|
2023-02-25 03:43:28 +00:00
|
|
|
echo Setting CYGWIN system environment variable.
|
2022-08-12 05:08:47 +00:00
|
|
|
setx CYGWIN "binmode"
|
2023-02-25 03:43:28 +00:00
|
|
|
echo Removing extended ACLs so umask works as expected.
|
|
|
|
setfacl -b . regress
|
2022-08-26 06:26:06 +00:00
|
|
|
PACKAGES="$PACKAGES,autoconf,automake,cygwin-devel,gcc-core"
|
|
|
|
PACKAGES="$PACKAGES,make,openssl-devel,zlib-devel"
|
2022-08-12 05:08:47 +00:00
|
|
|
;;
|
2021-01-08 03:26:32 +00:00
|
|
|
*-darwin*)
|
2022-08-26 06:26:06 +00:00
|
|
|
PACKAGER=brew
|
2021-01-12 08:22:47 +00:00
|
|
|
brew install automake
|
2021-01-08 03:26:32 +00:00
|
|
|
exit 0
|
|
|
|
;;
|
2022-08-26 06:26:06 +00:00
|
|
|
*)
|
|
|
|
PACKAGER=apt
|
2021-01-08 03:26:32 +00:00
|
|
|
esac
|
|
|
|
|
2020-08-05 17:00:52 +00:00
|
|
|
TARGETS=$@
|
|
|
|
|
|
|
|
INSTALL_FIDO_PPA="no"
|
2021-09-23 21:03:18 +00:00
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
2020-08-05 17:00:52 +00:00
|
|
|
|
|
|
|
#echo "Setting up for '$TARGETS'"
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
2022-08-18 11:36:39 +00:00
|
|
|
if [ -x "`which lsb_release 2>&1`" ]; then
|
|
|
|
lsb_release -a
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Ubuntu 22.04 defaults to private home dirs which prevent the
|
|
|
|
# agent-getpeerid test from running ssh-add as nobody. See
|
|
|
|
# https://github.com/actions/runner-images/issues/6106
|
|
|
|
if [ ! -z "$SUDO" ] && ! "$SUDO" -u nobody test -x ~; then
|
|
|
|
echo ~ is not executable by nobody, adding perms.
|
|
|
|
chmod go+x ~
|
|
|
|
fi
|
2020-08-05 17:00:52 +00:00
|
|
|
|
2021-02-17 07:41:30 +00:00
|
|
|
if [ "${TARGETS}" = "kitchensink" ]; then
|
2021-10-22 12:27:41 +00:00
|
|
|
TARGETS="krb5 libedit pam sk selinux"
|
2021-02-17 07:41:30 +00:00
|
|
|
fi
|
|
|
|
|
2021-10-21 22:42:14 +00:00
|
|
|
for flag in $CONFIGFLAGS; do
|
|
|
|
case "$flag" in
|
2022-08-26 06:26:06 +00:00
|
|
|
--with-pam) TARGETS="${TARGETS} pam" ;;
|
|
|
|
--with-libedit) TARGETS="${TARGETS} libedit" ;;
|
2021-10-21 22:42:14 +00:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2020-08-05 17:00:52 +00:00
|
|
|
for TARGET in $TARGETS; do
|
|
|
|
case $TARGET in
|
2022-08-26 06:26:06 +00:00
|
|
|
default|without-openssl|without-zlib|c89)
|
2020-08-05 17:00:52 +00:00
|
|
|
# nothing to do
|
|
|
|
;;
|
2022-07-03 11:46:44 +00:00
|
|
|
clang-sanitize*)
|
|
|
|
PACKAGES="$PACKAGES clang-12"
|
|
|
|
;;
|
2022-08-26 06:26:06 +00:00
|
|
|
cygwin-release)
|
2022-08-27 11:49:27 +00:00
|
|
|
PACKAGES="$PACKAGES libcrypt-devel libfido2-devel libkrb5-devel"
|
2022-08-26 06:26:06 +00:00
|
|
|
;;
|
2022-07-05 06:23:28 +00:00
|
|
|
gcc-sanitize*)
|
|
|
|
;;
|
2021-09-29 01:36:13 +00:00
|
|
|
clang-*|gcc-*)
|
2021-10-21 05:53:39 +00:00
|
|
|
compiler=$(echo $TARGET | sed 's/-Werror//')
|
2021-10-21 04:33:27 +00:00
|
|
|
PACKAGES="$PACKAGES $compiler"
|
2021-09-29 01:36:13 +00:00
|
|
|
;;
|
2021-10-22 11:54:33 +00:00
|
|
|
krb5)
|
|
|
|
PACKAGES="$PACKAGES libkrb5-dev"
|
|
|
|
;;
|
|
|
|
heimdal)
|
2020-08-05 17:00:52 +00:00
|
|
|
PACKAGES="$PACKAGES heimdal-dev"
|
|
|
|
;;
|
2022-08-26 06:26:06 +00:00
|
|
|
libedit)
|
|
|
|
case "$PACKAGER" in
|
|
|
|
setup) PACKAGES="$PACKAGES libedit-devel" ;;
|
|
|
|
apt) PACKAGES="$PACKAGES libedit-dev" ;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
*pam)
|
|
|
|
PACKAGES="$PACKAGES libpam0g-dev"
|
|
|
|
;;
|
2021-02-17 07:41:30 +00:00
|
|
|
sk)
|
2020-08-05 17:00:52 +00:00
|
|
|
INSTALL_FIDO_PPA="yes"
|
2021-04-05 13:46:42 +00:00
|
|
|
PACKAGES="$PACKAGES libfido2-dev libu2f-host-dev libcbor-dev"
|
2020-08-05 17:00:52 +00:00
|
|
|
;;
|
2021-02-17 07:41:30 +00:00
|
|
|
selinux)
|
2020-08-05 17:00:52 +00:00
|
|
|
PACKAGES="$PACKAGES libselinux1-dev selinux-policy-dev"
|
|
|
|
;;
|
2021-02-17 07:41:30 +00:00
|
|
|
hardenedmalloc)
|
2021-01-08 13:36:05 +00:00
|
|
|
INSTALL_HARDENED_MALLOC=yes
|
2021-10-12 11:55:51 +00:00
|
|
|
;;
|
2022-02-18 01:12:21 +00:00
|
|
|
musl)
|
|
|
|
PACKAGES="$PACKAGES musl-tools"
|
|
|
|
;;
|
2021-10-12 11:55:51 +00:00
|
|
|
tcmalloc)
|
|
|
|
PACKAGES="$PACKAGES libgoogle-perftools-dev"
|
|
|
|
;;
|
2021-04-26 05:34:23 +00:00
|
|
|
openssl-noec)
|
|
|
|
INSTALL_OPENSSL=OpenSSL_1_1_1k
|
|
|
|
SSLCONFOPTS="no-ec"
|
|
|
|
;;
|
2021-04-26 04:02:03 +00:00
|
|
|
openssl-*)
|
|
|
|
INSTALL_OPENSSL=$(echo ${TARGET} | cut -f2 -d-)
|
|
|
|
case ${INSTALL_OPENSSL} in
|
2021-09-08 11:09:49 +00:00
|
|
|
1.1.1_stable) INSTALL_OPENSSL="OpenSSL_1_1_1-stable" ;;
|
2021-04-26 04:02:03 +00:00
|
|
|
1.*) INSTALL_OPENSSL="OpenSSL_$(echo ${INSTALL_OPENSSL} | tr . _)" ;;
|
|
|
|
3.*) INSTALL_OPENSSL="openssl-${INSTALL_OPENSSL}" ;;
|
|
|
|
esac
|
2021-04-26 04:29:03 +00:00
|
|
|
PACKAGES="${PACKAGES} putty-tools"
|
2021-01-28 03:31:01 +00:00
|
|
|
;;
|
2021-04-26 04:02:03 +00:00
|
|
|
libressl-*)
|
|
|
|
INSTALL_LIBRESSL=$(echo ${TARGET} | cut -f2 -d-)
|
|
|
|
case ${INSTALL_LIBRESSL} in
|
|
|
|
master) ;;
|
2022-03-26 11:01:31 +00:00
|
|
|
*) INSTALL_LIBRESSL="$(echo ${TARGET} | cut -f2 -d-)" ;;
|
2021-04-26 04:02:03 +00:00
|
|
|
esac
|
2021-04-26 04:29:03 +00:00
|
|
|
PACKAGES="${PACKAGES} putty-tools"
|
2021-01-28 03:31:01 +00:00
|
|
|
;;
|
2023-03-24 04:02:52 +00:00
|
|
|
boringssl)
|
|
|
|
INSTALL_BORINGSSL=1
|
|
|
|
PACKAGES="${PACKAGES} cmake ninja-build"
|
|
|
|
;;
|
2021-02-21 21:09:27 +00:00
|
|
|
valgrind*)
|
2021-02-18 23:16:56 +00:00
|
|
|
PACKAGES="$PACKAGES valgrind"
|
|
|
|
;;
|
2021-01-08 13:36:05 +00:00
|
|
|
*) echo "Invalid option '${TARGET}'"
|
2020-08-05 17:00:52 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2021-04-23 09:49:46 +00:00
|
|
|
if [ "yes" = "$INSTALL_FIDO_PPA" ]; then
|
2020-08-05 17:00:52 +00:00
|
|
|
sudo apt update -qq
|
2021-09-23 21:03:18 +00:00
|
|
|
sudo apt install -qy software-properties-common
|
|
|
|
sudo apt-add-repository -y ppa:yubico/stable
|
2020-08-05 17:00:52 +00:00
|
|
|
fi
|
|
|
|
|
2023-01-13 12:02:34 +00:00
|
|
|
tries=3
|
|
|
|
while [ ! -z "$PACKAGES" ] && [ "$tries" -gt "0" ]; do
|
2022-08-26 06:26:06 +00:00
|
|
|
case "$PACKAGER" in
|
|
|
|
apt)
|
|
|
|
sudo apt update -qq
|
2023-01-13 12:02:34 +00:00
|
|
|
if sudo apt install -qy $PACKAGES; then
|
|
|
|
PACKAGES=""
|
|
|
|
fi
|
2022-08-26 06:26:06 +00:00
|
|
|
;;
|
|
|
|
setup)
|
2023-01-13 12:02:34 +00:00
|
|
|
if /cygdrive/c/setup.exe -q -P `echo "$PACKAGES" | tr ' ' ,`; then
|
|
|
|
PACKAGES=""
|
|
|
|
fi
|
2022-08-26 06:26:06 +00:00
|
|
|
;;
|
|
|
|
esac
|
2023-01-13 12:02:34 +00:00
|
|
|
if [ ! -z "$PACKAGES" ]; then
|
|
|
|
sleep 90
|
|
|
|
fi
|
|
|
|
tries=$(($tries - 1))
|
|
|
|
done
|
|
|
|
if [ ! -z "$PACKAGES" ]; then
|
|
|
|
echo "Package installation failed."
|
|
|
|
exit 1
|
2020-08-05 17:00:52 +00:00
|
|
|
fi
|
2021-01-08 13:36:05 +00:00
|
|
|
|
|
|
|
if [ "${INSTALL_HARDENED_MALLOC}" = "yes" ]; then
|
|
|
|
(cd ${HOME} &&
|
|
|
|
git clone https://github.com/GrapheneOS/hardened_malloc.git &&
|
|
|
|
cd ${HOME}/hardened_malloc &&
|
2022-01-11 09:56:01 +00:00
|
|
|
make -j2 && sudo cp out/libhardened_malloc.so /usr/lib/)
|
2021-01-08 13:36:05 +00:00
|
|
|
fi
|
2021-01-28 03:31:01 +00:00
|
|
|
|
2021-04-26 04:02:03 +00:00
|
|
|
if [ ! -z "${INSTALL_OPENSSL}" ]; then
|
2021-01-28 03:31:01 +00:00
|
|
|
(cd ${HOME} &&
|
|
|
|
git clone https://github.com/openssl/openssl.git &&
|
|
|
|
cd ${HOME}/openssl &&
|
2021-04-26 23:18:02 +00:00
|
|
|
git checkout ${INSTALL_OPENSSL} &&
|
2021-04-27 02:24:10 +00:00
|
|
|
./config no-threads shared ${SSLCONFOPTS} \
|
2021-04-26 23:18:02 +00:00
|
|
|
--prefix=/opt/openssl &&
|
|
|
|
make && sudo make install_sw)
|
2021-01-28 03:31:01 +00:00
|
|
|
fi
|
|
|
|
|
2021-04-26 04:02:03 +00:00
|
|
|
if [ ! -z "${INSTALL_LIBRESSL}" ]; then
|
2022-03-26 05:28:04 +00:00
|
|
|
if [ "${INSTALL_LIBRESSL}" = "master" ]; then
|
|
|
|
(mkdir -p ${HOME}/libressl && cd ${HOME}/libressl &&
|
|
|
|
git clone https://github.com/libressl-portable/portable.git &&
|
|
|
|
cd ${HOME}/libressl/portable &&
|
|
|
|
git checkout ${INSTALL_LIBRESSL} &&
|
|
|
|
sh update.sh && sh autogen.sh &&
|
|
|
|
./configure --prefix=/opt/libressl &&
|
|
|
|
make -j2 && sudo make install)
|
|
|
|
else
|
2022-03-26 11:01:31 +00:00
|
|
|
LIBRESSL_URLBASE=https://cdn.openbsd.org/pub/OpenBSD/LibreSSL
|
2022-03-26 05:28:04 +00:00
|
|
|
(cd ${HOME} &&
|
|
|
|
wget ${LIBRESSL_URLBASE}/libressl-${INSTALL_LIBRESSL}.tar.gz &&
|
|
|
|
tar xfz libressl-${INSTALL_LIBRESSL}.tar.gz &&
|
|
|
|
cd libressl-${INSTALL_LIBRESSL} &&
|
|
|
|
./configure --prefix=/opt/libressl && make -j2 && sudo make install)
|
|
|
|
fi
|
2021-01-28 03:31:01 +00:00
|
|
|
fi
|
2023-03-24 04:02:52 +00:00
|
|
|
|
|
|
|
if [ ! -z "${INSTALL_BORINGSSL}" ]; then
|
|
|
|
(cd ${HOME} && git clone https://boringssl.googlesource.com/boringssl &&
|
|
|
|
cd ${HOME}/boringssl && mkdir build && cd build &&
|
|
|
|
cmake -GNinja -DCMAKE_POSITION_INDEPENDENT_CODE=ON .. && ninja &&
|
|
|
|
mkdir -p /opt/boringssl/lib &&
|
|
|
|
cp ${HOME}/boringssl/build/crypto/libcrypto.a /opt/boringssl/lib &&
|
|
|
|
cp -r ${HOME}/boringssl/include /opt/boringssl)
|
|
|
|
fi
|