xref: /openssh-portable/.github/setup_ci.sh (revision ac112ade)
1#!/usr/bin/env bash
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
21for TARGET in $TARGETS; do
22    case $TARGET in
23    ""|--without-openssl|--without-zlib)
24        # nothing to do
25        ;;
26    "--with-kerberos5")
27        PACKAGES="$PACKAGES heimdal-dev"
28        #PACKAGES="$PACKAGES libkrb5-dev"
29        ;;
30    "--with-libedit")
31        PACKAGES="$PACKAGES libedit-dev"
32        ;;
33    "--with-pam")
34        PACKAGES="$PACKAGES libpam0g-dev"
35        ;;
36    "--with-security-key-builtin")
37        INSTALL_FIDO_PPA="yes"
38        PACKAGES="$PACKAGES libfido2-dev libu2f-host-dev"
39        ;;
40    "--with-selinux")
41        PACKAGES="$PACKAGES libselinux1-dev selinux-policy-dev"
42        ;;
43    "--with-ldflags=-lhardened_malloc")
44        INSTALL_HARDENED_MALLOC=yes
45       ;;
46    *) echo "Invalid option '${TARGET}'"
47        exit 1
48        ;;
49    esac
50done
51
52if [ "yes" == "$INSTALL_FIDO_PPA" ]; then
53    sudo apt update -qq
54    sudo apt install software-properties-common
55    sudo apt-add-repository ppa:yubico/stable
56fi
57
58if [ "x" != "x$PACKAGES" ]; then
59    sudo apt update -qq
60    sudo apt install -qy $PACKAGES
61fi
62
63if [ "${INSTALL_HARDENED_MALLOC}" = "yes" ]; then
64    (cd ${HOME} &&
65     git clone https://github.com/GrapheneOS/hardened_malloc.git &&
66     cd ${HOME}/hardened_malloc &&
67     make && sudo cp libhardened_malloc.so /usr/lib/)
68fi
69