Add an IS_GLINUX check

- Override lots of auto-fetching from caches based on the value of
IS_GLINUX. This could also be used to turn off other glinux-specific
behavior.

Change-Id: I7a539c1aa1dd366349e9cf70724fa44143046389
diff --git a/debootstrap.mk b/debootstrap.mk
index f3b33f9..3d9b3d7 100644
--- a/debootstrap.mk
+++ b/debootstrap.mk
@@ -5,7 +5,7 @@
 include $(ROOTDIR)/build/preamble.mk
 
 DEBOOTSTRAP_TARBALL_REVISION ?= latest
-DEBOOTSTRAP_FETCH_TARBALL ?= true
+DEBOOTSTRAP_FETCH_TARBALL ?= $(IS_GLINUX)
 
 validate-bootstrap-tarball: $(DEBOOTSTRAP_TARBALL)
 	cd $(ROOTDIR)/cache && \
diff --git a/docker.mk b/docker.mk
index e0a15ca..d434e78 100644
--- a/docker.mk
+++ b/docker.mk
@@ -4,8 +4,8 @@
 
 include $(ROOTDIR)/build/preamble.mk
 
-ARM64_BUILDER_FETCH_TARBALL ?= true
-DOCKER_FETCH_TARBALL ?= true
+ARM64_BUILDER_FETCH_TARBALL ?= $(IS_GLINUX)
+DOCKER_FETCH_TARBALL ?= $(IS_GLINUX)
 
 docker-build: $(ROOTDIR)/cache/aiy-board-builder.tar
 ifeq ($(DOCKER_FETCH_TARBALL),true)
diff --git a/preamble.mk b/preamble.mk
index 90f5d71..e3469e9 100644
--- a/preamble.mk
+++ b/preamble.mk
@@ -1,6 +1,11 @@
 # Preamble. Don't define any targets in this file! This is effectively just a
 # common header where useful global vars go.
 
+IS_GLINUX ?= false
+ifneq (,$(wildcard /etc/dpkg/origins/glinux))
+	IS_GLINUX = true
+endif
+
 # Globally useful directories
 TOOLCHAIN := $(ROOTDIR)/toolchains/aarch64-linux-android/bin/aarch64-linux-android-
 
@@ -14,7 +19,7 @@
 DEBOOTSTRAP_TARBALL_SHA256 := $(ROOTDIR)/cache/debootstrap.tgz.sha256sum
 
 FETCH_PBUILDER_DIRECTORY ?= /google/data/ro/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/pbuilder
-FETCH_PBUILDER_BASE ?= true
+FETCH_PBUILDER_BASE ?= $(IS_GLINUX)
 
 DEBOOTSTRAP_EXTRA := \
 	alsa-utils \
@@ -126,6 +131,6 @@
 
 PREBUILT_DOCKER_ROOT ?= /google/data/ro/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/docker
 
-FETCH_PACKAGES ?= true
+FETCH_PACKAGES ?= $(IS_GLINUX)
 PACKAGES_REVISION ?= latest
 PACKAGES_FETCH_ROOT_DIRECTORY ?= /google/data/ro/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/continuous
diff --git a/rootfs.mk b/rootfs.mk
index 2df4802..48ba58b 100644
--- a/rootfs.mk
+++ b/rootfs.mk
@@ -8,7 +8,7 @@
 ROOTFS_RAW_IMG := $(PRODUCT_OUT)/obj/ROOTFS/rootfs.raw.img
 ROOTFS_PATCHED_IMG := $(PRODUCT_OUT)/obj/ROOTFS/rootfs.patched.img
 
-ROOTFS_FETCH_TARBALL ?= true
+ROOTFS_FETCH_TARBALL ?= $(IS_GLINUX)
 ROOTFS_REVISION ?= latest
 
 PRE_INSTALL_PACKAGES := \