Fixed missing exit codes

This commit is contained in:
Solo Builder 2017-08-07 18:58:13 -04:00
parent 49ad5b0cf2
commit 2d26a9b96d

View File

@ -1,4 +1,6 @@
#!/bin/sh #!/bin/sh
shopt -s xpg_echo
# -*- mode: shell-script; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- # -*- mode: shell-script; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# #
# Copyright (C) 2012, 2013 O.S. Systems Software LTDA. # Copyright (C) 2012, 2013 O.S. Systems Software LTDA.
@ -26,7 +28,7 @@ PROGNAME="setup-environment"
usage() usage()
{ {
echo -e "\nUsage: source $PROGNAME <build-dir> echo "\nUsage: source $PROGNAME <build-dir>
<build-dir>: required option; specifies build directory location <build-dir>: required option; specifies build directory location
By default the script will setup MACHINE to be imx6solo-3dr-1080p. By default the script will setup MACHINE to be imx6solo-3dr-1080p.
@ -56,7 +58,7 @@ ARGS=$(getopt --options $SHORTOPTS \
# Print the usage menu if invalid options are specified # Print the usage menu if invalid options are specified
if [ $? != 0 -o $# -lt 1 ]; then if [ $? != 0 -o $# -lt 1 ]; then
usage && clean_up usage && clean_up
return 1 exit 1
fi fi
eval set -- "$ARGS" eval set -- "$ARGS"
@ -66,7 +68,7 @@ do
-h|--help) -h|--help)
usage usage
clean_up clean_up
return 0 exit 0
;; ;;
--) --)
shift shift
@ -76,7 +78,8 @@ do
done done
if [ "$(whoami)" = "root" ]; then if [ "$(whoami)" = "root" ]; then
echo "ERROR: do not use the BSP as root. Exiting..." echo "\nERROR: do not use the BSP as root. Exiting..."
exit 1
fi fi
if [ -z "$MACHINE" ]; then if [ -z "$MACHINE" ]; then
@ -87,9 +90,9 @@ fi
LIST_MACHINES=`ls -1 $CWD/sources/*/conf/machine` LIST_MACHINES=`ls -1 $CWD/sources/*/conf/machine`
VALID_MACHINE=`echo -e "$LIST_MACHINES" | grep ${MACHINE}.conf$ | wc -l` VALID_MACHINE=`echo -e "$LIST_MACHINES" | grep ${MACHINE}.conf$ | wc -l`
if [ "x$MACHINE" = "x" ] || [ "$VALID_MACHINE" = "0" ]; then if [ "x$MACHINE" = "x" ] || [ "$VALID_MACHINE" = "0" ]; then
echo -e "\nSPECIFIED AN INVALID MACHINE TYPE !" echo"\nERROR: Invalid machine type"
usage && clean_up usage && clean_up
return 1 exit 1
else else
echo "Configuring for ${MACHINE}" echo "Configuring for ${MACHINE}"
fi fi
@ -122,8 +125,9 @@ for f in $CWD/sources/base/*; do
fi fi
done done
if [ "$updated" = "true" ]; then if [ "$updated" = "true" ]; then
echo "The project root content has been updated. Please run $0 again."
return echo "\nACTION REQUIRED: The project root content has been updated. Please run $0 again."
exit 1
fi fi
cd $OEROOT cd $OEROOT
@ -238,7 +242,7 @@ Your build environemnt has been configured with:
EULA=$EULA EULA=$EULA
EOF EOF
else else
echo "Your configuration files at $1 has not been touched." echo "Your configuration files at $1 have not been touched."
fi fi
clean_up clean_up