forked from rodw-au/rpi-img-builder-lcnc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·143 lines (134 loc) · 2.95 KB
/
install.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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/bash
source lib/source
RED="\e[0;31m"
GRN="\e[0;32m"
PNK="\e[0;35m"
TXT="\033[0m"
YLW="\e[0;33m"
FIN="\e[0m"
GIT_BRANCH=`git branch`
echo ""
echo -en "${TXT}Raspberry Pi Image Builder:${FIN}"
echo -e " ${PNK}[${FIN}${GRN}${GIT_BRANCH}${FIN}${PNK}]${FIN}"
if [[ `command -v curl` ]]; then
:;
else
echo ""
echo -e "Missing dependency: curl"
sudo apt install -y curl wget
fi
echo -en "${TXT}Checking Internet Connection:${FIN} "
if [[ `curl -I https://github.com 2>&1 | grep 'HTTP/2 200'` ]]; then
echo -en "${PNK}[${FIN}${GRN}OK${FIN}${PNK}]${FIN}"
echo ""
else
echo -en "${PNK}[${FIN}${RED}failed${FIN}${PNK}]${FIN}"
echo ""
echo -e "${TXT}Please check your internet connection and try again${FIN}."
exit 0
fi
echo -en "${TXT}Checking Host Machine:${FIN} "
sleep .50
if [[ "$HOST_CODENAME" == "jammy" ]]; then
echo -en "${PNK}[${FIN}${GRN}Ubuntu Jammy Jellyfish${FIN}${PNK}]${FIN}"
echo ""
else
if [[ "$HOST_CODENAME" == "bullseye" ]]; then
echo -en "${PNK}[${FIN}${GRN}Debian Bullseye${FIN}${PNK}]${FIN}"
echo ""
else
if [[ "$HOST_CODENAME" == "bookworm" ]]; then
echo -en "${PNK}[${FIN}${GRN}Debian Bookworm${FIN}${PNK}]${FIN}"
echo ""
else
echo -ne "${PNK}[${FIN}${RED}failed${FIN}${PNK}]${FIN}"
echo ""
echo -e "${TXT}The OS you are running is not supported${FIN}."
exit 0
fi
fi
fi
echo ""
if [[ "$HOST_ARCH" == "x86_64" || "$HOST_ARCH" == "aarch64" ]]; then
:;
else
echo -e "ARCH: $HOST_ARCH is not supported by this script."
exit 0
fi
if [[ "$HOST_ARCH" == "x86_64" ]]; then
echo -e "${TXT}Starting install ...${FIN}"
sleep .50
if [[ `command -v make` ]]; then
sudo apt update
sudo apt upgrade -y
make ccompile
else
sleep 1s
sudo apt update
sudo apt upgrade -y
sudo apt install -y make
make ccompile
fi
fi
if [[ "$HOST_ARCH" == "aarch64" ]]; then
echo -e -n "${TXT}"
echo -e "Arm64 detected. Select the dependencies you would like installed."
options=("Cross Compiling" "Native Compiling" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Cross Compiling")
if [[ `command -v make` ]]; then
echo ""
echo -e "${TXT}Starting install ...${FIN}"
sleep 1s
sudo apt update
sudo apt upgrade -y
make ccompile64
else
echo ""
echo -e "${TXT}Starting install ...${FIN}"
sleep 1s
sudo apt update
sudo apt upgrade -y
sudo apt install -y make
make ccompile64
fi
break
;;
"Native Compiling")
if [[ `command -v make` ]]; then
echo ""
echo -e "${TXT}Starting install ...${FIN}"
sleep 1s
sudo apt update
sudo apt upgrade -y
make ncompile
else
echo ""
echo -e "${TXT}Starting install ...${FIN}"
sleep 1s
sudo apt update
sudo apt upgrade -y
sudo apt install -y make
make ncompile
fi
break
;;
"Quit")
break
;;
*)
echo "invalid option $REPLY"
;;
esac
done
echo -e -n "${FIN}"
fi
# install builder theme
make dialogrc
# clear
clear -x
# builder options
make help
exit 0