-
Notifications
You must be signed in to change notification settings - Fork 2
/
cleanup.sh
executable file
·79 lines (64 loc) · 1.59 KB
/
cleanup.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
#!/usr/local/bin/bash
set -e
function deleteWebServerFiles() {
THE_DIR=${WEBSERVER_WEBROOT}/${OPENSHIFT_CLUSTERNAME}
if [[ -d ${THE_DIR} ]]; then
echo "Removing web server cluster directory ${CLUSTER_DIR}"
sudo rm -rf ${THE_DIR}
else
echo "Web server cluster directory ${THE_DIR} does not exist"
fi
}
function deleteBinaries() {
THE_DIR="binaries"
if [[ -d ${THE_DIR} ]]; then
echo "Removing binaries directory ${PWD}/${THE_DIR}"
rm -rf ${THE_DIR}
else
echo "Binaries directory ${PWD}/${THE_DIR} does not exist"
fi
}
function deleteIso {
THE_DIR="iso"
if [[ -d ${THE_DIR} ]]; then
echo "Removing iso directory ${PWD}/${THE_DIR}"
rm -rf ${THE_DIR}
else
echo "iso directory ${PWD}/${THE_DIR} does not exist"
fi
}
function deleteProjectClusterDirectory {
THE_DIR="${OPENSHIFT_CLUSTERNAME}"
if [[ -d "${THE_DIR}" ]]; then
echo "Removing project cluster directory ${PWD}/${THE_DIR}"
rm -rf ${THE_DIR}
else
echo "Project cluster directory ${PWD}/${THE_DIR} does not exist"
fi
}
function deleteTempFiles {
#Only required on Linux
if [[ "${PLATFORM}" == "Linux" ]]; then
THE_DIR="/tmp/tmpocpiso"
if [[ -d ${THE_DIR} ]]; then
echo "Removing ${THE_DIR}"
sudo rm -rf ${THE_DIR}
fi
fi
THE_FILE="/tmp/temp_isolinux.cfg"
if [[ -f "${THE_FILE}" ]]; then
echo "Deleting ${THE_FILE}"
sudo rm ${THE_FILE}
else
echo "${THE_FILE} does not exist"
fi
}
function main() {
deleteProjectClusterDirectory
deleteWebServerFiles
deleteBinaries
deleteIso
deleteTempFiles
}
. environment.properties
main