forked from pyavitz/debian-image-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·127 lines (112 loc) · 2.11 KB
/
install
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
#!/bin/bash
RED="\e[1;31m"
GRN="\e[1;32m"
PNK="\e[1;35m"
WHT="\e[1;37m"
YLW="\e[1;33m"
FIN="\e[0m"
echo_nok(){
echo -e -n "${PNK}[${FIN}${GRN}OK${FIN}${PNK}]${FIN}"
}
echo_focal(){
echo -e -n "${PNK}[${FIN}${GRN}Ubuntu Focal${FIN}${PNK}]${FIN}"
}
echo_jammy(){
echo -e -n "${PNK}[${FIN}${GRN}Ubuntu Jammy Jellyfish${FIN}${PNK}]${FIN}"
}
echo_bullseye(){
echo -e -n "${PNK}[${FIN}${GRN}Debian Bullseye${FIN}${PNK}]${FIN}"
}
echo_fail(){
echo -n -e "${PNK}[${FIN}${RED}failed${FIN}${PNK}]${FIN}"
}
ierror(){
echo
echo -e "${WHT}Please check your internet connection and try again${FIN}."
}
derror(){
echo
echo -e "${WHT}The OS you are running is not supported${FIN}."
}
depends_check(){
if [[ `command -v wget` ]]; then
:;
else
if [[ `curl -I https://github.com 2>&1 | grep 'HTTP/2 200'` ]]; then
echo -e "${WHT}Installing missing depends${FIN}."
sudo apt update
sudo apt upgrade -y
sudo apt install -y wget;
else
echo_fail
echo ""
ierror
exit > /dev/null 2>&1;
fi
fi
}
internet_check(){
echo -e -n "${WHT}Checking Internet Connection:${FIN} "
if [[ `wget -S --spider https://github.com 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then
echo_nok
echo "";
else
echo_fail
echo ""
ierror
exit > /dev/null 2>&1;
fi
}
distro_check(){
echo -e -n "${WHT}Checking Host Machine:${FIN} "
sleep 1s
if [[ `grep -w "focal" "/etc/os-release"` ]]; then
echo_focal
echo ""
else
if [[ `grep -w "jammy" "/etc/os-release"` ]]; then
echo_jammy
echo "";
else
if [[ `grep -w "bullseye" "/etc/os-release"` ]]; then
echo_bullseye
echo "";
else
echo_fail
echo ""
derror
exit > /dev/null 2>&1;
fi
fi
fi
}
echo ""
depends_check
internet_check
distro_check
echo ""
echo -e "${WHT}Starting install ...${FIN}"
sleep 2s
if [[ `uname -m | grep x86_64` ]]; then
if [[ `command -v make` ]]; then
sudo apt update
make ccompile;
else
sudo apt update
sudo apt install -y make
make ccompile;
fi
fi
if [[ `uname -m | grep aarch64` ]]; then
if [[ `command -v make` ]]; then
sudo apt update
make ncompile;
else
sudo apt update
sudo apt install -y make
make ncompile;
fi
fi
make dialogrc > /dev/null 2>&1
echo
make