xref: /openssh-portable/.github/setup_ci.sh (revision 9f79e80d)
1e3ba6574SDarren Tucker#!/bin/sh
29499f2bbSStefan Schindler
3c3366443SDarren Tuckercase $(./config.guess) in
4c3366443SDarren Tucker*-darwin*)
5ac112adeSDarren Tucker	brew install automake
6c3366443SDarren Tucker	exit 0
7c3366443SDarren Tucker	;;
8c3366443SDarren Tuckeresac
9c3366443SDarren Tucker
109499f2bbSStefan SchindlerTARGETS=$@
119499f2bbSStefan Schindler
129499f2bbSStefan SchindlerPACKAGES=""
139499f2bbSStefan SchindlerINSTALL_FIDO_PPA="no"
149499f2bbSStefan Schindler
159499f2bbSStefan Schindler#echo "Setting up for '$TARGETS'"
169499f2bbSStefan Schindler
179499f2bbSStefan Schindlerset -ex
189499f2bbSStefan Schindler
199499f2bbSStefan Schindlerlsb_release -a
209499f2bbSStefan Schindler
2109f4b846SDarren Tuckerif [ "${TARGETS}" = "kitchensink" ]; then
2209f4b846SDarren Tucker	TARGETS="kerberos5 libedit pam sk selinux"
2309f4b846SDarren Tuckerfi
2409f4b846SDarren Tucker
259499f2bbSStefan Schindlerfor TARGET in $TARGETS; do
269499f2bbSStefan Schindler    case $TARGET in
2733f62dfbSDarren Tucker    default|without-openssl|without-zlib|c89)
289499f2bbSStefan Schindler        # nothing to do
299499f2bbSStefan Schindler        ;;
3009f4b846SDarren Tucker    kerberos5)
319499f2bbSStefan Schindler        PACKAGES="$PACKAGES heimdal-dev"
329499f2bbSStefan Schindler        #PACKAGES="$PACKAGES libkrb5-dev"
339499f2bbSStefan Schindler        ;;
3409f4b846SDarren Tucker    libedit)
359499f2bbSStefan Schindler        PACKAGES="$PACKAGES libedit-dev"
369499f2bbSStefan Schindler        ;;
3709f4b846SDarren Tucker    *pam)
389499f2bbSStefan Schindler        PACKAGES="$PACKAGES libpam0g-dev"
399499f2bbSStefan Schindler        ;;
4009f4b846SDarren Tucker    sk)
419499f2bbSStefan Schindler        INSTALL_FIDO_PPA="yes"
42b3ca08cbSDarren Tucker        PACKAGES="$PACKAGES libfido2-dev libu2f-host-dev libcbor-dev"
439499f2bbSStefan Schindler        ;;
4409f4b846SDarren Tucker    selinux)
459499f2bbSStefan Schindler        PACKAGES="$PACKAGES libselinux1-dev selinux-policy-dev"
469499f2bbSStefan Schindler        ;;
4709f4b846SDarren Tucker    hardenedmalloc)
48b744914fSDarren Tucker        INSTALL_HARDENED_MALLOC=yes
49b744914fSDarren Tucker       ;;
50da9d59f5SDarren Tucker    openssl-noec)
51da9d59f5SDarren Tucker	INSTALL_OPENSSL=OpenSSL_1_1_1k
52da9d59f5SDarren Tucker	SSLCONFOPTS="no-ec"
53da9d59f5SDarren Tucker	;;
54095b0307SDarren Tucker    openssl-*)
55095b0307SDarren Tucker        INSTALL_OPENSSL=$(echo ${TARGET} | cut -f2 -d-)
56095b0307SDarren Tucker        case ${INSTALL_OPENSSL} in
57095b0307SDarren Tucker          1.*)	INSTALL_OPENSSL="OpenSSL_$(echo ${INSTALL_OPENSSL} | tr . _)" ;;
58095b0307SDarren Tucker          3.*)	INSTALL_OPENSSL="openssl-${INSTALL_OPENSSL}" ;;
59095b0307SDarren Tucker        esac
60a38016d3SDarren Tucker        PACKAGES="${PACKAGES} putty-tools"
6166dd9ddbSDarren Tucker       ;;
62095b0307SDarren Tucker    libressl-*)
63095b0307SDarren Tucker        INSTALL_LIBRESSL=$(echo ${TARGET} | cut -f2 -d-)
64095b0307SDarren Tucker        case ${INSTALL_LIBRESSL} in
65095b0307SDarren Tucker          master) ;;
66095b0307SDarren Tucker          *) INSTALL_LIBRESSL="v$(echo ${TARGET} | cut -f2 -d-)" ;;
67095b0307SDarren Tucker        esac
68a38016d3SDarren Tucker        PACKAGES="${PACKAGES} putty-tools"
6966dd9ddbSDarren Tucker       ;;
70ffcdd3d9SDarren Tucker    valgrind*)
7141d232e2SDarren Tucker       PACKAGES="$PACKAGES valgrind"
7241d232e2SDarren Tucker       ;;
73b744914fSDarren Tucker    *) echo "Invalid option '${TARGET}'"
749499f2bbSStefan Schindler        exit 1
759499f2bbSStefan Schindler        ;;
769499f2bbSStefan Schindler    esac
779499f2bbSStefan Schindlerdone
789499f2bbSStefan Schindler
793737c9f6SDarren Tuckerif [ "yes" = "$INSTALL_FIDO_PPA" ]; then
809499f2bbSStefan Schindler    sudo apt update -qq
819499f2bbSStefan Schindler    sudo apt install software-properties-common
829499f2bbSStefan Schindler    sudo apt-add-repository ppa:yubico/stable
839499f2bbSStefan Schindlerfi
849499f2bbSStefan Schindler
859499f2bbSStefan Schindlerif [ "x" != "x$PACKAGES" ]; then
869499f2bbSStefan Schindler    sudo apt update -qq
879499f2bbSStefan Schindler    sudo apt install -qy $PACKAGES
889499f2bbSStefan Schindlerfi
89b744914fSDarren Tucker
90b744914fSDarren Tuckerif [ "${INSTALL_HARDENED_MALLOC}" = "yes" ]; then
91b744914fSDarren Tucker    (cd ${HOME} &&
92b744914fSDarren Tucker     git clone https://github.com/GrapheneOS/hardened_malloc.git &&
93b744914fSDarren Tucker     cd ${HOME}/hardened_malloc &&
943d59e88cSDarren Tucker     make -j2 && sudo cp libhardened_malloc.so /usr/lib/)
95b744914fSDarren Tuckerfi
9666dd9ddbSDarren Tucker
97095b0307SDarren Tuckerif [ ! -z "${INSTALL_OPENSSL}" ]; then
9866dd9ddbSDarren Tucker    (cd ${HOME} &&
9966dd9ddbSDarren Tucker     git clone https://github.com/openssl/openssl.git &&
10066dd9ddbSDarren Tucker     cd ${HOME}/openssl &&
101b3cc9fbdSDarren Tucker     git checkout ${INSTALL_OPENSSL} &&
102*9f79e80dSDarren Tucker     ./config no-threads shared ${SSLCONFOPTS} \
103b3cc9fbdSDarren Tucker         --prefix=/opt/openssl &&
104b3cc9fbdSDarren Tucker     make && sudo make install_sw)
10566dd9ddbSDarren Tuckerfi
10666dd9ddbSDarren Tucker
107095b0307SDarren Tuckerif [ ! -z "${INSTALL_LIBRESSL}" ]; then
10866dd9ddbSDarren Tucker    (mkdir -p ${HOME}/libressl && cd ${HOME}/libressl &&
10966dd9ddbSDarren Tucker     git clone https://github.com/libressl-portable/portable.git &&
110095b0307SDarren Tucker     cd ${HOME}/libressl/portable &&
111095b0307SDarren Tucker     git checkout ${INSTALL_LIBRESSL} &&
112095b0307SDarren Tucker     sh update.sh && sh autogen.sh &&
113b3cc9fbdSDarren Tucker     ./configure --prefix=/opt/libressl &&
114095b0307SDarren Tucker     make -j2 && sudo make install)
11566dd9ddbSDarren Tuckerfi
116