summaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-03-11 22:33:50 +0000
committerRaphaƫl Hertzog <hertzog@debian.org>2020-03-13 14:20:12 +0000
commit67930f3e6e2ca1312d8e047e20ba8bb783e636bd (patch)
treeff52ce41f25082966f5860551d839fca3509fbef /frontend
parent9f42bc1bdc0133873cd4bcc881beb1b86fb638c1 (diff)
downloadvyos-live-build-67930f3e6e2ca1312d8e047e20ba8bb783e636bd.tar.gz
vyos-live-build-67930f3e6e2ca1312d8e047e20ba8bb783e636bd.zip
frontend: tidy
no need to have exit in both conditions no need to have most of the script within a case branch when all other cases result in an exit. Gbp-Dch: Short
Diffstat (limited to 'frontend')
-rwxr-xr-xfrontend/lb84
1 files changed, 36 insertions, 48 deletions
diff --git a/frontend/lb b/frontend/lb
index 464b07dcc..47193a5f1 100755
--- a/frontend/lb
+++ b/frontend/lb
@@ -21,14 +21,12 @@ USAGE="lb {clean|config|build}"
case "${1}" in
-h|--help)
- if [ $(which man) ]
- then
+ if [ $(which man) ]; then
man lb
- exit 0
else
${0} --usage
- exit 0
fi
+ exit 0
;;
""|-u|--usage)
@@ -39,53 +37,43 @@ case "${1}" in
echo "${VERSION}"
exit 0
;;
+esac
- *)
- COMMAND="${1}"
- shift
+COMMAND="${1}"
+shift
- ENV=""
+ENV=""
- if [ "${COMMAND}" != "config" ]
- then
- # Checking user account
- if [ "$(id -u)" -ne "0" ]
- then
- Echo_error "Root privileges needed!"
- 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
- for _FILE in config/environment config/environment.binary
- do
- if [ -e "${_FILE}" ]
- then
- ENV="${ENV} $(grep -v '^#' ${_FILE})"
- fi
- done
+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}"
- elif [ -x "local/live-build/scripts/build/${COMMAND}" ]
- then
- # User has live-build copied locally in the config
- SCRIPT="local/live-build/scripts/build/${COMMAND}"
- elif [ -x /usr/lib/live/build/${COMMAND} ]
- then
- # User has live-build installed in the system
- SCRIPT=/usr/lib/live/build/"${COMMAND}"
- elif [ $(which "${COMMAND}") ]
- then
- # User has live-build commands in path
- SCRIPT="${COMMAND}"
- else
- Echo_error "No such script: ${COMMAND}"
- exit 1
- fi
+if [ -x "${LIVE_BUILD}/scripts/build/${COMMAND}" ]; then
+ # User has live-build copied locally in the system
+ SCRIPT="${LIVE_BUILD}/scripts/build/${COMMAND}"
+elif [ -x "local/live-build/scripts/build/${COMMAND}" ]; then
+ # User has live-build copied locally in the config
+ SCRIPT="local/live-build/scripts/build/${COMMAND}";
+elif [ -x /usr/lib/live/build/${COMMAND} ]; then
+ # User has live-build installed in the system
+ SCRIPT=/usr/lib/live/build/"${COMMAND}"
+elif [ $(which "${COMMAND}") ]; then
+ # User has live-build commands in path
+ SCRIPT="${COMMAND}"
+else
+ Echo_error "No such script: ${COMMAND}"
+ exit 1
+fi
- Echo "[%s] %s" "$(date +'%F %T')" "lb ${COMMAND} $(echo ${@})"
- ${ENV} exec "${SCRIPT}" "${@}"
- ;;
-esac
+Echo "[%s] %s" "$(date +'%F %T')" "lb ${COMMAND} $(echo ${@})"
+${ENV} exec "${SCRIPT}" "${@}"