-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.sh
executable file
·257 lines (250 loc) · 6.36 KB
/
build.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
#!/bin/bash
WORKINGDIR=$(pwd)
VERSION="Skybian_Maintenance_Framework_1.1.0"
DIALOG=dialog
DIALOG1="$DIALOG --backtitle $VERSION --clear --cancel-label Exit --no-collapse"
#set -ex
HIGHLIGHT=0
# Define the dialog exit status codes
: ${DIALOG_OK=0}
: ${DIALOG_CANCEL=1}
: ${DIALOG_HELP=2}
: ${DIALOG_EXTRA=3}
: ${DIALOG_ITEM_HELP=4}
: ${DIALOG_ESC=255}
# Create a temporary file and make sure it goes away when we're dome
tmp_file=$(tempfile 2>/dev/null) || tmp_file=/tmp/test$$
trap "rm -f $tmp_file" 0 1 2 5 15
build_image() {
$DIALOG1 \
--title "Main Menu" \
--menu "Please select: " 0 0 10 \
"1" "Build the Skybian Orange Pi Prime image" \
"2" "Build the Skybian Orange Pi Prime image with autopeering" \
"3" "Build the Skybian Orange Pi 3 image" \
"4" "Build the Skyraspbian Raspberry Pi 3 image" \
"5" "Build the Skyraspbian Raspberry Pi 4 image" \
"6" "main menu" \
2> $tmp_file
# HIGHLIGHT=$(cat ${ANSWER})
case $(cat $tmp_file) in
"1")
clear
[[ $(echo *.sha) != "*.sha" ]] && rm *.sha
SKYBIAN=skybian.prime.IMGBUILD ./image.sh zip
read -s -n 1 -p "Press any key to continue . . ."
echo ""
;;
"2")
clear
[[ $(echo *.sha) != "*.sha" ]] && rm *.sha
ENABLEAUTOPEER="-autopeer" SKYBIAN=skybian.prime.IMGBUILD ./image.sh zip
read -s -n 1 -p "Press any key to continue . . ."
echo ""
;;
"3")
clear
[[ $(echo *.sha) != "*.sha" ]] && rm *.sha
SKYBIAN=skybian.opi3.IMGBUILD ./image.sh zip
read -s -n 1 -p "Press any key to continue . . ."
echo ""
;;
"4")
clear
SKYBIAN=skyraspbian.rpi3.IMGBUILD ./image.sh zip
read -s -n 1 -p "Press any key to continue . . ."
echo ""
;;
"5")
clear
SKYBIAN=skyraspbian.rpi4.IMGBUILD ./image.sh zip
read -s -n 1 -p "Press any key to continue . . ."
echo ""
;;
"6")
main_menu
;;
*)
clear
exit 1
;;
esac
}
build_test_image() {
$DIALOG1 \
--title "Main Menu" \
--menu "Please select: " 0 0 10 \
"1" "Build the Skybian Orange Pi Prime test image" \
"2" "Build the Skybian Orange Pi Prime test image with autopeering" \
"3" "Build the Skybian Orange Pi 3 test image" \
"4" "Build the Skyraspbian Raspberry Pi 3 test image" \
"5" "Build the Skyraspbian Raspberry Pi 4 test image" \
"6" "main menu" \
2> $tmp_file
# HIGHLIGHT=$(cat ${ANSWER})
case $(cat $tmp_file) in
"1")
clear
[[ $(echo *.sha) != "*.sha" ]] && rm *.sha
TESTDEPLOYMENT=1 SKYBIAN=skybian.prime.IMGBUILD ./image.sh zip
read -s -n 1 -p "Press any key to continue . . ."
echo ""
;;
"2")
clear
[[ $(echo *.sha) != "*.sha" ]] && rm *.sha
TESTDEPLOYMENT=1 ENABLEAUTOPEER="-autopeer" SKYBIAN=skybian.prime.IMGBUILD ./image.sh zip
read -s -n 1 -p "Press any key to continue . . ."
echo ""
;;
"3")
clear
[[ $(echo *.sha) != "*.sha" ]] && rm *.sha
TESTDEPLOYMENT=1 SKYBIAN=skybian.opi3.IMGBUILD ./image.sh zip
read -s -n 1 -p "Press any key to continue . . ."
echo ""
;;
"4")
clear
TESTDEPLOYMENT=1 SKYBIAN=skyraspbian.rpi3.IMGBUILD ./image.sh zip
read -s -n 1 -p "Press any key to continue . . ."
echo ""
;;
"5")
clear
TESTDEPLOYMENT=1 SKYBIAN=skyraspbian.rpi4.IMGBUILD ./image.sh zip
read -s -n 1 -p "Press any key to continue . . ."
echo ""
;;
"6")
main_menu
;;
*)
clear
exit 1
;;
esac
}
main_menu() {
$DIALOG1 \
--title "Main Menu" \
--menu "Please select: " 0 0 10 \
"1" "Create the Skybian Package" \
"2" "Create the Skybian package with test repo config" \
"3" "Remove built packages" \
"4" "Update IMGBUILD Checksums" \
"5" "Update IMGBUILD Checksums for test package" \
"6" "Build individual image & zip archive" \
"7" "Build individual test image & zip archive" \
"8" "Build all the Skybian images & zip archives" \
"9" "Build all the Skybian test images & zip archives" 2> $tmp_file
# HIGHLIGHT=$(cat ${ANSWER})
case $(cat $tmp_file) in
"1")
clear
source PKGBUILD
./skybian.sh wait
_err=$?
if $_err != "0" ; then
$DIALOG1 \
--title "Error creating the skybian package:" --msgbox "
exit status $_err" 10 0
else
$DIALOG1 \
--title "skybian package created:" --msgbox "
$(ls ${pkgname}-${pkgver}*.deb)" 10 0
fi
;;
"2")
clear
source PKGBUILD
TESTDEPLOYMENT=1 ./skybian.sh wait
_err=$?
if $_err != "0" ; then
$DIALOG1 \
--title "Error creating the skybian package:" --msgbox "
exit status $_err" 10 0
else
$DIALOG1 \
--title "skybian package created:" --msgbox "
$(ls ${pkgname}-${pkgver}*.deb)" 10 0
fi
;;
"3")
clear
rm -rf *.deb
$DIALOG1 \
--title "Removed" --msgbox "Removed existing .deb packages" 5 40
;;
"4")
clear
[[ $(echo *.sha) != "*.sha" ]] && rm *.sha
SKYBIAN=skybian.prime.IMGBUILD ./image.sh 0
[[ $(echo *.sha) != "*.sha" ]] && rm *.sha
SKYBIAN=skybian.opi3.IMGBUILD ./image.sh 0
[[ $(echo *.sha) != "*.sha" ]] && rm *.sha
SKYBIAN=skyraspbian.rpi3.IMGBUILD ./image.sh 0
SKYBIAN=skyraspbian.rpi4.IMGBUILD ./image.sh 0
read -s -n 1 -p "Press any key to continue . . ."
echo ""
;;
"5")
clear
[[ $(echo *.sha) != "*.sha" ]] && rm *.sha
TESTDEPLOYMENT=1 SKYBIAN=skybian.prime.IMGBUILD ./image.sh 0
[[ $(echo *.sha) != "*.sha" ]] && rm *.sha
TESTDEPLOYMENT=1 SKYBIAN=skybian.opi3.IMGBUILD ./image.sh 0
[[ $(echo *.sha) != "*.sha" ]] && rm *.sha
TESTDEPLOYMENT=1 SKYBIAN=skyraspbian.rpi3.IMGBUILD ./image.sh 0
TESTDEPLOYMENT=1 SKYBIAN=skyraspbian.rpi4.IMGBUILD ./image.sh 0
read -s -n 1 -p "Press any key to continue . . ."
echo ""
;;
"6")
clear
build_image
;;
"7")
build_test_image
;;
"8")
clear
set -e
[[ $(echo *.sha) != "*.sha" ]] && rm *.sha
SKYBIAN=skybian.prime.IMGBUILD ./image.sh zip
ENABLEAUTOPEER="-autopeer" SKYBIAN=skybian.prime.IMGBUILD ./image.sh zip
[[ $(echo *.sha) != "*.sha" ]] && rm *.sha
SKYBIAN=skybian.opi3.IMGBUILD ./image.sh zip
[[ $(echo *.sha) != "*.sha" ]] && rm *.sha
SKYBIAN=skyraspbian.rpi3.IMGBUILD ./image.sh zip
SKYBIAN=skyraspbian.rpi4.IMGBUILD ./image.sh zip
set +e
read -s -n 1 -p "Press any key to continue . . ."
echo ""
;;
"9")
clear
set -e
[[ $(echo *.sha) != "*.sha" ]] && rm *.sha
TESTDEPLOYMENT=1 SKYBIAN=skybian.prime.IMGBUILD ./image.sh zip
TESTDEPLOYMENT=1 ENABLEAUTOPEER="-autopeer" SKYBIAN=skybian.prime.IMGBUILD ./image.sh zip
[[ $(echo *.sha) != "*.sha" ]] && rm *.sha
TESTDEPLOYMENT=1 SKYBIAN=skybian.opi3.IMGBUILD ./image.sh zip
[[ $(echo *.sha) != "*.sha" ]] && rm *.sha
TESTDEPLOYMENT=1 SKYBIAN=skyraspbian.rpi3.IMGBUILD ./image.sh zip
TESTDEPLOYMENT=1 SKYBIAN=skyraspbian.rpi4.IMGBUILD ./image.sh zip
set +e
read -s -n 1 -p "Press any key to continue . . ."
echo ""
;;
*)
clear
exit 1
;;
esac
main_menu
}
clear
while true; do
main_menu
done