aboutsummaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2003-10-10 01:10:18 +0000
committerJudd Vinet <judd@archlinux.org>2003-10-10 01:10:18 +0000
commit7f4117b05f9e4730657779ec7d4b3b08ba12616c (patch)
tree7ae9206800c5f9495e8203f49a8ec8489536c6aa /functions
parentbe8b6f59470b8779c3d4e10b3045507920931896 (diff)
downloadinitscripts-7f4117b05f9e4730657779ec7d4b3b08ba12616c.tar.xz
added color to rc messages and fixed bug #168
Diffstat (limited to 'functions')
-rw-r--r--functions26
1 files changed, 20 insertions, 6 deletions
diff --git a/functions b/functions
index d79f30c..ab88827 100644
--- a/functions
+++ b/functions
@@ -3,26 +3,40 @@
# functions
#
-STAT_COL=68
+STAT_COL=$[`stty size | awk 'BEGIN { RS=" " }; END { print $1 }'` - 12]
deltext() {
echo -ne "\033[$(($STAT_COL+4))G"
}
stat_busy() {
- echo -n "[ $1 "
- awk "BEGIN { for (j=length(\"$1\"); j<$STAT_COL; j++) printf \" \" }"
- echo -n " BUSY ]"
+ if [ "$USECOLOR" = "YES" -o "$USECOLOR" = "yes" ]; then
+ echo -ne "\033[1;32m| \033[1;37m$1\033[1;0m "
+ awk "BEGIN { for (j=length(\"$1\"); j<$STAT_COL; j++) printf \" \" }"
+ echo -ne " \033[1;34m[\033[1;33mbusy\033[1;34m]\033[1;0m"
+ else
+ echo -n "| $1 "
+ awk "BEGIN { for (j=length(\"$1\"); j<$STAT_COL; j++) printf \" \" }"
+ echo -n " [busy]"
+ fi
}
stat_done() {
deltext
- echo " DONE ]"
+ if [ "$USECOLOR" = "YES" -o "$USECOLOR" = "yes" ]; then
+ echo -e " \033[1;34m[\033[1;32mdone\033[1;34m]\033[1;0m"
+ else
+ echo " [done]"
+ fi
}
stat_fail() {
deltext
- echo " FAILED ]"
+ if [ "$USECOLOR" = "YES" -o "$USECOLOR" = "yes" ]; then
+ echo -e " \033[1;34m[\033[1;31mfail\033[1;34m]\033[1;0m"
+ else
+ echo " [fail]"
+ fi
}
stat_die() {