]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
Merge color customization support created by Łukasz Pawelczyk <havner/at/pld-linux...
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Sat, 15 May 2004 02:21:33 +0000 (02:21 +0000)
committerArkadiusz Miśkiewicz <arekm@maven.pl>
Sat, 15 May 2004 02:21:33 +0000 (02:21 +0000)
svn-id: @4053

rc.d/init.d/functions
rc.d/rc
rc.d/rc.sysinit
sysconfig/Makefile.am
sysconfig/init-colors [new file with mode: 0644]
sysconfig/init-colors.gentoo [new file with mode: 0644]

index fe834d081b0a206415b825e2f74805f581da9713..adff1d5405ed71bcf961bfed2d4f3e69739f0e15 100644 (file)
@@ -9,6 +9,7 @@
 #              Marek Obuchowicz <elephant@pld-linux.org>
 #              Arkadiusz Mi¶kiewicz <misiek@pld-linux.org>
 #              Micha³ Kochanowicz <mkochano@pld-linux.org>
+#              £ukasz Pawelczyk <havner@pld-linux.org>
 
 # First set up a default search path.
 export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"
@@ -16,7 +17,32 @@ export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"
 # Set defaults
 INIT_COL=67
 
+# Set colors
+RED=1
+GREEN=2
+YELLOW=3
+BLUE=4
+MAGENTA=5
+CYAN=6
+WHITE=7
+NORMAL=9
+# Bold definition (second parameter to termput setaf)
+BOLD=1
+NOBOLD=0
+# Default colors
+CBRACKETS="$CYAN"      # brackets [ ] color
+CDONE="$GREEN"         # DONE and WORK color
+CBUSY="$MAGENTA"       # BUSY color
+CFAIL="$RED"           # FAIL and DIED color
+CPOWEREDBY="$CYAN"     # "Powered by" color
+CPLD="$GREEN"          # "PLD Linux Distribution" color
+CI="$RED"              # Capital I color (press I to enter interactive startup)
+CRESMAN="$GREEN"       # "Resource Manager" color
+CHARS=""               # Characters displayed on the begining of show line
+CCHARS="$NORMAL"       # Color of these characters (look at /etc/sysconfig/init-colors.gentoo example)
+
 # Source configuration if available - may override default values
+[ -r /etc/sysconfig/init-colors ] && . /etc/sysconfig/init-colors
 [ -r /etc/sysconfig/system ] && . /etc/sysconfig/system
 [ -r /etc/sysconfig/bootsplash ] && . /etc/sysconfig/bootsplash
 
@@ -116,10 +142,16 @@ termput()
                        echo -ne "\033[0K"
                        ;;
                  setaf)
-                       is_yes "$COLOR_INIT" && echo -ne "\033[0;3${2}m"
+                       typeset ISBOLD
+                       if [ -n "$3" ]; then
+                               ISBOLD="$3"
+                       else
+                               ISBOLD="$NOBOLD";
+                       fi
+                       is_yes "$COLOR_INIT" && echo -ne "\033[${ISBOLD};3${2}m"
                        ;;
                  op)
-                       termput setaf 9
+                       termput setaf $NORMAL
                        ;;
                esac
        else
@@ -131,10 +163,11 @@ termput()
                        tput "$@"
                        ;;
                  setaf)
-                       is_yes "$COLOR_INIT" && tput "$@"
+                       if [ "$3" == "1" ]; then tput bold; else tput sgr0; fi
+                       is_yes "$COLOR_INIT" && tput setaf "$2"
                        ;;
                  op)
-                       tput setaf 9
+                       termput setaf $NORMAL
                        ;;
                esac
        fi
@@ -256,10 +289,20 @@ show()
        if is_yes "$FASTRC"; then
                echo -n "$INIT_DOTS"
                termput hpa 0
+               if [ -n "$CHARS" ]; then
+                       termput setaf $CCHARS
+                       echo -n "$CHARS"
+                       termput op
+               fi
                printf "$@"
                termput hpa $INIT_COL
        else
                text=$(nls "$@")
+               if [ -n "$CHARS" ]; then
+                       termput setaf $CCHARS
+                       echo -n "$CHARS"
+                       termput op
+               fi
                echo -n "$text"
                awk "BEGIN { for (j=length(\"$text\"); j<$INIT_COL; j++) printf \".\" }"
        fi
@@ -272,14 +315,14 @@ show()
 progress()
 {
        typeset COLOR
-       if [ -n "$2" ]; then COLOR="$2"; else COLOR="2"; fi
+       if [ -n "$2" ]; then COLOR="$2"; else COLOR="$CDONE"; fi
        deltext
-       echo -n "$(termput setaf 6)[$(termput setaf "$COLOR") $(nls --nls-domain rc-scripts "$1") $(termput setaf 6)]$(termput op)"
+       echo -n "$(termput setaf $CBRACKETS)[$(termput setaf $COLOR) $(nls --nls-domain rc-scripts "$1") $(termput setaf $CBRACKETS)]$(termput op)"
 }
 
 busy()
 {
-       progress "BUSY" 5
+       progress "BUSY" "$CBUSY"
 }
 
 ok()
