1 |
6f73c362
|
Renato Botelho
|
#!/bin/sh
|
2 |
|
|
#
|
3 |
|
|
# build.sh
|
4 |
|
|
#
|
5 |
ac24dc24
|
Renato Botelho
|
# part of pfSense (https://www.pfsense.org)
|
6 |
81299b5c
|
Renato Botelho
|
# Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
|
7 |
ac24dc24
|
Renato Botelho
|
# All rights reserved.
|
8 |
6f73c362
|
Renato Botelho
|
#
|
9 |
b12ea3fb
|
Renato Botelho
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
10 |
|
|
# you may not use this file except in compliance with the License.
|
11 |
|
|
# You may obtain a copy of the License at
|
12 |
6f73c362
|
Renato Botelho
|
#
|
13 |
b12ea3fb
|
Renato Botelho
|
# http://www.apache.org/licenses/LICENSE-2.0
|
14 |
6f73c362
|
Renato Botelho
|
#
|
15 |
b12ea3fb
|
Renato Botelho
|
# Unless required by applicable law or agreed to in writing, software
|
16 |
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
17 |
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18 |
|
|
# See the License for the specific language governing permissions and
|
19 |
|
|
# limitations under the License.
|
20 |
6f73c362
|
Renato Botelho
|
|
21 |
|
|
set +e
|
22 |
|
|
usage() {
|
23 |
2ac4be3a
|
Renato Botelho
|
echo "Usage $0 [options] [ iso | ova | memstick | memstickserial | memstickadi | all | none ]"
|
24 |
|
|
echo " all = iso memstick memstickserial memstickadi"
|
25 |
ddf56629
|
Renato Botelho
|
echo " none = upgrade only pkg repo"
|
26 |
6f73c362
|
Renato Botelho
|
echo " [ options ]: "
|
27 |
|
|
echo " --no-buildworld|-c - Will set NO_BUILDWORLD NO_BUILDKERNEL to not build kernel and world"
|
28 |
6ebd280c
|
Renato Botelho
|
echo " --no-cleanobjdir|-d - Will not clean FreeBSD object built dir to allow restarting a build with NO_CLEAN"
|
29 |
6f73c362
|
Renato Botelho
|
echo " --resume-image-build|-r - Includes -c -d and also will just move directly to image creation using pre-staged data"
|
30 |
|
|
echo " --setup - Install required repo and ports builder require to work"
|
31 |
2a5914c6
|
Renato Botelho
|
echo " --update-sources - Refetch FreeBSD sources"
|
32 |
0458a1fd
|
Renato Botelho
|
echo " --rsync-repos - rsync pkg repos"
|
33 |
e48f0418
|
Renato Botelho
|
echo " --rsync-snapshots - rsync snapshots images and pkg repos"
|
34 |
6f73c362
|
Renato Botelho
|
echo " --clean-builder - clean all builder used data/resources"
|
35 |
|
|
echo " --build-kernels - build all configured kernels"
|
36 |
|
|
echo " --build-kernel argument - build specified kernel. Example --build-kernel KERNEL_NAME"
|
37 |
|
|
echo " --install-extra-kernels argument - Put extra kernel(s) under /kernel image directory. Example --install-extra-kernels KERNEL_NAME_WRAP"
|
38 |
f6c83d05
|
Renato Botelho
|
echo " --snapshots - Build snapshots"
|
39 |
919c8486
|
Renato Botelho
|
echo " --poudriere-snapshots - Update poudriere packages and send them to PKG_RSYNC_HOSTNAME"
|
40 |
6f73c362
|
Renato Botelho
|
echo " --setup-poudriere - Install poudriere and create necessary jails and ports tree"
|
41 |
|
|
echo " --create-unified-patch - Create a big patch with all changes done on FreeBSD"
|
42 |
|
|
echo " --update-poudriere-jails [-a ARCH_LIST] - Update poudriere jails using current patch versions"
|
43 |
fb192227
|
Renato Botelho
|
echo " --update-poudriere-ports [-a ARCH_LIST]- Update poudriere ports tree"
|
44 |
|
|
echo " --update-pkg-repo [-a ARCH_LIST]- Rebuild necessary ports on poudriere and update pkg repo"
|
45 |
f6c83d05
|
Renato Botelho
|
echo " --upload|-U - Upload pkgs and/or snapshots"
|
46 |
6f73c362
|
Renato Botelho
|
echo " -V VARNAME - print value of variable VARNAME"
|
47 |
|
|
exit 1
|
48 |
|
|
}
|
49 |
|
|
|
50 |
0ce2a7f3
|
Renato Botelho
|
export BUILDER_ROOT=$(realpath $(dirname ${0}))
|
51 |
|
|
export BUILDER_TOOLS="${BUILDER_ROOT}/tools"
|
52 |
6f73c362
|
Renato Botelho
|
|
53 |
|
|
unset _SKIP_REBUILD_PRESTAGE
|
54 |
|
|
unset _USE_OLD_DATESTRING
|
55 |
|
|
unset pfPORTTOBUILD
|
56 |
|
|
unset IMAGETYPE
|
57 |
f6c83d05
|
Renato Botelho
|
unset UPLOAD
|
58 |
ab943fc9
|
Renato Botelho
|
unset SNAPSHOTS
|
59 |
919c8486
|
Renato Botelho
|
unset POUDRIERE_SNAPSHOTS
|
60 |
fb192227
|
Renato Botelho
|
unset ARCH_LIST
|
61 |
6f73c362
|
Renato Botelho
|
BUILDACTION="images"
|
62 |
|
|
|
63 |
|
|
# Maybe use options for nocleans etc?
|
64 |
|
|
while test "$1" != ""; do
|
65 |
|
|
case "${1}" in
|
66 |
|
|
--no-buildworld|-c)
|
67 |
|
|
export NO_BUILDWORLD=YES
|
68 |
|
|
export NO_BUILDKERNEL=YES
|
69 |
|
|
;;
|
70 |
6ebd280c
|
Renato Botelho
|
--no-cleanobjdir|-d)
|
71 |
2abc3e80
|
Renato Botelho
|
export NO_CLEAN_FREEBSD_OBJ=YES
|
72 |
6f73c362
|
Renato Botelho
|
;;
|
73 |
|
|
--resume-image-build|-r)
|
74 |
|
|
export NO_BUILDWORLD=YES
|
75 |
|
|
export NO_BUILDKERNEL=YES
|
76 |
2abc3e80
|
Renato Botelho
|
export NO_CLEAN_FREEBSD_OBJ=YES
|
77 |
2f666d34
|
Renato Botelho
|
export DO_NOT_SIGN_PKG_REPO=YES
|
78 |
6f73c362
|
Renato Botelho
|
_SKIP_REBUILD_PRESTAGE=YES
|
79 |
|
|
_USE_OLD_DATESTRING=YES
|
80 |
|
|
;;
|
81 |
|
|
--setup)
|
82 |
|
|
BUILDACTION="builder_setup"
|
83 |
|
|
;;
|
84 |
0458a1fd
|
Renato Botelho
|
--rsync-repos)
|
85 |
|
|
BUILDACTION="rsync_repos"
|
86 |
2f20d4dc
|
Renato Botelho
|
export DO_NOT_SIGN_PKG_REPO=YES
|
87 |
0458a1fd
|
Renato Botelho
|
;;
|
88 |
e48f0418
|
Renato Botelho
|
--rsync-snapshots)
|
89 |
|
|
BUILDACTION="rsync_snapshots"
|
90 |
|
|
export DO_NOT_SIGN_PKG_REPO=YES
|
91 |
|
|
;;
|
92 |
6f73c362
|
Renato Botelho
|
--build-kernels)
|
93 |
|
|
BUILDACTION="buildkernels"
|
94 |
|
|
;;
|
95 |
|
|
--install-extra-kernels)
|
96 |
|
|
shift
|
97 |
|
|
if [ $# -eq 0 ]; then
|
98 |
|
|
echo "--build-kernel needs extra parameter."
|
99 |
|
|
echo
|
100 |
|
|
usage
|
101 |
|
|
fi
|
102 |
|
|
export INSTALL_EXTRA_KERNELS="${1}"
|
103 |
|
|
;;
|
104 |
ab943fc9
|
Renato Botelho
|
--snapshots)
|
105 |
|
|
export SNAPSHOTS=1
|
106 |
|
|
;;
|
107 |
919c8486
|
Renato Botelho
|
--poudriere-snapshots)
|
108 |
|
|
export POUDRIERE_SNAPSHOTS=1
|
109 |
|
|
;;
|
110 |
6f73c362
|
Renato Botelho
|
--build-kernel)
|
111 |
|
|
BUILDACTION="buildkernel"
|
112 |
|
|
shift
|
113 |
|
|
if [ $# -eq 0 ]; then
|
114 |
|
|
echo "--build-kernel needs extra parameter."
|
115 |
|
|
echo
|
116 |
|
|
usage
|
117 |
|
|
fi
|
118 |
|
|
export BUILD_KERNELS="${1}"
|
119 |
|
|
;;
|
120 |
|
|
--update-sources)
|
121 |
|
|
BUILDACTION="updatesources"
|
122 |
|
|
;;
|
123 |
|
|
--clean-builder)
|
124 |
|
|
BUILDACTION="cleanbuilder"
|
125 |
|
|
;;
|
126 |
|
|
--setup-poudriere)
|
127 |
|
|
BUILDACTION="setup_poudriere"
|
128 |
|
|
;;
|
129 |
|
|
--create-unified-patch)
|
130 |
|
|
BUILDACTION="create_unified_patch"
|
131 |
|
|
;;
|
132 |
|
|
--update-poudriere-jails)
|
133 |
|
|
BUILDACTION="update_poudriere_jails"
|
134 |
fb192227
|
Renato Botelho
|
;;
|
135 |
|
|
-a)
|
136 |
6f73c362
|
Renato Botelho
|
shift
|
137 |
fb192227
|
Renato Botelho
|
if [ $# -eq 0 ]; then
|
138 |
|
|
echo "-a needs extra parameter."
|
139 |
|
|
echo
|
140 |
|
|
usage
|
141 |
6f73c362
|
Renato Botelho
|
fi
|
142 |
fb192227
|
Renato Botelho
|
export ARCH_LIST="${1}"
|
143 |
6f73c362
|
Renato Botelho
|
;;
|
144 |
|
|
--update-poudriere-ports)
|
145 |
|
|
BUILDACTION="update_poudriere_ports"
|
146 |
|
|
;;
|
147 |
|
|
--update-pkg-repo)
|
148 |
|
|
BUILDACTION="update_pkg_repo"
|
149 |
|
|
;;
|
150 |
f6c83d05
|
Renato Botelho
|
--upload|-U)
|
151 |
|
|
export UPLOAD=1
|
152 |
6f73c362
|
Renato Botelho
|
;;
|
153 |
2ac4be3a
|
Renato Botelho
|
all|none|*iso*|*ova*|*memstick*|*memstickserial*|*memstickadi*)
|
154 |
6f73c362
|
Renato Botelho
|
BUILDACTION="images"
|
155 |
|
|
IMAGETYPE="${1}"
|
156 |
|
|
;;
|
157 |
|
|
-V)
|
158 |
3ad375d4
|
Renato Botelho
|
_USE_OLD_DATESTRING=YES
|
159 |
6f73c362
|
Renato Botelho
|
shift
|
160 |
|
|
[ -n "${1}" ] \
|
161 |
|
|
&& var_to_print="${1}"
|
162 |
|
|
;;
|
163 |
ab943fc9
|
Renato Botelho
|
--snapshot-update-status)
|
164 |
|
|
shift
|
165 |
906ca3b0
|
Renato Botelho
|
snapshot_status_message="${1}"
|
166 |
|
|
BUILDACTION="snapshot_status_message"
|
167 |
b8e4e210
|
Renato Botelho
|
_USE_OLD_DATESTRING=YES
|
168 |
ab943fc9
|
Renato Botelho
|
;;
|
169 |
6f73c362
|
Renato Botelho
|
*)
|
170 |
33a44737
|
Renato Botelho
|
_USE_OLD_DATESTRING=YES
|
171 |
6f73c362
|
Renato Botelho
|
usage
|
172 |
|
|
esac
|
173 |
|
|
shift
|
174 |
|
|
done
|
175 |
|
|
|
176 |
5eb2c7c5
|
Renato Botelho
|
# Suck in local vars
|
177 |
|
|
. ${BUILDER_TOOLS}/builder_defaults.sh
|
178 |
|
|
|
179 |
21835143
|
Renato Botelho
|
# Let user define ARCH_LIST in build.conf
|
180 |
|
|
[ -z "${ARCH_LIST}" -a -n "${DEFAULT_ARCH_LIST}" ] \
|
181 |
|
|
&& ARCH_LIST="${DEFAULT_ARCH_LIST}"
|
182 |
|
|
|
183 |
6f73c362
|
Renato Botelho
|
# Suck in script helper functions
|
184 |
0ce2a7f3
|
Renato Botelho
|
. ${BUILDER_TOOLS}/builder_common.sh
|
185 |
6f73c362
|
Renato Botelho
|
|
186 |
|
|
# Print var required with -V and exit
|
187 |
|
|
if [ -n "${var_to_print}" ]; then
|
188 |
|
|
eval "echo \$${var_to_print}"
|
189 |
|
|
exit 0
|
190 |
|
|
fi
|
191 |
|
|
|
192 |
ab943fc9
|
Renato Botelho
|
# Update snapshot status and exit
|
193 |
906ca3b0
|
Renato Botelho
|
if [ "${BUILDACTION}" = "snapshot_status_message" ]; then
|
194 |
919c8486
|
Renato Botelho
|
if [ -z "${POUDRIERE_SNAPSHOTS}" ]; then
|
195 |
|
|
export SNAPSHOTS=1
|
196 |
|
|
fi
|
197 |
ab943fc9
|
Renato Botelho
|
snapshots_update_status "${snapshot_status_message}"
|
198 |
|
|
exit 0
|
199 |
|
|
fi
|
200 |
|
|
|
201 |
6f73c362
|
Renato Botelho
|
# This should be run first
|
202 |
|
|
launch
|
203 |
|
|
|
204 |
|
|
case $BUILDACTION in
|
205 |
|
|
builder_setup)
|
206 |
|
|
builder_setup
|
207 |
|
|
;;
|
208 |
|
|
buildkernels)
|
209 |
|
|
update_freebsd_sources
|
210 |
|
|
build_all_kernels
|
211 |
|
|
;;
|
212 |
|
|
buildkernel)
|
213 |
|
|
update_freebsd_sources
|
214 |
|
|
build_all_kernels
|
215 |
|
|
;;
|
216 |
|
|
cleanbuilder)
|
217 |
7e6ab3ed
|
Renato Botelho
|
clean_builder
|
218 |
6f73c362
|
Renato Botelho
|
;;
|
219 |
dd423357
|
Renato Botelho
|
images)
|
220 |
6f73c362
|
Renato Botelho
|
# It will be handled below
|
221 |
|
|
;;
|
222 |
|
|
updatesources)
|
223 |
dde49bef
|
Renato Botelho
|
update_freebsd_sources
|
224 |
6f73c362
|
Renato Botelho
|
;;
|
225 |
|
|
setup_poudriere)
|
226 |
|
|
poudriere_init
|
227 |
|
|
;;
|
228 |
|
|
create_unified_patch)
|
229 |
|
|
poudriere_create_patch
|
230 |
|
|
;;
|
231 |
|
|
update_poudriere_jails)
|
232 |
|
|
poudriere_update_jails
|
233 |
|
|
;;
|
234 |
|
|
update_poudriere_ports)
|
235 |
|
|
poudriere_update_ports
|
236 |
|
|
;;
|
237 |
0458a1fd
|
Renato Botelho
|
rsync_repos)
|
238 |
d610e4ba
|
Renato Botelho
|
export UPLOAD=1
|
239 |
0458a1fd
|
Renato Botelho
|
pkg_repo_rsync "${CORE_PKG_PATH}"
|
240 |
|
|
;;
|
241 |
e48f0418
|
Renato Botelho
|
rsync_snapshots)
|
242 |
d610e4ba
|
Renato Botelho
|
export UPLOAD=1
|
243 |
e48f0418
|
Renato Botelho
|
snapshots_scp_files
|
244 |
|
|
;;
|
245 |
6f73c362
|
Renato Botelho
|
update_pkg_repo)
|
246 |
f6c83d05
|
Renato Botelho
|
if [ -n "${UPLOAD}" -a ! -f /usr/local/bin/rsync ]; then
|
247 |
cfa7f409
|
Renato Botelho
|
echo "ERROR: rsync is not installed, aborting..."
|
248 |
|
|
exit 1
|
249 |
|
|
fi
|
250 |
6f73c362
|
Renato Botelho
|
poudriere_bulk
|
251 |
|
|
;;
|
252 |
|
|
*)
|
253 |
|
|
usage
|
254 |
|
|
;;
|
255 |
|
|
esac
|
256 |
|
|
|
257 |
|
|
if [ "${BUILDACTION}" != "images" ]; then
|
258 |
|
|
finish
|
259 |
|
|
exit 0
|
260 |
|
|
fi
|
261 |
|
|
|
262 |
f6c83d05
|
Renato Botelho
|
if [ -n "${SNAPSHOTS}" -a -n "${UPLOAD}" ]; then
|
263 |
49784c55
|
Renato Botelho
|
_required=" \
|
264 |
|
|
RSYNCIP \
|
265 |
|
|
RSYNCUSER \
|
266 |
|
|
RSYNCPATH \
|
267 |
|
|
PKG_RSYNC_HOSTNAME \
|
268 |
|
|
PKG_RSYNC_USERNAME \
|
269 |
|
|
PKG_RSYNC_SSH_PORT \
|
270 |
|
|
PKG_RSYNC_DESTDIR \
|
271 |
74a4eefb
|
Renato Botelho
|
PKG_REPO_SERVER_DEVEL \
|
272 |
|
|
PKG_REPO_SERVER_RELEASE \
|
273 |
|
|
PKG_REPO_SERVER_STAGING \
|
274 |
|
|
PKG_REPO_BRANCH_DEVEL \
|
275 |
|
|
PKG_REPO_BRANCH_RELEASE"
|
276 |
49784c55
|
Renato Botelho
|
|
277 |
c6d14b0b
|
Renato Botelho
|
for _var in ${_required}; do
|
278 |
f238a83f
|
Renato Botelho
|
eval "_value=\${$_var}"
|
279 |
|
|
if [ -z "${_value}" ]; then
|
280 |
|
|
echo ">>> ERROR: ${_var} is not defined"
|
281 |
|
|
exit 1
|
282 |
|
|
fi
|
283 |
|
|
done
|
284 |
cfa7f409
|
Renato Botelho
|
|
285 |
|
|
if [ ! -f /usr/local/bin/rsync ]; then
|
286 |
|
|
echo "ERROR: rsync is not installed, aborting..."
|
287 |
|
|
exit 1
|
288 |
|
|
fi
|
289 |
ab943fc9
|
Renato Botelho
|
fi
|
290 |
|
|
|
291 |
6f73c362
|
Renato Botelho
|
if [ $# -gt 1 ]; then
|
292 |
|
|
echo "ERROR: Too many arguments given."
|
293 |
|
|
echo
|
294 |
|
|
usage
|
295 |
|
|
fi
|
296 |
3edb445e
|
Renato Botelho
|
|
297 |
|
|
if [ -n "${SNAPSHOTS}" -a -z "${IMAGETYPE}" ]; then
|
298 |
|
|
IMAGETYPE="all"
|
299 |
|
|
fi
|
300 |
|
|
|
301 |
6f73c362
|
Renato Botelho
|
if [ -z "${IMAGETYPE}" ]; then
|
302 |
|
|
echo "ERROR: Need to specify image type to build."
|
303 |
|
|
echo
|
304 |
|
|
usage
|
305 |
|
|
fi
|
306 |
|
|
|
307 |
ddf56629
|
Renato Botelho
|
if [ "$IMAGETYPE" = "none" ]; then
|
308 |
|
|
_IMAGESTOBUILD=""
|
309 |
|
|
elif [ "$IMAGETYPE" = "all" ]; then
|
310 |
2ac4be3a
|
Renato Botelho
|
_IMAGESTOBUILD="iso memstick memstickserial"
|
311 |
6f73c362
|
Renato Botelho
|
if [ "${TARGET}" = "amd64" ]; then
|
312 |
|
|
_IMAGESTOBUILD="${_IMAGESTOBUILD} memstickadi"
|
313 |
7731df41
|
Renato Botelho
|
if [ -n "${_IS_RELEASE}" ]; then
|
314 |
|
|
_IMAGESTOBUILD="${_IMAGESTOBUILD} ova"
|
315 |
|
|
fi
|
316 |
6f73c362
|
Renato Botelho
|
fi
|
317 |
|
|
else
|
318 |
|
|
_IMAGESTOBUILD="${IMAGETYPE}"
|
319 |
|
|
fi
|
320 |
|
|
|
321 |
|
|
echo ">>> Building image type(s): ${_IMAGESTOBUILD}"
|
322 |
|
|
|
323 |
ab943fc9
|
Renato Botelho
|
if [ -n "${SNAPSHOTS}" ]; then
|
324 |
|
|
snapshots_update_status ">>> Starting snapshot build operations"
|
325 |
|
|
|
326 |
|
|
if pkg update -r ${PRODUCT_NAME} >/dev/null 2>&1; then
|
327 |
|
|
snapshots_update_status ">>> Updating builder packages... "
|
328 |
|
|
pkg upgrade -r ${PRODUCT_NAME} -y -q >/dev/null 2>&1
|
329 |
|
|
fi
|
330 |
|
|
fi
|
331 |
|
|
|
332 |
6f73c362
|
Renato Botelho
|
if [ -z "${_SKIP_REBUILD_PRESTAGE}" ]; then
|
333 |
|
|
[ -n "${CORE_PKG_PATH}" -a -d "${CORE_PKG_PATH}" ] \
|
334 |
|
|
&& rm -rf ${CORE_PKG_PATH}
|
335 |
|
|
|
336 |
|
|
# Cleanup environment before start
|
337 |
7e6ab3ed
|
Renato Botelho
|
clean_builder
|
338 |
6f73c362
|
Renato Botelho
|
|
339 |
|
|
# Make sure source directories are present.
|
340 |
dde49bef
|
Renato Botelho
|
update_freebsd_sources
|
341 |
6f73c362
|
Renato Botelho
|
git_last_commit
|
342 |
|
|
|
343 |
|
|
# Ensure binaries are present that builder system requires
|
344 |
|
|
builder_setup
|
345 |
|
|
|
346 |
|
|
# Build world, kernel and install
|
347 |
|
|
make_world
|
348 |
|
|
|
349 |
|
|
# Build kernels
|
350 |
|
|
build_all_kernels
|
351 |
|
|
|
352 |
7d460897
|
Renato Botelho
|
# Install kernel on installer
|
353 |
f41f9c0c
|
Renato Botelho
|
installkernel ${INSTALLER_CHROOT_DIR} ${PRODUCT_NAME}
|
354 |
7d460897
|
Renato Botelho
|
|
355 |
6f73c362
|
Renato Botelho
|
# Prepare pre-final staging area
|
356 |
|
|
clone_to_staging_area
|
357 |
|
|
|
358 |
|
|
# Install packages needed for Product
|
359 |
|
|
install_pkg_install_ports
|
360 |
|
|
|
361 |
31fd94b3
|
Renato Botelho
|
# Create core repo
|
362 |
|
|
core_pkg_create_repo
|
363 |
|
|
fi
|
364 |
92a1044d
|
Renato Botelho
|
|
365 |
|
|
# Send core repo to staging area
|
366 |
|
|
pkg_repo_rsync "${CORE_PKG_PATH}" ignore_final_rsync
|
367 |
|
|
|
368 |
6f73c362
|
Renato Botelho
|
export DEFAULT_KERNEL=${DEFAULT_KERNEL_ISO:-"${PRODUCT_NAME}"}
|
369 |
|
|
|
370 |
39ef49f6
|
Renato Botelho
|
# XXX: Figure out why wait is failing and proper fix
|
371 |
|
|
# Global variable to keep track of process running in bg
|
372 |
|
|
export _bg_pids=""
|
373 |
|
|
|
374 |
6f73c362
|
Renato Botelho
|
for _IMGTOBUILD in $_IMAGESTOBUILD; do
|
375 |
|
|
# Clean up items that should be cleaned each run
|
376 |
|
|
staginareas_clean_each_run
|
377 |
|
|
|
378 |
ed44fe76
|
Renato Botelho
|
case "${_IMGTOBUILD}" in
|
379 |
|
|
iso)
|
380 |
b17d47b6
|
Renato Botelho
|
if [ -n "${ISO_VARIANTS}" ]; then
|
381 |
|
|
for _variant in ${ISO_VARIANTS}; do
|
382 |
|
|
create_iso_image ${_variant}
|
383 |
|
|
done
|
384 |
|
|
else
|
385 |
|
|
create_iso_image
|
386 |
|
|
fi
|
387 |
ed44fe76
|
Renato Botelho
|
;;
|
388 |
|
|
memstick)
|
389 |
b0d0498c
|
Renato Botelho
|
if [ -n "${MEMSTICK_VARIANTS}" ]; then
|
390 |
|
|
for _variant in ${MEMSTICK_VARIANTS}; do
|
391 |
|
|
create_memstick_image ${_variant}
|
392 |
|
|
done
|
393 |
|
|
else
|
394 |
|
|
create_memstick_image
|
395 |
|
|
fi
|
396 |
ed44fe76
|
Renato Botelho
|
;;
|
397 |
|
|
memstickserial)
|
398 |
|
|
create_memstick_serial_image
|
399 |
|
|
;;
|
400 |
|
|
memstickadi)
|
401 |
|
|
create_memstick_adi_image
|
402 |
|
|
;;
|
403 |
|
|
ova)
|
404 |
b00400ef
|
Renato Botelho
|
old_custom_package_list="${custom_package_list}"
|
405 |
|
|
export custom_package_list="${custom_package_list} ${PRODUCT_NAME}-pkg-Open-VM-Tools"
|
406 |
|
|
install_pkg_install_ports
|
407 |
ed44fe76
|
Renato Botelho
|
create_ova_image
|
408 |
b00400ef
|
Renato Botelho
|
export custom_package_list="${old_custom_package_list}"
|
409 |
ed44fe76
|
Renato Botelho
|
install_pkg_install_ports
|
410 |
|
|
;;
|
411 |
|
|
esac
|
412 |
6f73c362
|
Renato Botelho
|
done
|
413 |
|
|
|
414 |
39ef49f6
|
Renato Botelho
|
if [ -n "${_bg_pids}" ]; then
|
415 |
|
|
if [ -n "${SNAPSHOTS}" ]; then
|
416 |
|
|
snapshots_update_status ">>> NOTE: waiting for jobs: ${_bg_pids} to finish..."
|
417 |
|
|
else
|
418 |
|
|
echo ">>> NOTE: waiting for jobs: ${_bg_pids} to finish..."
|
419 |
|
|
fi
|
420 |
|
|
wait
|
421 |
|
|
|
422 |
|
|
# XXX: For some reason wait is failing, workaround it tracking all PIDs
|
423 |
|
|
while [ -n "${_bg_pids}" ]; do
|
424 |
|
|
_tmp_pids="${_bg_pids}"
|
425 |
|
|
unset _bg_pids
|
426 |
|
|
for p in ${_tmp_pids}; do
|
427 |
|
|
[ -z "${p}" ] \
|
428 |
|
|
&& continue
|
429 |
|
|
|
430 |
|
|
kill -0 ${p} >/dev/null 2>&1 \
|
431 |
|
|
&& _bg_pids="${_bg_pids}${_bg_pids:+ }${p}"
|
432 |
|
|
done
|
433 |
|
|
[ -n "${_bg_pids}" ] \
|
434 |
|
|
&& sleep 1
|
435 |
|
|
done
|
436 |
cc145494
|
Renato Botelho
|
fi
|
437 |
6f73c362
|
Renato Botelho
|
|
438 |
ab943fc9
|
Renato Botelho
|
if [ -n "${SNAPSHOTS}" ]; then
|
439 |
f6c83d05
|
Renato Botelho
|
if [ "${IMAGETYPE}" = "none" -a -n "${UPLOAD}" ]; then
|
440 |
ddf56629
|
Renato Botelho
|
pkg_repo_rsync "${CORE_PKG_PATH}"
|
441 |
|
|
elif [ "${IMAGETYPE}" != "none" ]; then
|
442 |
f26731b0
|
Renato Botelho
|
snapshots_create_sha256
|
443 |
ddf56629
|
Renato Botelho
|
# SCP files to snapshot web hosting area
|
444 |
f6c83d05
|
Renato Botelho
|
if [ -n "${UPLOAD}" ]; then
|
445 |
ddf56629
|
Renato Botelho
|
snapshots_scp_files
|
446 |
|
|
fi
|
447 |
ab943fc9
|
Renato Botelho
|
fi
|
448 |
|
|
# Alert the world that we have some snapshots ready.
|
449 |
|
|
snapshots_update_status ">>> Builder run is complete."
|
450 |
|
|
fi
|
451 |
6f73c362
|
Renato Botelho
|
|
452 |
6b733d47
|
Renato Botelho
|
echo ">>> ${IMAGES_FINAL_DIR} now contains:"
|
453 |
b34d81ce
|
Renato Botelho
|
(cd ${IMAGES_FINAL_DIR} && find ${IMAGES_FINAL_DIR} -type f)
|
454 |
6b733d47
|
Renato Botelho
|
|
455 |
6f73c362
|
Renato Botelho
|
set -e
|
456 |
|
|
# Run final finish routines
|
457 |
|
|
finish
|