diff options
author | Lyndon Brown <jnqnfe@gmail.com> | 2020-03-30 12:08:12 +0100 |
---|---|---|
committer | Raphaƫl Hertzog <hertzog@debian.org> | 2020-04-23 16:09:00 +0200 |
commit | b28095bd56476178e148d735d2073aefaa7ffcc3 (patch) | |
tree | b49cce034b310a916674af5b2fd73fca979d57c1 /frontend | |
parent | 8ffe48d8f3825a3741deeb0a45e5372b5ed5504c (diff) | |
download | vyos-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-x | frontend/lb | 31 |
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}" |