From b3c05f60eadff105e6c23967cff7fd231ba0f0cd Mon Sep 17 00:00:00 2001 From: Johannes Kimmel Date: Fri, 19 Jan 2024 22:38:47 +0100 Subject: [PATCH 1/2] buildscript: print warning instead of failing build Signed-off-by: Johannes Kimmel --- buildscript | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildscript b/buildscript index fe1aa607..422008d0 100755 --- a/buildscript +++ b/buildscript @@ -381,8 +381,8 @@ buildall() { } if [ "$(/usr/bin/id -u)" -eq 0 ]; then - echo "don't run buildscript as root" - exit 1 + echo "WARNING: buildscript is running as root" + echo "WARNING: build may fail at a later stage" fi if [ "$1" != "selectbsp" -a "$1" != "selectvariant" ]; then -- 2.39.2 From 6860eee843c4bdbc3c9f0d4eac4cb6815ca668d1 Mon Sep 17 00:00:00 2001 From: Johannes Kimmel Date: Fri, 19 Jan 2024 22:56:53 +0100 Subject: [PATCH 2/2] 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 --- buildscript | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/buildscript b/buildscript index 422008d0..06d9597f 100755 --- a/buildscript +++ b/buildscript @@ -381,8 +381,12 @@ buildall() { } if [ "$(/usr/bin/id -u)" -eq 0 ]; then - echo "WARNING: buildscript is running as root" - echo "WARNING: build may fail at a later stage" + TPUT=$(command -v tput || echo ":") + 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 if [ "$1" != "selectbsp" -a "$1" != "selectvariant" ]; then -- 2.39.2