/[baselayout]/trunk/init.d/functions.sh
Gentoo

Contents of /trunk/init.d/functions.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (hide annotations) (download) (as text)
Thu Aug 9 20:39:33 2001 UTC (11 years, 9 months ago) by drobbins
File MIME type: text/x-sh
File size: 1136 byte(s)
new stuff

1 drobbins 2 SVCDIR=/var/lib/supervise
2    
3     getcols() {
4     echo $2
5     }
6    
7     COLS=`stty size`
8     COLS=`getcols $COLS`
9     COLS=$(( $COLS - 7 ))
10     ENDCOL=$'\e[A\e['$COLS'G'
11     #now, ${ENDCOL} will move us to the end of the column; irregardless of character width
12    
13     NORMAL="\033[0m"
14     GOOD=$'\e[32;01m'
15     BAD=$'\e[31;01m'
16     NORMAL=$'\e[0m'
17     HILITE=$'\e[36;01m'
18    
19     function ebegin() {
20     echo -e " ${GOOD}*${NORMAL} ${*}..."
21     }
22    
23     function eerror() {
24     echo -e ">>$BAD ${*}$NORMAL"
25     }
26    
27     function eend() {
28     if [ $# -eq 0 ] || [ $1 -eq 0 ]
29     then
30     echo -e "$ENDCOL \e[34;01m[ ${GOOD}ok \e[34;01m]${NORMAL}"
31     else
32     local returnme
33     returnme=$1
34     if [ $# -ge 2 ]
35     then
36     shift
37     eerror $*
38     fi
39     echo -e "$ENDCOL \e[34;01m[ ${BAD}!! \e[34;01m]${NORMAL}"
40     echo
41     #extra spacing makes it easier to read
42     return $returnme
43     fi
44     }
45    
46    
47     try() {
48     eval $*
49     if [ $? -ne 0 ]
50     then
51     echo -e "$ENDCOL$NORMAL[$BAD oops $NORMAL]"
52     echo
53     echo '!!! '"ERROR: the $1 command did not complete successfully."
54     # echo '!!! '"(\" ${*} \")"
55     echo '!!! '"Since this is a critical task, startup cannot continue."
56     echo
57     /sbin/sulogin $CONSOLE
58     reboot -f
59     fi
60     }
61    
62    

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.13