Copy build.sh from 0.8.x

This commit is contained in:
Daniel Frank 2017-10-30 21:08:43 +01:00
parent 3e1e1a5c4c
commit a4bb8b863d

View file

@ -1,7 +1,5 @@
#!/bin/bash -e
set -e
function announce () {
echo '############################' $* >&2
}
@ -9,10 +7,11 @@ function announce () {
proc=$(nproc)
gluon_out="${HOME}/firmware"
while getopts g:j:o:bv opt; do
while getopts g:j:o:s:bv opt; do
case "$opt" in
g) gluon_path="$OPTARG" ;;
o) gluon_out="$OPTARG" ;;
s) signature="$OPTARG" ;;
b) export BROKEN=1 ;;
j) proc="$OPTARG" ;;
v) verbose=V=s ;;
@ -22,6 +21,7 @@ if [ -z "${gluon_path}" ]; then
echo "Usage: $0 -g GLUON_PATH" >&2
echo " -g GLUON_PATH Path to a checkout of the gluon repository." >&2
echo " -o OUT_PATH Path to a checkout of the gluon repository. Default: ${gluon_out}" >&2
echo " -s SIGNATURE Sign firmware with signature" >&2
echo " -b BROKEN=1" >&2
echo " -v verbose" >&2
echo " -j JOBS Run build with -jJOBS. Default: ${proc}" >&2
@ -29,7 +29,6 @@ if [ -z "${gluon_path}" ]; then
fi
gluon_path=$(realpath $gluon_path)
mkdir -p ${gluon_out}
gluon_out=$(realpath $gluon_out)
site_path=$(realpath $(dirname $BASH_SOURCE))
@ -40,12 +39,13 @@ announce FFHH SITES: $site_path >&2
announce Building site repo and reading data >&2
pushd $site_path > /dev/null
make
. info
. ./info
export GLUON_RELEASE
export GLUON_BRANCH
# get the available sites...
sites=""
for s in sites/*; do sites="${sites} ${s##*/}"; done
if [ "$sites" == "" ]; then
for s in sites/*; do sites="${sites} ${s##*/}"; done
fi
announce Gluon will be built for the following sites:$sites >&2
announce The following targets will be generated: $targets >&2
popd >/dev/null
@ -54,7 +54,7 @@ pushd "${gluon_path}" >/dev/null
announce Starting make update...
for s in $sites; do
export GLUON_SITEDIR="${site_path}/sites/${s}"
export GLUON_OUTPUTDIR="${gluon_out}/${s}/${GLUON_BRANCH}/${GLUON_RELEASE}"
export GLUON_OUTPUTDIR="${gluon_out}/${GLUON_RELEASE}/${GLUON_BRANCH}/${s}"
export GLUON_IMAGEDIR="${GLUON_OUTPUTDIR}/images"
export GLUON_MODULEDIR="${GLUON_OUTPUTDIR}/modules"
rm -rf "${GLUON_OUTPUTDIR}"
@ -69,10 +69,21 @@ for s in $sites; do
fi
done
for t in $targets; do
announce make clean for $s/$t... >&2
make -j1 clean GLUON_TARGET=$t
announce Starting build for $s/$t... >&2
make -j$(nproc) GLUON_TARGET=$t $verbose
done
announce Building manifest...
make manifest
if [ -n "${signature}" ]; then
if [ "$GLUON_BRANCH" == "experimental" ]; then
announce Signing
"${gluon_path}/contrib/sign.sh" "${signature}" "${GLUON_IMAGEDIR}/sysupgrade/experimental.manifest"
else
echo ERROR: can only sign experimental branch >&2
exit 1
fi
fi
done
popd >/dev/null