Files
modules/doc/example/compiler-etc-dependencies/example-sessions/common_code.sh
Lukáš Zaoral a45f186200 lint(ShellCheck): fix SC2148 error
According to ShellCheck's documentation:

Different shells support different features.  To give effective advice,
ShellCheck needs to know which shell your script is going to run on.

Related: https://www.shellcheck.net/wiki/SC2148
Related: #470
2022-09-02 09:52:05 +02:00

66 lines
1.0 KiB
Bash

# shellcheck shell=sh
#
# This should be sourced from the other scripts
# Make sure TMP_MODVERSION and TMP_STRATEGY are set
if [ "x$TMP_MODVERSION" = "x" ]; then
echo >&2 "ERROR: TMP_MODVERSION not set"
exit
fi
if [ "x$TMP_STRATEGY" = "x" ]; then
echo >&2 "ERROR: TMP_STRATEGY not set"
exit
fi
# Set prompt
TMP_PROMPT="mod${TMP_MODVERSION}"
case $TMP_STRATEGY in
flavours)
#This really means MODVERSION is flavours version
TMP_PROMPT="${TMP_PROMPT}-flavours"
;;
homebrewed|modulerc|modulepath)
TMP_PROMPT="${TMP_PROMPT} ($TMP_STRATEGY)"
;;
*)
echo >&2 "ERROR: unrecognized value '$TMP_STRATEGY' for TMP_STRATEGY"
exit 1
;;
esac
#Define do_cmd function
do_cmd()
{ cmd="$@"
echo "[$TMP_PROMPT]$ $cmd"
$cmd
}
#Define variables GCCGNU to be gcc or gnu
case $TMP_STRATEGY in
flavours)
GCCGNU=gnu
;;
*)
GCCGNU=gcc
;;
esac
#Define AUTOFLAG to be "" or --auto
case $TMP_MODVERSION in
3)
AUTOFLAG=
;;
4)
case $TMP_STRATEGY in
flavours)
AUTOFLAG=
;;
*)
AUTOFLAG="--auto"
;;
esac
;;
esac