Skip to content
Snippets Groups Projects
Unverified Commit 3d1860e0 authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

build: allow using DEVICES variable for sysupgrade_image/factory_image images

Setting DEVICES will also suppress cleaning the package directory,
improving incremental build speed.
parent 6b62e2fc
No related branches found
No related tags found
No related merge requests found
...@@ -17,4 +17,4 @@ fi ...@@ -17,4 +17,4 @@ fi
rm -f "lede/bin/targets/${LEDE_BINDIR}"/* 2>/dev/null || true rm -f "lede/bin/targets/${LEDE_BINDIR}"/* 2>/dev/null || true
# Full builds will output the "packages" directory, so clean up first # Full builds will output the "packages" directory, so clean up first
[ "$has_devices" ] || rm -rf "lede/bin/targets/${LEDE_BINDIR}/packages" [ "$DEVICES" ] || rm -rf "lede/bin/targets/${LEDE_BINDIR}/packages"
...@@ -31,36 +31,32 @@ sysupgrade() { ...@@ -31,36 +31,32 @@ sysupgrade() {
} }
if [ "$DEVICES" ]; then unknown_devices="$DEVICES"
has_devices=1
else
has_devices=
fi
want_device() { want_device() {
[ "$has_devices" ] || return 0 [ "$DEVICES" ] || return 0
local new_devices='' local new_devices=''
local ret=1
for device in $DEVICES; do for device in $unknown_devices; do
if [ "$device" = "$1" ]; then if [ "$device" != "$1" ]; then
ret=0
else
new_devices="${new_devices:+${new_devices} }$device" new_devices="${new_devices:+${new_devices} }$device"
fi fi
done done
unknown_devices=$new_devices
DEVICES=$new_devices for device in $DEVICES; do
if [ "$device" = "$1" ]; then
return 0
fi
done
return $ret return 1
} }
check_devices() { check_devices() {
[ "$has_devices" ] || return 0 if [ "$unknown_devices" ]; then
echo "Error: unknown devices given: ${unknown_devices}" >&2
if [ "$DEVICES" ]; then
echo "Error: unknown devices given: $DEVICES" >&2
exit 1 exit 1
fi fi
} }
...@@ -149,7 +149,7 @@ sysupgrade() { ...@@ -149,7 +149,7 @@ sysupgrade() {
. targets/"$1"; copy . targets/"$1"; copy
# Copy opkg repo # Copy opkg repo
if [ -z "$has_devices" ]; then if [ -z "$DEVICES" ]; then
rm -f "$GLUON_PACKAGEDIR"/*/"$LEDE_BINDIR"/* rm -f "$GLUON_PACKAGEDIR"/*/"$LEDE_BINDIR"/*
rmdir -p "$GLUON_PACKAGEDIR"/*/"$LEDE_BINDIR" 2>/dev/null || true rmdir -p "$GLUON_PACKAGEDIR"/*/"$LEDE_BINDIR" 2>/dev/null || true
mkdir -p "${GLUON_PACKAGEDIR}/${PACKAGE_PREFIX}/${LEDE_BINDIR}" mkdir -p "${GLUON_PACKAGEDIR}/${PACKAGE_PREFIX}/${LEDE_BINDIR}"
......
...@@ -67,6 +67,16 @@ device() { ...@@ -67,6 +67,16 @@ device() {
done done
} }
factory_image() {
output="$1"
want_device "${output}" || return 0
}
sysupgrade_image() {
output="$1"
want_device "${output}" || return 0
}
packages() { packages() {
if [ "${output}" ]; then if [ "${output}" ]; then
want_device "${output}" || return 0 want_device "${output}" || return 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment