From d9c26c307c1cbfc0582ca6d1ac9c8fbc707aa823 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 5 Oct 2017 21:57:18 -0700 Subject: [PATCH] install-aws-server: Improve handling of various corner cases. This script is pretty far from being polished, but it is useful, so we might as well make it a bit more robust. --- tools/setup/install-aws-server | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/tools/setup/install-aws-server b/tools/setup/install-aws-server index a56f2ace2e..0ea780ada5 100755 --- a/tools/setup/install-aws-server +++ b/tools/setup/install-aws-server @@ -52,7 +52,7 @@ if [ -z "$branch" ]; then branch=$(crudini --get "$zulip_ssh_config_file" repo default_branch) fi -VIRTUALENV_NEEDED=$(if $(echo "$type" | grep -q ::app); then echo -n yes; else echo -n no; fi) +VIRTUALENV_NEEDED=$(if $(echo "$type" | grep -q app_frontend); then echo -n yes; else echo -n no; fi) # Force RSA keys. We do this because the ECDSA key is not printed on syslog, # and our puppet configuration does not use ECDSA. If we don't do this, @@ -64,7 +64,13 @@ set +e ssh "${SSH_OPTS[@]}" "$server" -t -i "$amazon_key_file" -lubuntu -o "ControlMaster=no" < /etc/hostname +hostname "$hostname" +sed -i 's/localhost$/localhost $hostname/' /etc/hosts EOF set -e @@ -78,25 +84,29 @@ if [ -e "$zulipconf_file" ]; then fi ssh "${SSH_OPTS[@]}" "$server" -t -i "$amazon_key_file" -lroot < /etc/hostname -sed -i 's/localhost$/localhost $hostname/' /etc/hosts - apt-get update apt-get -y upgrade cd "$(mktemp -d)" + +# Get GitHub known_hosts setup +# TODO: Replace this with hardcoding the actual GitHub keys +ssh -oStrictHostKeyChecking=no git@github.com /dev/null || true + if ! [ -e "zulip" ]; then # need to install git to clone the repo apt-get install -y git crudini - git clone $zulip_repo + git clone "$zulip_repo" zulip fi cd zulip git fetch