kas-docker: make usage printing POSIX compatible

The usage of 'echo -e' for printing the usage message is not POSIX
conform and is not being supported in the default shell of Debian
(dash).

As the 'Rationale' of the POSIX 'printf' documentation states, it was
created "due to irreconcilable differences in the various versions of
echo extant" and it should provide better compatibility throughout
different shells.

Signed-off-by: Silvano Cirujano Cuesta <silvano.cirujano-cuesta@siemens.com>
This commit is contained in:
Cirujano Cuesta, Silvano 2018-11-07 13:30:03 +00:00 committed by Daniel Wagner
parent 7155769f06
commit 0eb2f5edeb

View File

@ -29,17 +29,17 @@ set -e
usage()
{
echo "Usage: $0 [OPTIONS] { build | shell } KASFILE"
echo " $0 [OPTIONS] clean"
echo -e "\nPositional arguments:"
echo -e "build\t\tCheck out repositories and build target."
echo -e "shell\t\tRun a shell in the build environment."
echo -e "clean\t\tClean build artifacts, keep downloads."
echo -e "\nOptional arguments:"
echo -e "--isar\t\tUse kas-isar container to build Isar image."
echo -e "--docker-args\tAdditional arguments to pass to docker for" \
"running the build."
echo -e "-v\t\tPrint operations."
printf "%b" "Usage: $0 [OPTIONS] { build | shell } KASFILE\n"
printf "%b" " $0 [OPTIONS] clean\n"
printf "%b" "\nPositional arguments:\n"
printf "%b" "build\t\tCheck out repositories and build target.\n"
printf "%b" "shell\t\tRun a shell in the build environment.\n"
printf "%b" "clean\t\tClean build artifacts, keep downloads.\n"
printf "%b" "\nOptional arguments:\n"
printf "%b" "--isar\t\tUse kas-isar container to build Isar image.\n"
printf "%b" "--docker-args\tAdditional arguments to pass to docker for" \
"running the build.\n"
printf "%b" "-v\t\tPrint operations.\n"
exit 1
}