@@ -296,14 +339,14 @@ started()
 
 fail()
 {
-       progress "FAIL" 1
+       progress "FAIL" "$CFAIL"
        echo
        return 1
 }
 
 died()
 {
-       progress "DIED" 1
+       progress "DIED" "$CFAIL"
        echo
        return 1
 }
diff --git a/rc.d/rc b/rc.d/rc
index 6d96d89244470e6d3ec25b0193d68931b7c67e58..a72f0d31b66d90a7a6d11547a42c1f902aee7ad0 100755 (executable)
--- a/rc.d/rc
+++ b/rc.d/rc
@@ -142,9 +142,9 @@ stty onlcr -ixon 0>&1
 
 
 # Say something ;)
-af2=$(termput setaf 2)
-af6=$(termput setaf 6)
-af7=$(termput setaf 7)
+af2=$(termput setaf $CRESMAN)
+af6=$(termput setaf $CBRACKETS)
+af7=$(termput op)
 text="$(termput op)$(nls '%sResource Manager: %sEntering runlevel number' "$af2" "$af7")"
 text_size="$(nls '%sResource Manager: %sEntering runlevel number' "" "")"
 resp_size="$(nls 'DONE')"
index 7d4a789188189d55e39d74753461a64c37c61eea..494d62023bdb9561946357a6ee7e3d15d7620e52 100755 (executable)
@@ -85,9 +85,9 @@ fi
 [ -e /proc/splash ] && is_no "$BOOT_SPLASH" && echo "0" > /proc/splash
                                    
 # Print welcome message
-nls "\t\t\t%sPowered by %sPLD Linux Distribution%s" "$(termput setaf 6)" "$(termput setaf 2)" "$(termput setaf 7)"
+nls "\t\t\t%sPowered by %sPLD Linux Distribution%s" "$(termput setaf $CPOWEREDBY)" "$(termput setaf $CPLD)" "$(termput op)"
 if is_yes "$PROMPT"; then
-       nls -n "\t\t  Press %sI%s to enter interactive startup" "$(termput setaf 1)" "$(termput setaf 7)"
+       nls -n "\t\t  Press %sI%s to enter interactive startup" "$(termput setaf $CI)" "$(termput op)"
        echo
        sleep 1
 fi
index 25953f1c79fb9135e9d3ca8c56ed48ae53f9389b..e0bb9e155f5706c669b76c3ff4799f5f9600c304 100644 (file)
@@ -6,6 +6,8 @@ sysconfigdir = @sysconfigdir@
 
 sysconfig_DATA = \
        clock \
+       init-colors \
+       init-colors.plddefault \
        hwprof \
        system \
        network \
diff --git a/sysconfig/init-colors b/sysconfig/init-colors
new file mode 100644 (file)
index 0000000..99d5036
--- /dev/null
@@ -0,0 +1,12 @@
+# Default PLD colors.
+
+CBRACKETS="$CYAN"      # brackets [ ] color
+CDONE="$GREEN"         # DONE and WORK color
+CBUSY="$MAGENTA"       # BUSY color
+CFAIL="$RED"           # FAIL and DIED color
+CPOWEREDBY="$CYAN"     # "Powered by" color
+CPLD="$GREEN"          # "PLD Linux Distribution" color
+CI="$RED"              # Capital I color (press I to enter interactive startup)
+CRESMAN="$GREEN"       # "Resource Manager" color
+CHARS=""               # Characters displayed on the begining of show line
+CCHARS="$NORMAL"       # Color of these characters (look at /etc/sysconfig/init-colors.gentoo example)
diff --git a/sysconfig/init-colors.gentoo b/sysconfig/init-colors.gentoo
new file mode 100644 (file)
index 0000000..abf5562
--- /dev/null
@@ -0,0 +1,12 @@
+# Gentoo colors, copy this file as: /etc/sysconfig/init-colors, or just make a symlink
+
+CBRACKETS="$BLUE $BOLD"                # brackets [ ] color
+CDONE="$GREEN $BOLD"           # DONE and WORK color
+CBUSY="$MAGENTA $BOLD"         # BUSY color
+CFAIL="$RED $BOLD"             # FAIL and DIED color
+CPOWEREDBY="$BLUE $BOLD"       # "Powered by" color
+CPLD="$GREEN $BOLD"            # "PLD Linux Distribution" color
+CI="$RED $BOLD"                        # Capital I color (press I to enter interactive startup)
+CRESMAN="$GREEN $BOLD"         # "Resource Manager" color
+CHARS=" * "                    # Characters displayed on the begining of show line
+CCHARS="$GREEN $BOLD"          # Color of these characters
This page took 0.281247 seconds and 4 git commands to generate.