Browse Source
Parse user arguments, before exiting on arguments missing
Previously, it was not possible to read the help text, without having defined
certain user variables the script needs (like MENDER_ARTIFACT_NAME). Thus
reading the usage help-info was sort of tedious.
This commit gives the user commands higher priority, which fixes the error.
Changelog: None
Signed-off-by: Ole Petter <ole.orhagen@northern.tech>
2.0.x
Ole Petter
5 years ago
No known key found for this signature in database
GPG Key ID: A7100375167A7B21
1 changed files with
18 additions and
18 deletions
mender-convert
@ -54,22 +54,6 @@ function trap_term() {
trap trap_term INT TERM
trap trap_term INT TERM
trap trap_exit EXIT
trap trap_exit EXIT
mender_convert_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
if [ "${mender_convert_dir}" != "${PWD}" ]; then
echo "You must execute mender-convert from the root directory: ${mender_convert_dir}"
exit 1
fi
if [ -z "${MENDER_ARTIFACT_NAME}" ]; then
echo "Sorry, it seems that you have not defined MENDER_ARTIFACT_NAME"
echo "You can do this with the following command:"
echo ""
echo -e "\tMENDER_ARTIFACT_NAME="release-1" ./mender-convert"
exit 1
fi
source modules/bootstrap.sh
# We only handle a selection of the arguments here, the rest are passed on
# We only handle a selection of the arguments here, the rest are passed on
# to the sub-scripts.
# to the sub-scripts.
while (( "$#" )); do
while (( "$#" )); do
@ -88,6 +72,22 @@ while (( "$#" )); do
esac
esac
done
done
mender_convert_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
if [ "${mender_convert_dir}" != "${PWD}" ]; then
echo "You must execute mender-convert from the root directory: ${mender_convert_dir}"
exit 1
fi
if [ -z "${MENDER_ARTIFACT_NAME}" ]; then
echo "Sorry, it seems that you have not defined MENDER_ARTIFACT_NAME"
echo "You can do this with the following command:"
echo ""
echo -e "\tMENDER_ARTIFACT_NAME="release-1" ./mender-convert"
exit 1
fi
source modules/bootstrap.sh
mkdir -p work
mkdir -p work
touch work/convert.log
touch work/convert.log