forked from bdereims/cPodFactory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexpose_cpod.sh
executable file
·69 lines (50 loc) · 1.03 KB
/
expose_cpod.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
#!/bin/bash
#bdereims@vmware.com
# Usage : ./expose_cpod.sh TEST (not cPod-TEST)
. ./env
[ "$1" == "" ] && echo "usage: $0 <name_of_cpod>" && exit 1
#========================================================================================
DNSMASQ=/etc/dnsmasq.conf
HOSTS=/etc/hosts
mutex() {
while ! mkdir lock 2>&1 > /dev/null
do
echo "Waiting (PID $$)..."
sleep 2
done
}
de_mutex() {
rmdir lock
}
exit_gate() {
#[ -f lock ] && rm lock
exit $1
}
check_cpod() {
echo "rien"
}
affect_public_ip() {
PUBLIC_IP=$(grep "$(printf '\t')#FREE#$" public-ip | sort | awk '{print $1}' | head -1)
if [ "X${PUBLIC_IP}" == "X" ]; then
echo "There is no public IP available."
de_mutex
exit_gate 1
fi
echo "The Public cPod IP address is '${PUBLIC_IP}'."
}
expose_cpod() {
echo "rien"
}
main() {
echo "!!! Work in Progress !!!"
echo " "
CPOD=${1}
check_cpod ${CPOD}
echo "=== Exposing cPod on Internet."
mutex
affect_public_ip ${CPOD}
de_mutex
expose_cpod ${CPOD} ${NEW_TRANSIT_IP} ${PUBLIC_IP}
exit_gate 0
}
main ${1}