]> TLD Linux GIT Repositories - packages/lvm2.git/blob - lvm2-tld_init.patch
- updated to 2.03.05
[packages/lvm2.git] / lvm2-tld_init.patch
1 diff -ur LVM2.2.03.02.orig/scripts/blk_availability_init_red_hat.in LVM2.2.03.02/scripts/blk_availability_init_red_hat.in
2 --- LVM2.2.03.02.orig/scripts/blk_availability_init_red_hat.in  2019-03-22 17:01:45.758000000 +0100
3 +++ LVM2.2.03.02/scripts/blk_availability_init_red_hat.in       2019-03-22 17:01:58.006000000 +0100
4 @@ -1,4 +1,4 @@
5 -#!/bin/bash
6 +#!/bin/sh
7  #
8  # Copyright (C) 2012-2017 Red Hat, Inc. All rights reserved.
9  #
10 @@ -31,26 +31,29 @@
11  
12  . /etc/init.d/functions
13  
14 -script=blkdeactivate
15 +DAEMON="blkdeactivate"
16 +OPTIONS="-u -l wholevg -m disablequeueing"
17  
18 -sbindir=@SBINDIR@
19 -options="-u -l wholevg -m disablequeueing -r wait"
20 -
21 -LOCK_FILE="@DEFAULT_LOCK_DIR@/subsys/blk-availability"
22 +LOCK_FILE="/var/lock/subsys/blk-availability"
23  
24  case "$1" in
25    start)
26         touch "$LOCK_FILE"
27 +       exit 0
28         ;;
29  
30    stop)
31 -       action "Stopping block device availability:" "$sbindir/$script" $options
32 +       run_cmd "Stopping block device availability:" "/sbin/$DAEMON" $OPTIONS
33         rm -f "$LOCK_FILE"
34 +       exit 0
35         ;;
36  
37    status)
38 +       exit 0
39         ;;
40 +
41    *)
42 -       echo $"Usage: $0 {start|stop|status}"
43 +       msg_usage "$0 {start|stop|status}"
44 +       exit 3
45         ;;
46  esac
47 diff -ur LVM2.2.03.02.orig/scripts/cmirrord_init_red_hat.in LVM2.2.03.02/scripts/cmirrord_init_red_hat.in
48 --- LVM2.2.03.02.orig/scripts/cmirrord_init_red_hat.in  2019-03-22 17:01:45.758000000 +0100
49 +++ LVM2.2.03.02/scripts/cmirrord_init_red_hat.in       2019-03-22 17:01:58.006000000 +0100
50 @@ -2,7 +2,7 @@
51  #
52  # chkconfig: - 22 78
53  # description: Starts and stops cmirrord
54 -# pidfile: @CMIRRORD_PIDFILE@
55 +# pidfile: /var/run/cmirrord.pid
56  #
57  # For Red-Hat-based distributions such as Fedora, RHEL, CentOS.
58  #
59 @@ -16,95 +16,57 @@
60  
61  . /etc/init.d/functions
62  
63 -DAEMON=cmirrord
64 +DAEMON="cmirrord"
65  
66 -usrsbindir="@USRSBINDIR@"
67 -
68 -LOCK_FILE="@DEFAULT_SYS_LOCK_DIR@/subsys/$DAEMON"
69 +LOCK_FILE="/var/lock/subsys/$DAEMON"
70  
71  start()
72  {
73 -       rtrn=0
74 -       if ! pidof "$DAEMON" > /dev/null
75 -       then
76 -               echo -n "Starting $DAEMON: "
77 -               daemon "$usrsbindir/$DAEMON"
78 -               rtrn=$?
79 -               echo
80 -       fi
81 -
82 -       return $rtrn
83 +        if [ -f $LOCK_FILE ]; then
84 +                msg_already_running "$DAEMON"
85 +                return
86 +        fi
87 +        msg_starting "$DAEMON"
88 +        daemon /sbin/$DAEMON </dev/null
89 +        RETVAL=$?
90 +        [ $RETVAL -eq 0 ] && touch "$LOCK_FILE"
91  }
92  
93  stop()
94  {
95 -       echo -n "Stopping $DAEMON:"
96 -       killproc "$DAEMON" -TERM
97 -       rtrn=$?
98 -       echo
99 -
100 -       return $rtrn
101 -}
102 -
103 -wait_for_finish()
104 -{
105 -       count=0
106 -
107 -       while [ "$count" -le 10 -a -n "`pidof $DAEMON`" ]
108 -       do
109 -               sleep 1
110 -               count=$((count + 1))
111 -       done
112 -
113 -       if [ "$(pidof "$DAEMON")" ]
114 -       then
115 -               return 1
116 -       else
117 -               return 0
118 +       if [ ! -f $LOCK_FILE ]; then
119 +               msg_not_running "$DAEMON"
120 +               return
121         fi
122 +       msg_stopping "$DAEMON"
123 +       killproc --pidfile "$PID_FILE" "$DAEMON"
124 +       rm -f "$LOCK_FILE"
125  }
126  
127 -cmirror_status()
128 -{
129 -       status "$DAEMON"
130 -}
131 -
132 -rtrn=1
133 -
134 +RETVAL=0
135  # See how we were called.
136  case "$1" in
137         start)
138                 start
139 -               rtrn=$?
140 -               [ "$rtrn" = 0 ] && touch "$LOCK_FILE"
141                 ;;
142  
143         stop)
144                 stop
145 -               rtrn=$?
146 -               [ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
147                 ;;
148  
149         restart)
150 -               if stop
151 -               then
152 -                       wait_for_finish
153 -                       start
154 -               fi
155 -               rtrn=$?
156 +               stop
157 +               start
158                 ;;
159  
160         status)
161 -               cmirror_status
162 -               rtrn=$?
163 -               if [ "$rtrn" -eq 0 ]; then
164 -                       echo "cmirror is running."
165 -               fi
166 +               status $DAEMON
167 +               exit $?
168                 ;;
169  
170         *)
171 -               echo $"Usage: $0 {start|stop|restart|status}"
172 +               msg_usage "$0 {start|stop|restart|status}"
173                 ;;
174  esac
175  
176 -exit $rtrn
177 +exit $RETVAL
178 diff -ur LVM2.2.03.02.orig/scripts/lvm2_lvmpolld_init_red_hat.in LVM2.2.03.02/scripts/lvm2_lvmpolld_init_red_hat.in
179 --- LVM2.2.03.02.orig/scripts/lvm2_lvmpolld_init_red_hat.in     2019-03-22 17:01:45.758000000 +0100
180 +++ LVM2.2.03.02/scripts/lvm2_lvmpolld_init_red_hat.in  2019-03-22 17:01:58.006000000 +0100
181 @@ -1,6 +1,6 @@
182 -#!/bin/bash
183 +#!/bin/sh
184  #
185 -# Copyright (C) 2015 Red Hat, Inc. All rights reserved.
186 +# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
187  #
188  # This copyrighted material is made available to anyone wishing to use,
189  # modify, copy, or redistribute it subject to the terms and conditions
190 @@ -27,86 +27,92 @@
191  # Default-Start: 1 2 3 4 5
192  # Default-Stop: 0 6
193  # Short-Description: A daemon that is responsible for monitoring in-progress
194 -#                   and possibly longer term operations on logical volumes. 
195 -#                   It helps to reduce the number of spawned processes if same
196 +#                    and possibly longer term operations on logical volumes. 
197 +#                    It helps to reduce the number of spawned processes if same
198  #                    logical volume is requested to get monitored multiple times.
199  #                    Also avoids unsolicited termination due to external factors.
200  ### END INIT INFO
201  
202  . /etc/init.d/functions
203  
204 -DAEMON=lvmpolld
205 +DAEMON="lvmpolld"
206 +NAME="LVM poll daemon"
207  
208 -sbindir="@SBINDIR@"
209 -
210 -LOCK_FILE="@DEFAULT_LOCK_DIR@/subsys/$DAEMON"
211 -PID_FILE="@LVMPOLLD_PIDFILE@"
212 -
213 -rh_status() {
214 -       status -p "$PID_FILE" "$DAEMON"
215 -}
216 -
217 -rh_status_q() {
218 -       rh_status >/dev/null 2>&1
219 -}
220 +LOCK_FILE="/var/lock/subsys/lvm2-lvmpolld"
221 +PID_FILE="/var/run/lvmpolld.pid"
222  
223  start()
224  {
225 -       ret=0
226 -       action "Starting LVM poll daemon:" "$sbindir/$DAEMON" || ret=$?
227 -       return $ret
228 +       if [ -f $LOCK_FILE ]; then
229 +               msg_already_running "$NAME"
230 +               return
231 +       fi
232 +       msg_starting "$NAME"
233 +       daemon "/sbin/$DAEMON" </dev/null
234 +       RETVAL=$?
235 +       [ "$RETVAL" -eq 0 ] && touch "$LOCK_FILE"
236  }
237  
238  stop()
239  {
240 -       ret=0
241 -       action "Signaling LVM poll daemon to exit:" killproc -p "$PID_FILE" "$DAEMON" -TERM || ret=$?
242 -       return "$ret"
243 +       if [ ! -f "$LOCK_FILE" ]; then
244 +               msg_not_running "$NAME"
245 +               return
246 +       fi
247 +       msg_stopping "$NAME"
248 +       killproc --pidfile "$PID_FILE" "$DAEMON"
249 +       rm -f "$LOCK_FILE"
250 +}
251 +
252 +condrestart() {
253 +       if [ ! -f "$LOCK_FILE" ]; then
254 +               msg_not_running "$NAME"
255 +               RETVAL=$1
256 +               return
257 +       fi
258 +       stop
259 +       start
260  }
261  
262 -rtrn=1
263 +reload() {
264 +       if [ ! -f "$LOCK_FILE" ]; then
265 +               msg_not_running "$NAME"
266 +               RETVAL=7
267 +               return
268 +       fi
269 +       msg_reloading "$NAME"
270 +       killproc "$DAEMON" -HUP
271 +       RETVAL=$?
272 +}
273  
274 +RETVAL=0
275  # See how we were called.
276  case "$1" in
277    start)
278 -       rh_status_q && exit 0
279         start
280 -       rtrn=$?
281 -       [ $rtrn = 0 ] && touch "$LOCK_FILE"
282         ;;
283  
284 -  stop|force-stop)
285 -       rh_status_q || exit 0
286 +  stop)
287         stop
288 -       rtrn=$?
289 -       [ $rtrn = 0 ] && rm -f "$LOCK_FILE"
290         ;;
291  
292    restart)
293 -       if stop
294 -       then
295 -               start
296 -       fi
297 -       rtrn=$?
298 +       stop
299 +       start
300         ;;
301  
302    condrestart|try-restart)
303 -       rh_status_q || exit 0
304 -       if stop
305 -       then
306 -               start
307 -       fi
308 -       rtrn=$?
309 +       condrestart 0
310         ;;
311  
312    status)
313 -       rh_status
314 -       rtrn=$?
315 +       status $DAEMON
316 +       exit $?
317         ;;
318  
319    *)
320 -       echo $"Usage: $0 {start|stop|force-stop|restart|condrestart|try-restart|status}"
321 +       msg_usage "$0 {start|stop|force-stop|restart|condrestart|try-restart|status}"
322         ;;
323  esac
324  
325 -exit $rtrn
326 +exit $RETVAL
327 diff -ur LVM2.2.03.02.orig/scripts/lvm2_monitoring_init_red_hat.in LVM2.2.03.02/scripts/lvm2_monitoring_init_red_hat.in
328 --- LVM2.2.03.02.orig/scripts/lvm2_monitoring_init_red_hat.in   2019-03-22 17:01:45.758000000 +0100
329 +++ LVM2.2.03.02/scripts/lvm2_monitoring_init_red_hat.in        2019-03-22 17:01:58.006000000 +0100
330 @@ -1,4 +1,4 @@
331 -#!/bin/bash
332 +#!/bin/sh
333  #
334  # Copyright (C) 2007-2009 Red Hat, Inc. All rights reserved.
335  #
336 @@ -31,104 +31,92 @@
337  
338  . /etc/init.d/functions
339  
340 -DAEMON=lvm2-monitor
341 -DMEVENTD_DAEMON=dmeventd
342 +DAEMON="lvm2-monitor"
343 +DMEVENTD_DAEMON="dmeventd"
344  
345 -sbindir=@SBINDIR@
346 +VGCHANGE="/sbin/vgchange"
347 +VGS="/sbin/vgs"
348 +LVS="/sbin/lvs"
349  
350 -VGCHANGE="$sbindir/vgchange"
351 -VGS="$sbindir/vgs"
352 -LVS="$sbindir/lvs"
353 -
354 -LOCK_FILE="@DEFAULT_SYS_LOCK_DIR@/subsys/$DAEMON"
355 -PID_FILE="@DMEVENTD_PIDFILE@"
356 +LOCK_FILE="/var/lock/subsys/$DAEMON"
357 +PID_FILE="/var/run/dmeventd.pid"
358  
359  WARN=1
360  export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
361  
362 -rh_status() {
363 -       status -p "$PID_FILE" "$DMEVENTD_DAEMON"
364 -}
365 -
366 -rh_status_q() {
367 -       rh_status >/dev/null 2>&1
368 -}
369  start()
370  {
371 -       ret=0
372 +       local config="'log{command_names=0 prefix=\"  \"}'"
373         # TODO do we want to separate out already active groups only?
374 -       VGSLIST=`$VGS --noheadings -o name --ignoreskippedcluster --config 'log{command_names=0 prefix="  "}' 2> /dev/null`
375 +       VGSLIST=`eval $VGS --noheadings -o name --ignoreskippedcluster --config $config 2> /dev/null`
376         for vg in $VGSLIST
377         do
378 -           action "Starting monitoring for VG $vg:" "$VGCHANGE" --monitor y --poll y --ignoreskippedcluster --config 'log{command_names=0 prefix="  "}' $vg || ret=$?
379 +               run_cmd "Starting monitoring for LVM VG $vg" $VGCHANGE --monitor y --poll y --ignoreskippedcluster --config $config $vg
380         done
381 -
382 -       return $ret
383  }
384  
385  
386  stop()
387  {
388 -       ret=0
389 +       local config="'log{command_names=0 prefix=\"  \"}'"
390         # TODO do we want to separate out already active groups only?
391         if test "$WARN" = "1"; then
392            echo "Not stopping monitoring, this is a dangerous operation. Please use force-stop to override."
393            return 1
394         fi
395 -       VGSLIST=`$VGS --noheadings -o name --ignoreskippedcluster --config 'log{command_names=0 prefix="  "}' 2> /dev/null`
396 +       VGSLIST=`eval $VGS --noheadings -o name --ignoreskippedcluster --config ${config} 2> /dev/null`
397         for vg in $VGSLIST
398         do
399 -           action "Stopping monitoring for VG $vg:" "$VGCHANGE" --monitor n --ignoreskippedcluster --config 'log{command_names=0 prefix="  "}' $vg || ret=$?
400 +               run_cmd "Stopping monitoring for LVM VG $vg" $VGCHANGE --monitor n --ignoreskippedcluster --config $config $vg
401         done
402 -       return $ret
403  }
404  
405 -rtrn=1
406 -
407 +RETVAL=0
408  # See how we were called.
409  case "$1" in
410    start)
411 -       rh_status_q && exit 0
412 +       status "$DMEVENTD_DAEMON" 1>/dev/null 2>&1 && exit 0
413         start
414 -       rtrn=$?
415 -       [ "$rtrn" = 0 ] && touch "$LOCK_FILE"
416 +       RETVAL=$?
417 +       [ "$RETVAL" = 0 ] && touch "$LOCK_FILE"
418         ;;
419  
420    force-stop)
421 -       rh_status_q || exit 0
422 +       status "$DMEVENTD_DAEMON" 1>/dev/null 2>&1 || exit 0
423         WARN=0
424         stop
425 -       rtrn=$?
426 -       [ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
427 +       RETVAL=$?
428 +       [ "$RETVAL" = 0 ] && rm -f "$LOCK_FILE"
429         ;;
430  
431    stop)
432 -       rh_status_q || exit 0
433 +       status "$DMEVENTD_DAEMON" 1>/dev/null 2>&1 || exit 0
434         test "$runlevel" = "0" && WARN=0
435         test "$runlevel" = "6" && WARN=0
436         stop
437 -       rtrn=$?
438 -       [ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
439 +       RETVAL=$?
440 +       [ "$RETVAL" = 0 ] && rm -f "$LOCK_FILE"
441         ;;
442  
443    restart)
444         WARN=0
445 -       if stop
446 -       then
447 -               start
448 -       fi 
449 -       rtrn=$?
450 +       stop
451 +       RETVAL=$?
452 +       [ "$RETVAL" = 0 ] && rm -f "$LOCK_FILE"
453 +       start
454 +       RETVAL=$?
455 +       [ "$RETVAL" = 0 ] && touch "$LOCK_FILE"
456         ;;
457  
458    status)
459 -       rh_status
460 -       rtrn=$?
461 -       [ "$rtrn" = 0 ] && "$LVS" -S 'seg_monitor=monitored' -o lv_full_name,seg_monitor
462 +       status "$DMEVENTD_DAEMON"
463 +       RETVAL=$?
464 +       [ "$RETVAL" = 0 ] && $LVS -S 'seg_monitor=monitored' -o lv_full_name,seg_monitor
465         ;;
466  
467    *)
468 -       echo $"Usage: $0 {start|stop|restart|status|force-stop}"
469 +       msg_usage "$0 {start|stop|restart|status|force-stop}"
470         ;;
471  esac
472  
473 -exit $rtrn
474 +exit $RETVAL