forked from freifunk-franken/firmware
buildscript: add color to the root warning
Use color output when the `tput` command is available. `tput` handles terminal-dependant capabilities, so the script should remain portable. Signed-off-by: Johannes Kimmel <fff@bareminimum.eu>
This commit is contained in:
parent
b3c05f60ea
commit
6860eee843
|
@ -381,8 +381,12 @@ buildall() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$(/usr/bin/id -u)" -eq 0 ]; then
|
if [ "$(/usr/bin/id -u)" -eq 0 ]; then
|
||||||
echo "WARNING: buildscript is running as root"
|
TPUT=$(command -v tput || echo ":")
|
||||||
echo "WARNING: build may fail at a later stage"
|
textWarn="$($TPUT bold setaf 1)" # bold + red
|
||||||
|
textReset="$($TPUT sgr0)" # be a good citizen
|
||||||
|
|
||||||
|
printf "${textWarn}WARNING: buildscript is running as root${textReset}\n"
|
||||||
|
printf "${textWarn}WARNING: build may fail at a later stage${textReset}\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" != "selectbsp" -a "$1" != "selectvariant" ]; then
|
if [ "$1" != "selectbsp" -a "$1" != "selectvariant" ]; then
|
||||||
|
|
Loading…
Reference in New Issue