-
Notifications
You must be signed in to change notification settings - Fork 2
/
install
executable file
·64 lines (56 loc) · 1.89 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh -e
# TODO: make this interactive rather than automatically installing stuff
: ${AIRSTACK_HOME:=~/.airstack}
: ${AIRSTACK_BIN:=/usr/local/bin/airstack}
install_bootstrap() {
local pkg_name; pkg_name=bootstrap
mkdir -vp $AIRSTACK_HOME/package/airstack
cd $AIRSTACK_HOME/package/airstack
test -d $pkg_name/.git && git -C ./$pkg_name pull \
|| git clone https://github.com/airstack/$pkg_name.git
}
install_cli() {
local pkg_name; pkg_name=cli
mkdir -vp $AIRSTACK_HOME/package/airstack
cd $AIRSTACK_HOME/package/airstack
test -d $pkg_name/.git && git -C ./$pkg_name pull \
|| git clone https://github.com/airstack/$pkg_name.git
cd $pkg_name
../../nodejs/node/bin/npm install
#TODO backup if exists
ln -sf $AIRSTACK_HOME/package/airstack/cli/bin/airstack $AIRSTACK_BIN
}
install_node() {
mkdir -vp $AIRSTACK_HOME/package/nodejs
cd $AIRSTACK_HOME/package/nodejs
local pkg_name; pkg_name="node-v0.11.14-darwin-x64.tar.gz"
local dir_name; dir_name=`basename -s .tar.gz $pkg_name`
test -d $dir_name && rm -rf $dir_name
test -e $pkg_name && rm -f $pkg_name
curl -SLo $pkg_name http://nodejs.org/dist/v0.11.14/$pkg_name
# TODO: verify sha256sum 074669d2f3d8419496076c55c2743389538996a90e87277ea5bf032f885877ad
tar -xzf $pkg_name
ln -sf $dir_name node
rm $pkg_name
}
install_terraform() {
mkdir -vp $AIRSTACK_HOME/package/terraform
cd $AIRSTACK_HOME/package/terraform
local pkg_name; pkg_name="terraform_0.2.2_darwin_amd64.zip"
local dir_name; dir_name=`basename -s .zip $pkg_name`
test -d $dir_name && rm -rf $dir_name
test -e $pkg_name && rm -f $pkg_name
curl -SLo $pkg_name https://dl.bintray.com/mitchellh/terraform/$pkg_name
unzip -d $dir_name $pkg_name
ln -sf $dir_name terraform
rm $pkg_name
}
main() {
install_node
install_terraform
install_bootstrap
install_cli
printf "\n\n[SUCCESS] installed to $AIRSTACK_HOME\n"
which airstack
}
main