SVN: rc-scripts/trunk/rc.d/init.d/functions
glen
glen at pld-linux.org
Sun Sep 17 20:34:48 CEST 2006
Author: glen
Date: Sun Sep 17 20:34:48 2006
New Revision: 7784
Modified:
rc-scripts/trunk/rc.d/init.d/functions
Log:
Cache colors in filesystem too.
Modified: rc-scripts/trunk/rc.d/init.d/functions
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/functions (original)
+++ rc-scripts/trunk/rc.d/init.d/functions Sun Sep 17 20:34:48 2006
@@ -84,6 +84,7 @@
fi
fi
+
is_yes()
{
# Test syntax
@@ -369,32 +370,27 @@
echo -n "$(termput setaf $CBRACKETS)[$(termput setaf $COLOR) $(nls --nls-domain rc-scripts "$1") $(termput setaf $CBRACKETS)]$(termput op)"
}
-_busy=$(progress "BUSY" "$CBUSY")
busy()
{
echo -n "$_busy"
}
-_ok=$(progress "DONE")
ok()
{
echo "$_ok"
}
-_started=$(progress "WORK")
started()
{
echo "$_started"
}
-_fail=$(progress "FAIL" "$CFAIL")
fail()
{
echo "$_fail"
return 1
}
-_died=$(progress "DIED" "$CFAIL")
died()
{
echo "$_died"
@@ -922,6 +918,33 @@
mv -f /etc/mtab.clean /etc/mtab
}
+msg_cache_init() {
+ # if we have cachefile use it
+ # if we don't create memory variables and try to save silently
+ # we store cache in /etc, as /var isn't available at boot time
+ local cachefile='/etc/rc.d/.rc-scripts.cache'
+ if [ -f "$cachefile" -a "$cachefile" -nt /etc/sysconfig/system -a "$cachefile" -nt /etc/sysconfig/init-colors ]; then
+ . "$cachefile"
+ return
+ fi
+
+ # primitive caching
+ _busy=$(progress "BUSY" "$CBUSY")
+ _ok=$(progress "DONE")
+ _started=$(progress "WORK")
+ _fail=$(progress "FAIL" "$CFAIL")
+ _died=$(progress "DIED" "$CFAIL")
+ cat <<-EOF > "$cachefile" 2>/dev/null
+ _busy='$_busy';
+ _ok='$_ok';
+ _started='$_started';
+ _fail='$_fail';
+ _died='$_died';
+EOF
+}
+
+msg_cache_init
+
#/*
# * Local variables:
# * mode: sh
More information about the pld-cvs-commit
mailing list