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
This commit is contained in:
parent
8ffe48d8f3
commit
b28095bd56
31
frontend/lb
31
frontend/lb
|
@ -42,22 +42,6 @@ esac
|
||||||
COMMAND="${1}"
|
COMMAND="${1}"
|
||||||
shift
|
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
|
if [ -x "${LIVE_BUILD}/scripts/build/${COMMAND}" ]; then
|
||||||
# User has live-build copied locally in the system
|
# User has live-build copied locally in the system
|
||||||
SCRIPT="${LIVE_BUILD}/scripts/build/${COMMAND}"
|
SCRIPT="${LIVE_BUILD}/scripts/build/${COMMAND}"
|
||||||
|
@ -75,6 +59,21 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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}"
|
_CMD_LABEL="lb ${COMMAND}"
|
||||||
if [ "${_COLOR_OUT}" = "true" ]; then
|
if [ "${_COLOR_OUT}" = "true" ]; then
|
||||||
_CMD_LABEL="${CYAN}${_CMD_LABEL}${NO_COLOR}"
|
_CMD_LABEL="${CYAN}${_CMD_LABEL}${NO_COLOR}"
|
||||||
|
|
Loading…
Reference in New Issue