-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions_local.sh
96 lines (75 loc) · 1.4 KB
/
functions_local.sh
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
PNZMANDATORY=no # No project or zone needed here
OVERRIDERPC=yes # No firewalls to access localhost
WARNTIME=0 # No need to warn about clouds
software_checks() {
# Check and override OS supplied on CLI
#
_os=`uname -s`
NEWOS=$OS
case $_os in
Linux)
which apt >/dev/null 2>&1
[ "$?" != "0" ] \
&& echo "Local Linux support only works on apt/dpkg systems" >&2 \
exit 1
;;
*)
echo "$_os not currently supported by the script"
exit 1
;;
esac
_brand=$(awk -F'\\' '{print $1}' < /etc/issue)
_type=$(echo $_brand | awk -F' ' '{print $1}')
case $_type in
Debian)
_ver=$(echo $_brand | awk -F' ' '{print $3}')
NEWOS=debian-$_ver
;;
*)
echo "$_brand not yet supported by this script"
exit 1
;;
esac
[ "$NEWOS" != "$OS" ] && echo "===> Overriding OS to $NEWOS" \
&& OS=$NEWOS
# Check sudo
#
which sudo >/dev/null 2>&1
[ "$?" != "0" ] && echo "I need sudo installed" && exit 1
sudo -v
[ "$?" != "0" ] && echo "I need sudo access!" && exit 1
}
enable_compute() {
# Usage: enable_compute PROJECT
#
true
}
findosimage() {
# Usage: findosimage OS
}
create_vm() {
true
}
wait_gracefully() {
true
}
create_firewall() {
true
}
print_ssh_details() {
true
}
copy_and_exec() {
P=$1
Z=$2
H=$3
N=$4
CLI=$5
nohup sudo sh $H $CLI > /tmp/install.log 2>&1 &
}
getip() {
true
}
followlog() {
tail -f /tmp/install.log
}