aboutsummaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2002-03-04 07:28:25 +0000
committerJudd Vinet <judd@archlinux.org>2002-03-04 07:28:25 +0000
commit98c76a453222169f12b0e95f8a7ed0175e182598 (patch)
tree59132a1d0bafb1a284b804b29bda1dbc049fd79d /functions
downloadinitscripts-98c76a453222169f12b0e95f8a7ed0175e182598.tar.xz
Initial revision
Diffstat (limited to 'functions')
-rw-r--r--functions45
1 files changed, 45 insertions, 0 deletions
diff --git a/functions b/functions
new file mode 100644
index 0000000..2923928
--- /dev/null
+++ b/functions
@@ -0,0 +1,45 @@
+#
+# functions
+#
+
+STAT_COL=68
+
+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 ]"
+}
+
+stat_done() {
+ deltext
+ echo " DONE ]"
+}
+
+stat_fail() {
+ deltext
+ echo " FAILED ]"
+}
+
+checkret() {
+ $* >/dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+}
+
+add_daemon() {
+ [ -d /var/run/daemons ] || mkdir -p /var/run/daemons
+ touch /var/run/daemons/$1
+}
+
+rm_daemon() {
+ rm -f /var/run/daemons/$1
+}
+
+# End of file