1
by Chris Lawrence
Note that Debian's run-parts ignores certain lsb cron.* scripts, in |
1 |
# /lib/lsb/init-functions for Debian -*- shell-script -*-
|
2 |
#
|
|
23
by Dustin Kirkland
* Merge from debian unstable, remaining changes: |
3 |
#Copyright (c) 2002-08 Chris Lawrence
|
1
by Chris Lawrence
Note that Debian's run-parts ignores certain lsb cron.* scripts, in |
4 |
#All rights reserved.
|
5 |
#
|
|
6 |
#Redistribution and use in source and binary forms, with or without
|
|
7 |
#modification, are permitted provided that the following conditions
|
|
8 |
#are met:
|
|
9 |
#1. Redistributions of source code must retain the above copyright
|
|
10 |
# notice, this list of conditions and the following disclaimer.
|
|
11 |
#2. Redistributions in binary form must reproduce the above copyright
|
|
12 |
# notice, this list of conditions and the following disclaimer in the
|
|
13 |
# documentation and/or other materials provided with the distribution.
|
|
14 |
#3. Neither the name of the author nor the names of other contributors
|
|
15 |
# may be used to endorse or promote products derived from this software
|
|
16 |
# without specific prior written permission.
|
|
17 |
#
|
|
26
by Dustin Kirkland
* Merge from debian unstable (LP: #249059), remaining changes: |
18 |
#THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
19 |
#IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
20 |
#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
21 |
#ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
|
22 |
#LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
23 |
#CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
24 |
#SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
|
25 |
#BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
26 |
#WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
27 |
#OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
28 |
#EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1
by Chris Lawrence
Note that Debian's run-parts ignores certain lsb cron.* scripts, in |
29 |
|
30 |
start_daemon () { |
|
1.2.1
by Chris Lawrence
* Provide lsb_release module for Python applications. (Closes: #486262) |
31 |
local force nice pidfile exec i args |
1
by Chris Lawrence
Note that Debian's run-parts ignores certain lsb cron.* scripts, in |
32 |
force=0 |
33 |
nice=0 |
|
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
34 |
pidfile=/dev/null |
1
by Chris Lawrence
Note that Debian's run-parts ignores certain lsb cron.* scripts, in |
35 |
|
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
36 |
OPTIND=1 |
37 |
while getopts fn:p: opt ; do |
|
38 |
case "$opt" in |
|
39 |
f) force=1;; |
|
40 |
n) nice="$OPTARG";; |
|
41 |
p) pidfile="$OPTARG";; |
|
1
by Chris Lawrence
Note that Debian's run-parts ignores certain lsb cron.* scripts, in |
42 |
esac |
43 |
done |
|
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
44 |
|
45 |
shift $(($OPTIND - 1)) |
|
22
by Matthias Klose
* Merge with Debian; remaining changes: |
46 |
if [ "$1" = '--' ]; then |
47 |
shift |
|
48 |
fi |
|
1
by Chris Lawrence
Note that Debian's run-parts ignores certain lsb cron.* scripts, in |
49 |
|
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
50 |
exec="$1"; shift |
1
by Chris Lawrence
Note that Debian's run-parts ignores certain lsb cron.* scripts, in |
51 |
|
1.1.3
by Chris Lawrence
Fix quoting of $PWD in start-stop-daemon call. (Closes: #520499) |
52 |
args="--start --nicelevel $nice --quiet --oknodo" |
1
by Chris Lawrence
Note that Debian's run-parts ignores certain lsb cron.* scripts, in |
53 |
if [ $force = 1 ]; then |
1.1.3
by Chris Lawrence
Fix quoting of $PWD in start-stop-daemon call. (Closes: #520499) |
54 |
/sbin/start-stop-daemon $args --chdir "$PWD" --startas $exec --pidfile /dev/null -- "$@" |
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
55 |
elif [ $pidfile ]; then |
1.1.3
by Chris Lawrence
Fix quoting of $PWD in start-stop-daemon call. (Closes: #520499) |
56 |
/sbin/start-stop-daemon $args --chdir "$PWD" --exec $exec --oknodo --pidfile "$pidfile" -- "$@" |
1
by Chris Lawrence
Note that Debian's run-parts ignores certain lsb cron.* scripts, in |
57 |
else |
1.1.3
by Chris Lawrence
Fix quoting of $PWD in start-stop-daemon call. (Closes: #520499) |
58 |
/sbin/start-stop-daemon $args --chdir "$PWD" --exec $exec -- "$@" |
1
by Chris Lawrence
Note that Debian's run-parts ignores certain lsb cron.* scripts, in |
59 |
fi |
60 |
} |
|
61 |
||
62 |
pidofproc () { |
|
10
by Scott James Remnant
* Merge from debian unstable, remaining changes: |
63 |
local pidfile line i pids= status specified pid |
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
64 |
pidfile= |
10
by Scott James Remnant
* Merge from debian unstable, remaining changes: |
65 |
specified= |
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
66 |
|
67 |
OPTIND=1 |
|
68 |
while getopts p: opt ; do |
|
69 |
case "$opt" in |
|
70 |
p) pidfile="$OPTARG"; specified=1;; |
|
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
71 |
esac |
72 |
done |
|
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
73 |
shift $(($OPTIND - 1)) |
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
74 |
|
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
75 |
base=${1##*/} |
76 |
if [ ! "$specified" ]; then |
|
77 |
pidfile="/var/run/$base.pid" |
|
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
78 |
fi |
79 |
||
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
80 |
if [ -n "${pidfile:-}" -a -e "$pidfile" ]; then |
10
by Scott James Remnant
* Merge from debian unstable, remaining changes: |
81 |
read pid < "$pidfile" |
82 |
if [ -n "${pid:-}" ]; then |
|
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
83 |
if $(kill -0 "${pid:-}" 2> /dev/null); then |
84 |
echo "$pid" |
|
85 |
return 0 |
|
25
by Dustin Kirkland
* init-functions: |
86 |
elif ps "${pid:-}" >/dev/null 2>&1; then |
87 |
echo "$pid" |
|
88 |
return 0 # program is running, but not owned by this user |
|
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
89 |
else |
90 |
return 1 # program is dead and /var/run pid file exists |
|
91 |
fi |
|
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
92 |
fi |
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
93 |
fi |
94 |
if [ -x /bin/pidof -a ! "$specified" ]; then |
|
23
by Dustin Kirkland
* Merge from debian unstable, remaining changes: |
95 |
status="0" |
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
96 |
/bin/pidof -o %PPID -x $1 || status="$?" |
22
by Matthias Klose
* Merge with Debian; remaining changes: |
97 |
if [ "$status" = 1 ]; then |
98 |
return 3 # program is not running |
|
99 |
fi |
|
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
100 |
return 0 |
1
by Chris Lawrence
Note that Debian's run-parts ignores certain lsb cron.* scripts, in |
101 |
fi |
1.2.1
by Chris Lawrence
* Provide lsb_release module for Python applications. (Closes: #486262) |
102 |
if [ "$specified" ]; then |
103 |
return 3 # program does not appear to be running after trying PID file |
|
104 |
fi |
|
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
105 |
return 4 # program or service is unknown |
1
by Chris Lawrence
Note that Debian's run-parts ignores certain lsb cron.* scripts, in |
106 |
} |
107 |
||
108 |
# start-stop-daemon uses the same algorithm as "pidofproc" above. |
|
109 |
killproc () { |
|
22
by Matthias Klose
* Merge with Debian; remaining changes: |
110 |
local pidfile sig status base i name_param is_term_sig |
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
111 |
pidfile= |
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
112 |
name_param= |
22
by Matthias Klose
* Merge with Debian; remaining changes: |
113 |
is_term_sig=no |
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
114 |
|
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
115 |
OPTIND=1 |
116 |
while getopts p: opt ; do |
|
117 |
case "$opt" in |
|
118 |
p) pidfile="$OPTARG";; |
|
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
119 |
esac |
120 |
done |
|
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
121 |
shift $(($OPTIND - 1)) |
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
122 |
|
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
123 |
base=${1##*/} |
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
124 |
if [ ! $pidfile ]; then |
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
125 |
name_param="--name $base --pidfile /var/run/$base.pid" |
126 |
else |
|
127 |
name_param="--pidfile $pidfile" |
|
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
128 |
fi |
129 |
||
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
130 |
sig=$(echo ${2:-} | sed -e 's/^-\(.*\)/\1/') |
131 |
sig=$(echo $sig | sed -e 's/^SIG\(.*\)/\1/') |
|
23
by Dustin Kirkland
* Merge from debian unstable, remaining changes: |
132 |
if [ -z "$sig" -o "$sig" = 15 -o "$sig" = TERM ]; then |
22
by Matthias Klose
* Merge with Debian; remaining changes: |
133 |
is_term_sig=yes |
134 |
fi |
|
135 |
status=0 |
|
136 |
if [ ! "$is_term_sig" = yes ]; then |
|
137 |
if [ -n "$sig" ]; then |
|
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
138 |
/sbin/start-stop-daemon --stop --signal "$sig" --quiet $name_param || status="$?" |
22
by Matthias Klose
* Merge with Debian; remaining changes: |
139 |
else |
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
140 |
/sbin/start-stop-daemon --stop --quiet $name_param || status="$?" |
22
by Matthias Klose
* Merge with Debian; remaining changes: |
141 |
fi |
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
142 |
else |
143 |
/sbin/start-stop-daemon --stop --quiet --oknodo $name_param || status="$?" |
|
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
144 |
fi |
145 |
if [ "$status" = 1 ]; then |
|
22
by Matthias Klose
* Merge with Debian; remaining changes: |
146 |
if [ -n "$sig" ]; then |
147 |
return 0 |
|
148 |
fi |
|
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
149 |
return 3 # program is not running |
150 |
fi |
|
17
by Michael Vogt
* Merge from debian unstable, remaining changes: |
151 |
|
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
152 |
if [ "$status" = 0 -a "$is_term_sig" = yes -a "$pidfile" ]; then |
153 |
pidofproc -p "$pidfile" "$1" >/dev/null || rm -f "$pidfile" |
|
20
by Michael Vogt
* Merge from debian unstable, remaining changes: |
154 |
fi |
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
155 |
return 0 |
5
by Colin Watson
Resynchronise with Debian. |
156 |
} |
157 |
||
23
by Dustin Kirkland
* Merge from debian unstable, remaining changes: |
158 |
# Return LSB status |
159 |
status_of_proc () { |
|
25
by Dustin Kirkland
* init-functions: |
160 |
local pidfile daemon name status |
161 |
||
162 |
pidfile= |
|
163 |
OPTIND=1 |
|
164 |
while getopts p: opt ; do |
|
165 |
case "$opt" in |
|
166 |
p) pidfile="$OPTARG";; |
|
167 |
esac |
|
168 |
done |
|
169 |
shift $(($OPTIND - 1)) |
|
170 |
||
171 |
if [ -n "$pidfile" ]; then |
|
172 |
pidfile="-p $pidfile" |
|
173 |
fi |
|
23
by Dustin Kirkland
* Merge from debian unstable, remaining changes: |
174 |
daemon="$1" |
175 |
name="$2" |
|
25
by Dustin Kirkland
* init-functions: |
176 |
|
23
by Dustin Kirkland
* Merge from debian unstable, remaining changes: |
177 |
status="0" |
25
by Dustin Kirkland
* init-functions: |
178 |
pidofproc $pidfile $daemon >/dev/null || status="$?" |
179 |
if [ "$status" = 0 ]; then |
|
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
180 |
log_success_msg "$name is running" |
25
by Dustin Kirkland
* init-functions: |
181 |
return 0 |
23
by Dustin Kirkland
* Merge from debian unstable, remaining changes: |
182 |
else |
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
183 |
log_failure_msg "$name is not running" |
25
by Dustin Kirkland
* init-functions: |
184 |
return $status |
23
by Dustin Kirkland
* Merge from debian unstable, remaining changes: |
185 |
fi |
186 |
} |
|
187 |
||
5
by Colin Watson
Resynchronise with Debian. |
188 |
log_use_fancy_output () { |
189 |
TPUT=/usr/bin/tput |
|
190 |
EXPR=/usr/bin/expr |
|
23
by Dustin Kirkland
* Merge from debian unstable, remaining changes: |
191 |
if [ -t 1 ] && [ "x$TERM" != "" ] && [ "x$TERM" != "xdumb" ] && [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1 && $TPUT setaf 1 >/dev/null 2>&1; then |
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
192 |
[ -z $FANCYTTY ] && FANCYTTY=1 || true |
5
by Colin Watson
Resynchronise with Debian. |
193 |
else |
194 |
FANCYTTY=0 |
|
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
195 |
fi |
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
196 |
case "$FANCYTTY" in |
197 |
1|Y|yes|true) true;; |
|
198 |
*) false;; |
|
199 |
esac |
|
1
by Chris Lawrence
Note that Debian's run-parts ignores certain lsb cron.* scripts, in |
200 |
} |
201 |
||
202 |
log_success_msg () { |
|
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
203 |
if [ -n "${1:-}" ]; then |
204 |
log_begin_msg $@ |
|
205 |
fi |
|
206 |
log_end_msg 0 |
|
1
by Chris Lawrence
Note that Debian's run-parts ignores certain lsb cron.* scripts, in |
207 |
} |
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
208 |
|
1
by Chris Lawrence
Note that Debian's run-parts ignores certain lsb cron.* scripts, in |
209 |
log_failure_msg () { |
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
210 |
if [ -n "${1:-}" ]; then |
211 |
log_begin_msg $@ |
|
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
212 |
fi |
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
213 |
log_end_msg 1 || true |
1
by Chris Lawrence
Note that Debian's run-parts ignores certain lsb cron.* scripts, in |
214 |
} |
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
215 |
|
1
by Chris Lawrence
Note that Debian's run-parts ignores certain lsb cron.* scripts, in |
216 |
log_warning_msg () { |
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
217 |
if [ -n "${1:-}" ]; then |
218 |
log_begin_msg $@ |
|
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
219 |
fi |
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
220 |
log_end_msg 255 || true |
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
221 |
} |
222 |
||
223 |
# |
|
224 |
# NON-LSB HELPER FUNCTIONS |
|
225 |
# |
|
226 |
# int get_lsb_header_val (char *scriptpathname, char *key) |
|
227 |
get_lsb_header_val () { |
|
10
by Scott James Remnant
* Merge from debian unstable, remaining changes: |
228 |
if [ ! -f "$1" ] || [ -z "${2:-}" ]; then |
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
229 |
return 1 |
230 |
fi |
|
231 |
LSB_S="### BEGIN INIT INFO" |
|
232 |
LSB_E="### END INIT INFO" |
|
233 |
sed -n "/$LSB_S/,/$LSB_E/ s/# $2: \(.*\)/\1/p" $1 |
|
234 |
} |
|
235 |
||
236 |
# int log_begin_message (char *message) |
|
237 |
log_begin_msg () { |
|
10
by Scott James Remnant
* Merge from debian unstable, remaining changes: |
238 |
if [ -z "${1:-}" ]; then |
5
by Colin Watson
Resynchronise with Debian. |
239 |
return 1 |
240 |
fi |
|
241 |
echo -n "$@" |
|
242 |
} |
|
243 |
||
244 |
# Sample usage: |
|
245 |
# log_daemon_msg "Starting GNOME Login Manager" "gdm" |
|
246 |
# |
|
247 |
# On Debian, would output "Starting GNOME Login Manager: gdm" |
|
248 |
# On Ubuntu, would output " * Starting GNOME Login Manager..." |
|
249 |
# |
|
250 |
# If the second argument is omitted, logging suitable for use with |
|
251 |
# log_progress_msg() is used: |
|
252 |
# |
|
253 |
# log_daemon_msg "Starting remote filesystem services" |
|
254 |
# |
|
255 |
# On Debian, would output "Starting remote filesystem services:" |
|
256 |
# On Ubuntu, would output " * Starting remote filesystem services..." |
|
257 |
||
258 |
log_daemon_msg () { |
|
10
by Scott James Remnant
* Merge from debian unstable, remaining changes: |
259 |
if [ -z "${1:-}" ]; then |
5
by Colin Watson
Resynchronise with Debian. |
260 |
return 1 |
261 |
fi |
|
26
by Dustin Kirkland
* Merge from debian unstable (LP: #249059), remaining changes: |
262 |
log_daemon_msg_pre "$@" |
5
by Colin Watson
Resynchronise with Debian. |
263 |
|
10
by Scott James Remnant
* Merge from debian unstable, remaining changes: |
264 |
if [ -z "${2:-}" ]; then |
5
by Colin Watson
Resynchronise with Debian. |
265 |
echo -n "$1:" |
266 |
return |
|
267 |
fi |
|
268 |
||
269 |
echo -n "$1: $2" |
|
26
by Dustin Kirkland
* Merge from debian unstable (LP: #249059), remaining changes: |
270 |
log_daemon_msg_post "$@" |
5
by Colin Watson
Resynchronise with Debian. |
271 |
} |
272 |
||
273 |
# #319739 |
|
274 |
# |
|
275 |
# Per policy docs: |
|
276 |
# |
|
277 |
# log_daemon_msg "Starting remote file system services" |
|
278 |
# log_progress_msg "nfsd"; start-stop-daemon --start --quiet nfsd |
|
279 |
# log_progress_msg "mountd"; start-stop-daemon --start --quiet mountd |
|
280 |
# log_progress_msg "ugidd"; start-stop-daemon --start --quiet ugidd |
|
281 |
# log_end_msg 0 |
|
282 |
# |
|
283 |
# You could also do something fancy with log_end_msg here based on the |
|
284 |
# return values of start-stop-daemon; this is left as an exercise for |
|
285 |
# the reader... |
|
286 |
# |
|
287 |
# On Ubuntu, one would expect log_progress_msg to be a no-op. |
|
288 |
log_progress_msg () { |
|
10
by Scott James Remnant
* Merge from debian unstable, remaining changes: |
289 |
if [ -z "${1:-}" ]; then |
5
by Colin Watson
Resynchronise with Debian. |
290 |
return 1 |
291 |
fi |
|
292 |
echo -n " $@" |
|
293 |
} |
|
294 |
||
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
295 |
|
296 |
# int log_end_message (int exitstatus) |
|
297 |
log_end_msg () { |
|
298 |
# If no arguments were passed, return |
|
22
by Matthias Klose
* Merge with Debian; remaining changes: |
299 |
if [ -z "${1:-}" ]; then |
300 |
return 1 |
|
301 |
fi |
|
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
302 |
|
303 |
retval=$1 |
|
304 |
||
26
by Dustin Kirkland
* Merge from debian unstable (LP: #249059), remaining changes: |
305 |
log_end_msg_pre "$@" |
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
306 |
|
5
by Colin Watson
Resynchronise with Debian. |
307 |
# Only do the fancy stuff if we have an appropriate terminal |
308 |
# and if /usr is already mounted |
|
309 |
if log_use_fancy_output; then |
|
310 |
RED=`$TPUT setaf 1` |
|
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
311 |
YELLOW=`$TPUT setaf 3` |
5
by Colin Watson
Resynchronise with Debian. |
312 |
NORMAL=`$TPUT op` |
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
313 |
else |
314 |
RED='' |
|
315 |
YELLOW='' |
|
316 |
NORMAL='' |
|
317 |
fi |
|
318 |
||
319 |
if [ $1 -eq 0 ]; then |
|
320 |
echo "." |
|
321 |
elif [ $1 -eq 255 ]; then |
|
322 |
/bin/echo -e " ${YELLOW}(warning).${NORMAL}" |
|
323 |
else |
|
324 |
/bin/echo -e " ${RED}failed!${NORMAL}" |
|
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
325 |
fi |
26
by Dustin Kirkland
* Merge from debian unstable (LP: #249059), remaining changes: |
326 |
log_end_msg_post "$@" |
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
327 |
return $retval |
2
by Tollef Fog Heen
prerm, postinst: Add support for amd64. (closes: #1354) |
328 |
} |
5
by Colin Watson
Resynchronise with Debian. |
329 |
|
330 |
log_action_msg () { |
|
331 |
echo "$@." |
|
332 |
} |
|
333 |
||
334 |
log_action_begin_msg () { |
|
335 |
echo -n "$@..." |
|
336 |
} |
|
337 |
||
338 |
log_action_cont_msg () { |
|
339 |
echo -n "$@..." |
|
340 |
} |
|
341 |
||
342 |
log_action_end_msg () { |
|
26
by Dustin Kirkland
* Merge from debian unstable (LP: #249059), remaining changes: |
343 |
log_action_end_msg_pre "$@" |
10
by Scott James Remnant
* Merge from debian unstable, remaining changes: |
344 |
if [ -z "${2:-}" ]; then |
5
by Colin Watson
Resynchronise with Debian. |
345 |
end="." |
346 |
else |
|
347 |
end=" ($2)." |
|
348 |
fi |
|
349 |
||
350 |
if [ $1 -eq 0 ]; then |
|
351 |
echo "done${end}" |
|
352 |
else |
|
353 |
if log_use_fancy_output; then |
|
354 |
RED=`$TPUT setaf 1` |
|
355 |
NORMAL=`$TPUT op` |
|
356 |
/bin/echo -e "${RED}failed${end}${NORMAL}" |
|
357 |
else |
|
358 |
echo "failed${end}" |
|
359 |
fi |
|
360 |
fi |
|
26
by Dustin Kirkland
* Merge from debian unstable (LP: #249059), remaining changes: |
361 |
log_action_end_msg_post "$@" |
5
by Colin Watson
Resynchronise with Debian. |
362 |
} |
363 |
||
26
by Dustin Kirkland
* Merge from debian unstable (LP: #249059), remaining changes: |
364 |
# Hooks for /etc/lsb-base-logging.sh |
365 |
log_daemon_msg_pre () { :; } |
|
366 |
log_daemon_msg_post () { :; } |
|
367 |
log_end_msg_pre () { :; } |
|
368 |
log_end_msg_post () { :; } |
|
1.1.2
by Chris Lawrence
* Revert change in 3.2-16 that broke killproc due to my misunderstanding |
369 |
log_action_end_msg_pre () { :; } |
26
by Dustin Kirkland
* Merge from debian unstable (LP: #249059), remaining changes: |
370 |
log_action_end_msg_post () { :; } |
371 |
||
14
by Colin Watson
* Resynchronise with Debian. Remaining changes: |
372 |
FANCYTTY= |
5
by Colin Watson
Resynchronise with Debian. |
373 |
[ -e /etc/lsb-base-logging.sh ] && . /etc/lsb-base-logging.sh || true |