-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathblitzgce.sh
131 lines (117 loc) · 3.37 KB
/
blitzgce.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
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
#!/bin/bash
#
# Title: PGBlitz (Reference Title File)
# Author(s): Admin9705 - Deiteq
# URL: https://pgblitz.com - http://github.pgblitz.com
# GNU: General Public License v3.0
################################################################################
source /opt/blitzgce/functions/main.sh
source /opt/blitzgce/functions/interface.sh
source /opt/blitzgce/functions/ip.sh
source /opt/blitzgce/functions/deploy.sh
source /opt/blitzgce/functions/destroy.sh
### the primary interface for GCE
gcestart() {
### call key variables ~ /functions/main.sh
variablepull
### For New Installs; hangs because of no account logged in yet; this prevents
othercheck=$(cat /var/plexguide/project.account)
secondcheck=$(cat /var/plexguide/project.id)
if [[ "$othercheck" != "NOT-SET" ]]; then
if [[ "$secondcheck" != "NOT-SET" ]]; then
servercheck
else
projectid=NOT-SET
gcedeployedcheck=NOT-SET
fi
else
account=NOT-SET
projectid=NOT-SET
gcedeployedcheck=NOT-SET
fi
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🌎 PG GCE Deployment
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. Log Into the Account : $account
2. Project Interface : $projectid
3. Processor Count : $processor
4. Ram Count : $ramcount
5. NVME Count : $nvmecount
6. Set IP Region / Server: $ipaddress [$ipregion]
7. Deploy GCE Server : $gcedeployedcheck
8. SSH into the GCE Box
a. Destroy Server
z. Exit
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
read -p 'Type Number | Press [ENTER]: ' typed </dev/tty
case $typed in
1)
echo ""
gcloud auth login --no-launch-browser --verbosity error --quiet
echo "NOT-SET" >/var/plexguide/project.id
echo "on" >/var/plexguide/project.switch
### note --no-user-output-enabled | gcloud auth login --enable-gdrive-access --brief
# gcloud config configurations list
gcestart
;;
2)
projectinterface
gcestart
;;
3)
projectdeny
processorcount
gcestart
;;
4)
projectdeny
ramcount
gcestart
;;
5)
projectdeny
nvmecount
gcestart
;;
6)
projectdeny
regioncenter
gcestart
;;
7)
projectdeny
deployserver
gcestart
;;
8)
projectdeny
if [[ "$gcedeployedcheck" == "DEPLOYED" ]]; then
sshdeploy
else
gcestart
fi
;;
A)
projectdeny
destroyserver
gcestart
;;
a)
projectdeny
destroyserver
gcestart
;;
z)
exit
;;
Z)
exit
;;
*)
gcestart
;;
esac
}
gcestart