summaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-03-30 12:08:12 +0100
committerRaphaƫl Hertzog <hertzog@debian.org>2020-04-23 16:09:00 +0200
commitb28095bd56476178e148d735d2073aefaa7ffcc3 (patch)
treeb49cce034b310a916674af5b2fd73fca979d57c1 /frontend
parent8ffe48d8f3825a3741deeb0a45e5372b5ed5504c (diff)
downloadvyos-live-build-b28095bd56476178e148d735d2073aefaa7ffcc3.tar.gz
vyos-live-build-b28095bd56476178e148d735d2073aefaa7ffcc3.zip
frontend: reorder checks
perform the check that the script exists before sorting out the environment to give it, or checking root privileges. Gbp-Dch: Short
Diffstat (limited to 'frontend')
-rwxr-xr-xfrontend/lb31
1 files changed, 15 insertions, 16 deletions
diff --git a/frontend/lb b/frontend/lb
index 0ebcc200e..43b822fcb 100755
--- a/frontend/lb
+++ b/frontend/lb
@@ -42,22 +42,6 @@ esac
COMMAND="${1}"
shift
-ENV=""
-
-if [ "${COMMAND}" != "config" ]; then
- # Checking user account
- if [ "$(id -u)" -ne "0" ]; then
- Echo_error "Root privileges needed!"
- exit 1
- fi
-fi
-
-for _FILE in config/environment config/environment.binary; do
- if [ -e "${_FILE}" ]; then
- ENV="${ENV} $(grep -v '^#' ${_FILE})"
- fi
-done
-
if [ -x "${LIVE_BUILD}/scripts/build/${COMMAND}" ]; then
# User has live-build copied locally in the system
SCRIPT="${LIVE_BUILD}/scripts/build/${COMMAND}"
@@ -75,6 +59,21 @@ else
exit 1
fi
+if [ "${COMMAND}" != "config" ]; then
+ # Checking user account
+ if [ "$(id -u)" -ne "0" ]; then
+ Echo_error "Root privileges needed!"
+ exit 1
+ fi
+fi
+
+ENV=""
+for _FILE in config/environment config/environment.binary; do
+ if [ -e "${_FILE}" ]; then
+ ENV="${ENV} $(grep -v '^#' ${_FILE})"
+ fi
+done
+
_CMD_LABEL="lb ${COMMAND}"
if [ "${_COLOR_OUT}" = "true" ]; then
_CMD_LABEL="${CYAN}${_CMD_LABEL}${NO_COLOR}"