-
Notifications
You must be signed in to change notification settings - Fork 1
/
get-officials.sh
executable file
·101 lines (86 loc) · 3.01 KB
/
get-officials.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
#!/usr/bin/env sh
# -----------------------------------------------------------------------------
# Get Official Terraform Submodules
# -----------------------------------------------------------------------------
# Author : DevOps Engineer DevOpsCornerId (support@devopscorner.id)
# License : Apache v2
# -----------------------------------------------------------------------------
set -e
TITLE="TERRAFORM OFFICIAL SUBMODULES" # script name
VER="2.3" # script version
PATH_FOLDER=$(pwd)
SUBMODULE_TERRAFORM="${PATH_FOLDER}/module_officials.lst"
PATH_MODULES="${PATH_FOLDER}/terraform/modules/providers/aws/officials"
COL_RED="\033[22;31m"
COL_GREEN="\033[22;32m"
COL_BLUE="\033[22;34m"
COL_END="\033[0m"
get_time() {
DATE=$(date '+%Y-%m-%d %H:%M:%S')
}
print_line0() {
echo "$COL_GREEN=====================================================================================$COL_END"
}
print_line1() {
echo "$COL_GREEN-------------------------------------------------------------------------------------$COL_END"
}
print_line2() {
echo "-------------------------------------------------------------------------------------"
}
logo() {
clear
print_line0
echo "$COL_RED'########:'########:'########:::'#######:::'######::::'#####:::'########:::'#######:: $COL_END"
echo "$COL_RED..... ##:: ##.....:: ##.... ##:'##.... ##:'##... ##::'##.. ##:: ##.... ##:'##.... ##: $COL_END"
echo "$COL_RED:::: ##::: ##::::::: ##:::: ##: ##:::: ##: ##:::..::'##:::: ##: ##:::: ##:..::::: ##: $COL_END"
echo "$COL_RED::: ##:::: ######::: ########:: ##:::: ##: ##::::::: ##:::: ##: ##:::: ##::'#######:: $COL_END"
echo "$COL_RED:: ##::::: ##...:::: ##.. ##::: ##:::: ##: ##::::::: ##:::: ##: ##:::: ##::...... ##: $COL_END"
echo "$COL_RED: ##:::::: ##::::::: ##::. ##:: ##:::: ##: ##::: ##:. ##:: ##:: ##:::: ##:'##:::: ##: $COL_END"
echo "$COL_RED ########: ########: ##:::. ##:. #######::. ######:::. #####::: ########::. #######:: $COL_END"
echo "$COL_RED........::........::..:::::..:::.......::::......:::::.....::::........::::.......::: $COL_END"
print_line1
echo "$COL_GREEN# $TITLE :: ver-$VER $COL_END"
}
header() {
logo
print_line0
get_time
echo "$COL_RED# BEGIN PROCESS..... (Please Wait) $COL_END"
echo "$COL_RED# Start at: $DATE $COL_END\n"
}
footer() {
print_line0
get_time
echo "$COL_RED# Finish at: $DATE $COL_END"
echo "$COL_RED# END PROCESS..... $COL_END\n"
}
skip_exists() {
if [[ -f "$1" ]]; then
echo ">> Skip for existing file $1 ..."
else
git clone --depth 1 $1
fi
}
submodule_terrafom() {
print_line2
get_time
echo "$COL_BLUE[ $DATE ] ##### Download Official Submodule(s): $COL_END"
cd $PATH_MODULES
while IFS= read line; do
get_time
print_line2
echo "$COL_GREEN[ $DATE ] git clone --depth 1 $line $COL_END"
print_line2
# skip_exists $line
git clone --depth 1 $line
echo ""
done <"$SUBMODULE_TERRAFORM"
echo "- DOWNLOAD DONE -"
}
main() {
header
submodule_terrafom
footer
}
### START HERE ###
main $@