From abf073af3863f753ecc7e920aa19d3bfe745fc47 Mon Sep 17 00:00:00 2001 From: Alex Meng Date: Wed, 27 Jun 2018 05:22:52 -0600 Subject: [PATCH] Install from latest release instead of master (#133) Add argument to install script to specify release --- install.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index f07b464..df120d7 100755 --- a/install.sh +++ b/install.sh @@ -2,7 +2,7 @@ show_help() { cat << EOF -Usage: ${0##*/} [-hv] [-a ARN] [-i GROUP,GROUP,...] [-l GROUP,GROUP,...] [-s GROUP] [-p PROGRAM] [-u "ARGUMENTS"] +Usage: ${0##*/} [-hv] [-a ARN] [-i GROUP,GROUP,...] [-l GROUP,GROUP,...] [-s GROUP] [-p PROGRAM] [-u "ARGUMENTS"] [-r RELEASE] Install import_users.sh and authorized_key_commands. -h display this help and exit @@ -23,6 +23,9 @@ Install import_users.sh and authorized_key_commands. Defaults to '/usr/sbin/useradd' -u "useradd args" Specify arguments to use with useradd. Defaults to '--create-home --shell /bin/bash' + -r release Specify a release of aws-ec2-ssh to download from GitHub. This argument is + passed to \`git clone -b\` and so works with branches and tags. + Defaults to 'master' EOF @@ -39,8 +42,9 @@ LOCAL_GROUPS="" ASSUME_ROLE="" USERADD_PROGRAM="" USERADD_ARGS="" +RELEASE="master" -while getopts :hva:i:l:s: opt +while getopts :hva:i:l:s:p:u:r: opt do case $opt in h) @@ -68,6 +72,9 @@ do u) USERADD_ARGS="$OPTARG" ;; + r) + RELEASE="$OPTARG" + ;; \?) echo "Invalid option: -$OPTARG" >&2 show_help @@ -97,7 +104,7 @@ tmpdir=$(mktemp -d) cd "$tmpdir" -git clone -b master https://github.com/widdix/aws-ec2-ssh.git +git clone -b "$RELEASE" https://github.com/widdix/aws-ec2-ssh.git cd "$tmpdir/aws-ec2-ssh"