summaryrefslogtreecommitdiff
path: root/shell_utils.sh
diff options
context:
space:
mode:
author Joe Onorato <joeo@google.com> 2024-05-15 18:40:12 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-05-15 18:40:12 +0000
commit5c9f86dcd8296ecb645d16b24d76d199fc7c4b9c (patch)
tree64366500a10781666062210cc80796d163e90f73 /shell_utils.sh
parentf52e8788a2d7f1dd42375b9c1cc2d375d836d437 (diff)
parent2312475f66d21b74162f6cfcdf5bd9cc4f5e9fc4 (diff)
Merge changes from topic "joeo_envsetup" into main
* changes: Clean cruft out of envsetup.sh. Provide a function in envsetup.sh to get the host arch directly
Diffstat (limited to 'shell_utils.sh')
-rw-r--r--shell_utils.sh15
1 files changed, 12 insertions, 3 deletions
diff --git a/shell_utils.sh b/shell_utils.sh
index 9de5a504e5..15051e9585 100644
--- a/shell_utils.sh
+++ b/shell_utils.sh
@@ -40,9 +40,7 @@ function gettop
fi
}
-# Sets TOP, or if the root of the tree can't be found, prints a message and
-# exits. Since this function exits, it should not be called from functions
-# defined in envsetup.sh.
+# Asserts that the root of the tree can be found.
if [ -z "${IMPORTING_ENVSETUP:-}" ] ; then
function require_top
{
@@ -54,6 +52,17 @@ function require_top
}
fi
+# Asserts that the lunch variables have been set
+if [ -z "${IMPORTING_ENVSETUP:-}" ] ; then
+function require_lunch
+{
+ if [[ ! $TARGET_PRODUCT || ! $TARGET_RELEASE || ! $TARGET_BUILD_VARIANT ]] ; then
+ echo "Please run lunch and try again." >&2
+ exit 1
+ fi
+}
+fi
+
function getoutdir
{
local top=$(gettop)