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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 127 - (show annotations) (download) (as text)
Sun Feb 17 02:24:47 2002 UTC (18 years, 8 months ago) by azarah
File MIME type: text/x-sh
File size: 1879 byte(s)
misc fixes

1 # Copyright 1999-2002 Gentoo Technologies, Inc.
2 # Distributed under the terms of the GNU General Public License, v2 or later
3 # $Header$
4
5
6 #daemontools dir
7 SVCDIR=/var/lib/supervise
8 #rc-scripts dir
9 svcdir=/dev/shm/.init.d
10 #different types of dependancies
11 deptypes="need use"
12 #different types of order deps
13 ordtypes="before after"
14
15 getcols() {
16 echo $2
17 }
18
19 COLS=`stty size`
20 COLS=`getcols $COLS`
21 COLS=$(( $COLS - 7 ))
22 ENDCOL=$'\e[A\e['$COLS'G'
23 #now, ${ENDCOL} will move us to the end of the column; irregardless of character width
24
25 NORMAL="\033[0m"
26 GOOD=$'\e[32;01m'
27 WARN=$'\e[33;01m'
28 BAD=$'\e[31;01m'
29 NORMAL=$'\e[0m'
30
31 HILITE=$'\e[36;01m'
32
33 ebegin() {
34 echo -e " ${GOOD}*${NORMAL} ${*}..."
35 }
36
37 ewarn() {
38 echo -e " ${WARN}*${NORMAL} ${*}"
39 }
40
41 eerror() {
42 echo -e " ${BAD}*${NORMAL} ${*}"
43 }
44
45 einfo() {
46 echo -e " ${GOOD}*${NORMAL} ${*}"
47 }
48
49 einfon() {
50 echo -ne " ${GOOD}*${NORMAL} ${*}"
51 }
52
53 eend() {
54 if [ $# -eq 0 ] || [ $1 -eq 0 ]
55 then
56 echo -e "$ENDCOL \e[34;01m[ ${GOOD}ok \e[34;01m]${NORMAL}"
57 else
58 local returnme
59 returnme=$1
60 if [ $# -ge 2 ]
61 then
62 shift
63 eerror $*
64 fi
65 echo -e "$ENDCOL \e[34;01m[ ${BAD}!! \e[34;01m]${NORMAL}"
66 echo
67 #extra spacing makes it easier to read
68 return $returnme
69 fi
70 }
71
72 ewend() {
73 if [ $# -eq 0 ] || [ $1 -eq 0 ]
74 then
75 echo -e "$ENDCOL \e[34;01m[ ${GOOD}ok \e[34;01m]${NORMAL}"
76 else
77 local returnme
78 returnme=$1
79 if [ $# -ge 2 ]
80 then
81 shift
82 ewarn $*
83 fi
84 echo -e "$ENDCOL \e[34;01m[ ${WARN}!! \e[34;01m]${NORMAL}"
85 echo
86 #extra spacing makes it easier to read
87 return $returnme
88 fi
89 }
90
91 save_options() {
92 local myopts=$1
93 shift
94
95 if [ ! -d ${svcdir}/options/${myservice} ]
96 then
97 install -d -m0755 ${svcdir}/options/${myservice}
98 fi
99 echo $* > ${svcdir}/options/${myservice}/${myopts}
100 }
101
102 get_options() {
103 if [ -f ${svcdir}/options/${myservice}/$1 ]
104 then
105 cat ${svcdir}/options/${myservice}/$1
106 fi
107 }
108
109
110 # vim:ts=4

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.20