This is the function where red color SHOULD be used.
#!/bin/bash
-if [ `id -u` != 0 ];
-then
- echo "! you must be root to run $0"
- exit
-fi
+echo "Building base image"
DIR=`dirname $0`
. $DIR/function.sh
-[ -f $DIR/../testing.conf ] || die "!! Configuration file 'testing.conf' not found"
+[ `id -u` -eq 0 ] || die "You must be root to run $0"
+
+[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found"
. $DIR/../testing.conf
# additional packages
rm -f $ROOTFS
echo "`date`, building $ROOTFS" >>$LOGFILE
-echo "Building base image"
log_action "Creating image $ROOTFS"
execute "dd if=/dev/null of=$ROOTFS bs=1M seek=$ROOTFSSIZE count=1"
}
export TERM=xterm
+RED=$(tput setaf 1)
+GREEN=$(tput setaf 2)
+NORMAL=$(tput op)
function cecho {
echo -e "\033[1;31m$1\033[0m"
# $1 - exit status of action
log_status()
{
- RED=$(tput setaf 1)
- GREEN=$(tput setaf 2)
- NORMAL=$(tput op)
-
tput hpa 0
if [ $1 -eq 0 ]; then
/bin/echo -ne "[${GREEN} ok ${NORMAL}"
echo
}
-#############################################
-# output all args to stderr and exit with
-# return code 1
-#
-
+# exit with given error message
+# $1 - error message
die() {
- echo $* 1>&2
- exit 1
+ echo -e "${RED}$1${NORMAL}"
+ exit 1
}
#############################################