1#!/bin/sh 2 3case $(./config.guess) in 4*-darwin*) 5 brew install automake 6 exit 0 7 ;; 8esac 9 10TARGETS=$@ 11 12PACKAGES="" 13INSTALL_FIDO_PPA="no" 14export DEBIAN_FRONTEND=noninteractive 15 16#echo "Setting up for '$TARGETS'" 17 18set -ex 19 20lsb_release -a 21 22if [ "${TARGETS}" = "kitchensink" ]; then 23 TARGETS="kerberos5 libedit pam sk selinux" 24fi 25 26for TARGET in $TARGETS; do 27 case $TARGET in 28 default|without-openssl|without-zlib|c89) 29 # nothing to do 30 ;; 31 kerberos5) 32 PACKAGES="$PACKAGES heimdal-dev" 33 #PACKAGES="$PACKAGES libkrb5-dev" 34 ;; 35 libedit) 36 PACKAGES="$PACKAGES libedit-dev" 37 ;; 38 *pam) 39 PACKAGES="$PACKAGES libpam0g-dev" 40 ;; 41 sk) 42 INSTALL_FIDO_PPA="yes" 43 PACKAGES="$PACKAGES libfido2-dev libu2f-host-dev libcbor-dev" 44 ;; 45 selinux) 46 PACKAGES="$PACKAGES libselinux1-dev selinux-policy-dev" 47 ;; 48 hardenedmalloc) 49 INSTALL_HARDENED_MALLOC=yes 50 ;; 51 openssl-noec) 52 INSTALL_OPENSSL=OpenSSL_1_1_1k 53 SSLCONFOPTS="no-ec" 54 ;; 55 openssl-*) 56 INSTALL_OPENSSL=$(echo ${TARGET} | cut -f2 -d-) 57 case ${INSTALL_OPENSSL} in 58 1.1.1_stable) INSTALL_OPENSSL="OpenSSL_1_1_1-stable" ;; 59 1.*) INSTALL_OPENSSL="OpenSSL_$(echo ${INSTALL_OPENSSL} | tr . _)" ;; 60 3.*) INSTALL_OPENSSL="openssl-${INSTALL_OPENSSL}" ;; 61 esac 62 PACKAGES="${PACKAGES} putty-tools" 63 ;; 64 libressl-*) 65 INSTALL_LIBRESSL=$(echo ${TARGET} | cut -f2 -d-) 66 case ${INSTALL_LIBRESSL} in 67 master) ;; 68 *) INSTALL_LIBRESSL="v$(echo ${TARGET} | cut -f2 -d-)" ;; 69 esac 70 PACKAGES="${PACKAGES} putty-tools" 71 ;; 72 valgrind*) 73 PACKAGES="$PACKAGES valgrind" 74 ;; 75 *) echo "Invalid option '${TARGET}'" 76 exit 1 77 ;; 78 esac 79done 80 81if [ "yes" = "$INSTALL_FIDO_PPA" ]; then 82 sudo apt update -qq 83 sudo apt install -qy software-properties-common 84 sudo apt-add-repository -y ppa:yubico/stable 85fi 86 87if [ "x" != "x$PACKAGES" ]; then 88 sudo apt update -qq 89 sudo apt install -qy $PACKAGES 90fi 91 92if [ "${INSTALL_HARDENED_MALLOC}" = "yes" ]; then 93 (cd ${HOME} && 94 git clone https://github.com/GrapheneOS/hardened_malloc.git && 95 cd ${HOME}/hardened_malloc && 96 make -j2 && sudo cp libhardened_malloc.so /usr/lib/) 97fi 98 99if [ ! -z "${INSTALL_OPENSSL}" ]; then 100 (cd ${HOME} && 101 git clone https://github.com/openssl/openssl.git && 102 cd ${HOME}/openssl && 103 git checkout ${INSTALL_OPENSSL} && 104 ./config no-threads shared ${SSLCONFOPTS} \ 105 --prefix=/opt/openssl && 106 make && sudo make install_sw) 107fi 108 109if [ ! -z "${INSTALL_LIBRESSL}" ]; then 110 (mkdir -p ${HOME}/libressl && cd ${HOME}/libressl && 111 git clone https://github.com/libressl-portable/portable.git && 112 cd ${HOME}/libressl/portable && 113 git checkout ${INSTALL_LIBRESSL} && 114 sh update.sh && sh autogen.sh && 115 ./configure --prefix=/opt/libressl && 116 make -j2 && sudo make install) 117fi 118