Skip to content
This repository was archived by the owner on Nov 8, 2021. It is now read-only.

Commit abf073a

Browse files
AMengmichaelwittig
authored andcommitted
Install from latest release instead of master (#133)
Add argument to install script to specify release
1 parent 47786b5 commit abf073a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

install.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
show_help() {
44
cat << EOF
5-
Usage: ${0##*/} [-hv] [-a ARN] [-i GROUP,GROUP,...] [-l GROUP,GROUP,...] [-s GROUP] [-p PROGRAM] [-u "ARGUMENTS"]
5+
Usage: ${0##*/} [-hv] [-a ARN] [-i GROUP,GROUP,...] [-l GROUP,GROUP,...] [-s GROUP] [-p PROGRAM] [-u "ARGUMENTS"] [-r RELEASE]
66
Install import_users.sh and authorized_key_commands.
77
88
-h display this help and exit
@@ -23,6 +23,9 @@ Install import_users.sh and authorized_key_commands.
2323
Defaults to '/usr/sbin/useradd'
2424
-u "useradd args" Specify arguments to use with useradd.
2525
Defaults to '--create-home --shell /bin/bash'
26+
-r release Specify a release of aws-ec2-ssh to download from GitHub. This argument is
27+
passed to \`git clone -b\` and so works with branches and tags.
28+
Defaults to 'master'
2629
2730
2831
EOF
@@ -39,8 +42,9 @@ LOCAL_GROUPS=""
3942
ASSUME_ROLE=""
4043
USERADD_PROGRAM=""
4144
USERADD_ARGS=""
45+
RELEASE="master"
4246

43-
while getopts :hva:i:l:s: opt
47+
while getopts :hva:i:l:s:p:u:r: opt
4448
do
4549
case $opt in
4650
h)
@@ -68,6 +72,9 @@ do
6872
u)
6973
USERADD_ARGS="$OPTARG"
7074
;;
75+
r)
76+
RELEASE="$OPTARG"
77+
;;
7178
\?)
7279
echo "Invalid option: -$OPTARG" >&2
7380
show_help
@@ -97,7 +104,7 @@ tmpdir=$(mktemp -d)
97104

98105
cd "$tmpdir"
99106

100-
git clone -b master https://github.com/widdix/aws-ec2-ssh.git
107+
git clone -b "$RELEASE" https://github.com/widdix/aws-ec2-ssh.git
101108

102109
cd "$tmpdir/aws-ec2-ssh"
103110

0 commit comments

Comments
 (0)