forked from AiursoftWeb/AnduinOS-2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshared.sh
More file actions
executable file
·58 lines (48 loc) · 1.21 KB
/
Copy pathshared.sh
File metadata and controls
executable file
·58 lines (48 loc) · 1.21 KB
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
#!/bin/bash
#==========================
# Color
#==========================
export Green="\033[32m"
export Red="\033[31m"
export Yellow="\033[33m"
export Blue="\033[36m"
export Font="\033[0m"
export GreenBG="\033[42;37m"
export RedBG="\033[41;37m"
export INFO="${Blue}[ INFO ]${Font}"
export OK="${Green}[ OK ]${Font}"
export ERROR="${Red}[FAILED]${Font}"
export WARNING="${Yellow}[ WARN ]${Font}"
#==========================
# Print Colorful Text
#==========================
function print_ok() {
echo -e "${OK} ${Blue} $1 ${Font}"
}
function print_info() {
echo -e "${INFO} ${Font} $1"
}
function print_error() {
echo -e "${ERROR} ${Red} $1 ${Font}"
}
function print_warn() {
echo -e "${WARNING} ${Yellow} $1 ${Font}"
}
function judge() {
if [[ 0 -eq $? ]]; then
print_ok "$1 succeeded"
sleep 0.2
else
print_error "$1 failed"
exit 1
fi
}
function wait_network() {
local wget_opts=(--spider -q --timeout=5 --tries=1)
until wget "${wget_opts[@]}" https://github.com; do
echo "Waiting for network (https://github.com) ... ETA: 25s"
sleep 1
done
print_ok "Network is online. Continue..."
}
export -f print_ok print_error print_warn judge wait_network print_info