-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcheck_reqs
executable file
·137 lines (117 loc) · 3.16 KB
/
check_reqs
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/sh
# Check reqs for reactionetes
errror () {
echo "-------------------------------------------------------------"
echo -e "\n \n "
echo "ERROR!!! -- "
}
# Check if a command exists
check_cmd () {
if ! type "$1" > /dev/null; then
errror
echo "$1 was not found in your path!"
echo "To proceed please install $1 to your path and try again!"
exit 1
fi
}
warrrn () {
sleep 1
echo -n "(ctrl-c now to stop if this is not what you intend)!"
sleep 1; echo -n "!"; sleep 1; echo -n "!"
sleep 1; echo -n "!"
sleep 1; echo "!"
sleep 1
}
chkdir () {
if [ ! -w $1 ] ; then
sudo mkdir -p $1
sudo chown $USER. $1
fi
if [ ! -w $1 ] ; then
errror
echo "Cannot write to $1, please check your permissions"
exit 2
fi
}
# taking some cues directly from the meteor install script
# We wrap this whole script in a function, so that we won't execute
# until the entire script is downloaded.
# That's good because it prevents our output overlapping with curl's.
# It also means that we can't run a partially downloaded script.
# We don't indent because it would be really confusing with the heredocs.
run_it () {
# Now, on to the actual installer!
## NOTE sh NOT bash. This script should be POSIX sh only, since we don't
## know what shell the user has. Debian uses 'dash' for 'sh', for
## example.
PREFIX="/usr/local"
set -e
set -u
# Let's display everything on stderr.
exec 1>&2
UNAME=$(uname)
# Check to see if it starts with MINGW.
if [ "$UNAME" = "CYGWIN_NT-10.0" ] ; then
check_cmd choco
check_cmd helm
PLATFORM="os.cygwin.x86_64"
echo "WARNING: Cygwin is not supported for this installer at this time!"
exit 1
fi
if [ "$UNAME" == "Linux" -o "$UNAME" == "Darwin" ] ; then
check_cmd make
check_cmd curl
elif [ "$UNAME" ">" "MINGW" -a "$UNAME" "<" "MINGX" ] ; then
check_cmd curl
check_cmd choco
check_cmd helm
PLATFORM="os.windows.x86_64"
else
echo " $UNAME is not a Supported OS"
echo "Sorry, this OS is not supported yet via this installer."
exit 1
fi
if [ "$UNAME" = "Darwin" ] ; then
check_cmd brew
### OSX ###
if [ "i386" != "$(uname -p)" -o "1" != "$(sysctl -n hw.cpu64bit_capable 2>/dev/null || echo 0)" ] ; then
# Can't just test uname -m = x86_64, because Snow Leopard can
# return other values.
echo "Only 64-bit Intel processors are supported at this time in OSX."
exit 1
fi
PLATFORM="os.osx.x86_64"
elif [ "$UNAME" = "Linux" ] ; then
### Linux ###
LINUX_ARCH=$(uname -m)
if [ "${LINUX_ARCH}" = "x86_64" ] ; then
PLATFORM="os.linux.x86_64"
else
echo "Unusable architecture: ${LINUX_ARCH}"
echo "Reactionetes only supports x86_64 for now."
exit 1
fi
fi
if [ "$PLATFORM" = "os.linux.x86_64" ] ; then
make -e linuxreqs
elif [ "$PLATFORM" = "os.osx.x86_64" ] ; then
make -e osxreqs
elif [ "$PLATFORM" = "os.windows.x86_64" ] ; then
make -e windowsreqs
fi
trap - EXIT
# End run it wrapper
}
chkdir /usr/local
chkdir /usr/local/bin
chkdir /etc/kubernetes
chkdir /var/lib/localkube
chkdir /var/lib/localkube/certs
check_cmd make
check_cmd mktemp
check_cmd git
check_cmd curl
check_cmd uname
check_cmd socat
check_cmd nsenter
run_it