From 2c4f0229940e030d40e626d9978a5f3cfd4b6cef Mon Sep 17 00:00:00 2001
From: bobcanthelpyou <bobcanthelpyou@users.noreply.github.com>
Date: Fri, 12 Apr 2019 01:05:04 +0200
Subject: [PATCH] build: rename DEVICES to GLUON_DEVICES (#1686)

---
 Makefile                      | 2 +-
 docs/user/getting_started.rst | 6 ++++++
 scripts/clean_output.sh       | 2 +-
 scripts/common.inc.sh         | 6 +++---
 scripts/copy_output.sh        | 2 +-
 5 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 22f3eba4d..ab363f3b2 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,7 @@ $(eval $(call mkabspath,GLUON_OUTPUTDIR))
 $(eval $(call mkabspath,GLUON_IMAGEDIR))
 $(eval $(call mkabspath,GLUON_PACKAGEDIR))
 
-export GLUON_TMPDIR GLUON_IMAGEDIR GLUON_PACKAGEDIR DEVICES
+export GLUON_TMPDIR GLUON_IMAGEDIR GLUON_PACKAGEDIR GLUON_DEVICES
 
 
 $(GLUON_SITEDIR)/site.mk:
diff --git a/docs/user/getting_started.rst b/docs/user/getting_started.rst
index ba1bf0be1..466094e0b 100644
--- a/docs/user/getting_started.rst
+++ b/docs/user/getting_started.rst
@@ -186,6 +186,12 @@ GLUON_TARGET
 Special variables
 .................
 
+GLUON_DEVICES
+  List of devices to build. The list contains the Gluon profile name of a device, the profile
+  name is the first parameter of the ``device`` command in a target file.
+  e.g. ``GLUON_DEVICES="avm-fritz-box-4020 tp-link-tl-wdr4300-v1"``.
+  Empty by default to build all devices of a target.
+
 GLUON_IMAGEDIR
   Path where images will be stored. Defaults to ``$(GLUON_OUTPUTDIR)/images``.
 
diff --git a/scripts/clean_output.sh b/scripts/clean_output.sh
index 1b025fdd7..c71fc86ac 100755
--- a/scripts/clean_output.sh
+++ b/scripts/clean_output.sh
@@ -17,4 +17,4 @@ fi
 rm -f "openwrt/bin/targets/${OPENWRT_BINDIR}"/* 2>/dev/null || true
 
 # Full builds will output the "packages" directory, so clean up first
-[ "$DEVICES" ] || rm -rf "openwrt/bin/targets/${OPENWRT_BINDIR}/packages"
+[ "$GLUON_DEVICES" ] || rm -rf "openwrt/bin/targets/${OPENWRT_BINDIR}/packages"
diff --git a/scripts/common.inc.sh b/scripts/common.inc.sh
index ea09c70d7..c3ad5670e 100644
--- a/scripts/common.inc.sh
+++ b/scripts/common.inc.sh
@@ -47,10 +47,10 @@ no_opkg() {
 }
 
 
-unknown_devices="$DEVICES"
+unknown_devices="$GLUON_DEVICES"
 
 want_device() {
-	[ "$DEVICES" ] || return 0
+	[ "$GLUON_DEVICES" ] || return 0
 
 	local new_devices=''
 
@@ -61,7 +61,7 @@ want_device() {
 	done
 	unknown_devices=$new_devices
 
-	for device in $DEVICES; do
+	for device in $GLUON_DEVICES; do
 		if [ "$device" = "$1" ]; then
 			return 0
 		fi
diff --git a/scripts/copy_output.sh b/scripts/copy_output.sh
index 3454e6e37..d84d5fe2c 100755
--- a/scripts/copy_output.sh
+++ b/scripts/copy_output.sh
@@ -194,7 +194,7 @@ no_opkg() {
 . targets/"$1"; copy
 
 # Copy opkg repo
-if [ -z "$no_opkg" -a -z "$DEVICES" ]; then
+if [ -z "$no_opkg" -a -z "$GLUON_DEVICES" ]; then
 	rm -f "$GLUON_PACKAGEDIR"/*/"$OPENWRT_BINDIR"/*
 	rmdir -p "$GLUON_PACKAGEDIR"/*/"$OPENWRT_BINDIR" 2>/dev/null || true
 	mkdir -p "${GLUON_PACKAGEDIR}/${PACKAGE_PREFIX}/${OPENWRT_BINDIR}"
-- 
GitLab