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