From bf0e149a8b30880914b7ce3b57c4b85cd0ce7905 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Mon, 5 Oct 2015 11:46:36 +0000 Subject: [PATCH] - reworked/updated init scripts --- lvm2-tld_init.patch | 444 ++++++++++++++++++++++++++++++++++++++++---- lvm2.spec | 13 +- 2 files changed, 422 insertions(+), 35 deletions(-) diff --git a/lvm2-tld_init.patch b/lvm2-tld_init.patch index 176e185..bfaea6f 100644 --- a/lvm2-tld_init.patch +++ b/lvm2-tld_init.patch @@ -1,26 +1,40 @@ -diff -dur LVM2.2.02.107.orig/scripts/blk_availability_init_red_hat.in LVM2.2.02.107/scripts/blk_availability_init_red_hat.in ---- LVM2.2.02.107.orig/scripts/blk_availability_init_red_hat.in 2014-06-23 14:07:38.000000000 +0000 -+++ LVM2.2.02.107/scripts/blk_availability_init_red_hat.in 2014-07-25 16:24:42.989000000 +0000 +diff -ur LVM2.2.02.132.orig/scripts/blk_availability_init_red_hat.in LVM2.2.02.132/scripts/blk_availability_init_red_hat.in +--- LVM2.2.02.132.orig/scripts/blk_availability_init_red_hat.in 2015-09-22 15:00:59.000000000 +0000 ++++ LVM2.2.02.132/scripts/blk_availability_init_red_hat.in 2015-10-05 11:36:09.176042000 +0000 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # Copyright (C) 2012 Red Hat, Inc. All rights reserved. # -@@ -43,16 +43,20 @@ +@@ -31,28 +31,26 @@ + + . /etc/init.d/functions + +-sbindir=@sbindir@ +-script=blkdeactivate +-options="-u -l wholevg" ++DAEMON="blkdeactivate" ++OPTIONS="-u -l wholevg" + + LOCK_FILE="/var/lock/subsys/blk-availability" + +- +-rtrn=1 +- case "$1" in start) touch $LOCK_FILE + exit 0 ;; - +- stop) - action "Stopping block device availability:" $sbindir/$script $options -+ run_cmd "Stopping block device availability:" $sbindir/$script $options ++ run_cmd "Stopping block device availability:" /sbin/$DAEMON $OPTIONS rm -f $LOCK_FILE + exit 0 ;; - +- status) + exit 0 ;; @@ -30,22 +44,10 @@ diff -dur LVM2.2.02.107.orig/scripts/blk_availability_init_red_hat.in LVM2.2.02. + exit 3 ;; esac -diff -dur LVM2.2.02.107.orig/scripts/blk_availability_systemd_red_hat.service.in LVM2.2.02.107/scripts/blk_availability_systemd_red_hat.service.in ---- LVM2.2.02.107.orig/scripts/blk_availability_systemd_red_hat.service.in 2014-06-23 14:07:38.000000000 +0000 -+++ LVM2.2.02.107/scripts/blk_availability_systemd_red_hat.service.in 2014-07-25 16:24:42.992000000 +0000 -@@ -6,7 +6,7 @@ - - [Service] - Type=oneshot --ExecStart=/usr/bin/true -+ExecStart=/bin/true - ExecStop=@sbindir@/blkdeactivate -u -l wholevg - RemainAfterExit=yes - -diff -dur LVM2.2.02.107.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.107/scripts/clvmd_init_red_hat.in ---- LVM2.2.02.107.orig/scripts/clvmd_init_red_hat.in 2014-06-23 14:07:38.000000000 +0000 -+++ LVM2.2.02.107/scripts/clvmd_init_red_hat.in 2014-07-25 16:24:42.989000000 +0000 -@@ -66,9 +66,8 @@ +diff -ur LVM2.2.02.132.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.132/scripts/clvmd_init_red_hat.in +--- LVM2.2.02.132.orig/scripts/clvmd_init_red_hat.in 2015-09-22 15:00:59.000000000 +0000 ++++ LVM2.2.02.132/scripts/clvmd_init_red_hat.in 2015-10-05 09:44:25.805042000 +0000 +@@ -61,9 +61,8 @@ start() { if ! rh_status_q; then @@ -56,7 +58,7 @@ diff -dur LVM2.2.02.107.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.107/scripts fi # Refresh local cache. -@@ -88,7 +87,7 @@ +@@ -83,7 +82,7 @@ ${lvm_vgscan} > /dev/null 2>&1 @@ -65,7 +67,7 @@ diff -dur LVM2.2.02.107.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.107/scripts touch $LOCK_FILE -@@ -113,27 +112,23 @@ +@@ -108,27 +107,23 @@ [ -z "$LVM_VGS" ] && LVM_VGS="$(clustered_vgs)" if [ -n "$LVM_VGS" ]; then @@ -98,7 +100,7 @@ diff -dur LVM2.2.02.107.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.107/scripts fi rm -f $LOCK_FILE -@@ -143,7 +138,7 @@ +@@ -138,7 +133,7 @@ reload() { rh_status_q || exit 7 @@ -107,7 +109,7 @@ diff -dur LVM2.2.02.107.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.107/scripts } restart() { -@@ -154,7 +149,7 @@ +@@ -149,7 +144,7 @@ # Try to get clvmd to restart itself. This will preserve # exclusive LV locks @@ -116,17 +118,330 @@ diff -dur LVM2.2.02.107.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.107/scripts # If that fails then do a normal stop & restart if [ $? != 0 ]; then -diff -dur LVM2.2.02.107.orig/scripts/lvm2_monitoring_init_red_hat.in LVM2.2.02.107/scripts/lvm2_monitoring_init_red_hat.in ---- LVM2.2.02.107.orig/scripts/lvm2_monitoring_init_red_hat.in 2014-06-23 14:07:38.000000000 +0000 -+++ LVM2.2.02.107/scripts/lvm2_monitoring_init_red_hat.in 2014-07-25 16:46:56.772000000 +0000 +diff -ur LVM2.2.02.132.orig/scripts/lvm2_lvmetad_init_red_hat.in LVM2.2.02.132/scripts/lvm2_lvmetad_init_red_hat.in +--- LVM2.2.02.132.orig/scripts/lvm2_lvmetad_init_red_hat.in 2015-09-22 15:00:59.000000000 +0000 ++++ LVM2.2.02.132/scripts/lvm2_lvmetad_init_red_hat.in 2015-10-05 11:12:06.584042000 +0000 +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # Copyright (C) 2012 Red Hat, Inc. All rights reserved. + # +@@ -33,80 +33,76 @@ + + . /etc/init.d/functions + +-DAEMON=lvmetad +- +-exec_prefix=@exec_prefix@ +-sbindir=@sbindir@ ++DAEMON="lvmetad" ++NAME="LVM metadata daemon" + + LOCK_FILE="/var/lock/subsys/$DAEMON" + PID_FILE="@LVMETAD_PIDFILE@" + +-rh_status() { +- status -p $PID_FILE $DAEMON ++start() { ++ if [ -f $LOCK_FILE ]; then ++ msg_already_running $NAME ++ return ++ fi ++ msg_starting $NAME ++ daemon /sbin/$DAEMON /dev/null 2>&1 ++stop() { ++ if [ ! -f $LOCK_FILE ]; then ++ msg_not_running $NAME ++ return ++ fi ++ msg_stopping $NAME ++ killproc --pidfile $PID_FILE $DAEMON ++ rm -f $LOCK_FILE + } + +-start() +-{ +- ret=0 +- action "Starting LVM metadata daemon:" $DAEMON || ret=$? +- return $ret ++condrestart() { ++ if [ ! -f $LOCK_FILE ]; then ++ msg_not_running $NAME ++ RETVAL=$1 ++ return ++ fi ++ stop ++ start + } + +- +-stop() +-{ +- ret=0 +- action "Signaling LVM metadata daemon to exit:" killproc -p $PID_FILE $DAEMON -TERM || ret=$? +- return $ret ++reload() { ++ if [ ! -f $LOCK_FILE ]; then ++ msg_not_running $NAME ++ RETVAL=7 ++ return ++ fi ++ msg_reloading $NAME ++ killproc $DAEMON -HUP ++ RETVAL=$? + } + +-rtrn=1 +- ++RETVAL=0 + # See how we were called. + case "$1" in + start) +- rh_status_q && exit 0 + start +- rtrn=$? +- [ $rtrn = 0 ] && touch $LOCK_FILE + ;; +- +- stop|force-stop) +- rh_status_q || exit 0 ++ stop) + stop +- rtrn=$? +- [ $rtrn = 0 ] && rm -f $LOCK_FILE + ;; +- + restart) +- if stop +- then +- start +- fi +- rtrn=$? ++ stop ++ start + ;; +- + condrestart|try-restart) +- rh_status_q || exit 0 +- if stop +- then +- start +- fi +- rtrn=$? ++ condrestart 0 + ;; +- + status) +- rh_status +- rtrn=$? ++ status $DAEMON ++ exit $? + ;; +- + *) +- echo $"Usage: $0 {start|stop|force-stop|restart|condrestart|try-restart|status}" ++ msg_usage "$0 {start|stop|force-stop|restart|condrestart|try-restart|status}" + ;; + esac +- +-exit $rtrn ++exit $RETVAL +diff -ur LVM2.2.02.132.orig/scripts/lvm2_lvmpolld_init_red_hat.in LVM2.2.02.132/scripts/lvm2_lvmpolld_init_red_hat.in +--- LVM2.2.02.132.orig/scripts/lvm2_lvmpolld_init_red_hat.in 2015-09-22 15:00:59.000000000 +0000 ++++ LVM2.2.02.132/scripts/lvm2_lvmpolld_init_red_hat.in 2015-10-05 11:11:58.892042000 +0000 +@@ -1,6 +1,6 @@ +-#!/bin/bash ++#!/bin/sh + # +-# Copyright (C) 2015 Red Hat, Inc. All rights reserved. ++# Copyright (C) 2012 Red Hat, Inc. All rights reserved. + # + # This copyrighted material is made available to anyone wishing to use, + # modify, copy, or redistribute it subject to the terms and conditions +@@ -27,88 +27,84 @@ + # Default-Start: 1 2 3 4 5 + # Default-Stop: 0 6 + # Short-Description: A daemon that is responsible for monitoring in-progress +-# and possibly longer term operations on logical volumes. +-# It helps to reduce the number of spawned processes if same ++# and possibly longer term operations on logical volumes. ++# It helps to reduce the number of spawned processes if same + # logical volume is requested to get monitored multiple times. + # Also avoids unsolicited termination due to external factors. + ### END INIT INFO + + . /etc/init.d/functions + +-DAEMON=lvmpolld +- +-exec_prefix=@exec_prefix@ +-sbindir=@sbindir@ ++DAEMON="lvmpolld" ++NAME="LVM poll daemon" + + LOCK_FILE="/var/lock/subsys/$DAEMON" + PID_FILE="@LVMPOLLD_PIDFILE@" + +-rh_status() { +- status -p $PID_FILE $DAEMON ++start() { ++ if [ -f $LOCK_FILE ]; then ++ msg_already_running $NAME ++ return ++ fi ++ msg_starting $NAME ++ daemon /sbin/$DAEMON /dev/null 2>&1 ++stop() { ++ if [ ! -f $LOCK_FILE ]; then ++ msg_not_running $NAME ++ return ++ fi ++ msg_stopping $NAME ++ killproc --pidfile $PID_FILE $DAEMON ++ rm -f $LOCK_FILE + } + +-start() +-{ +- ret=0 +- action "Starting LVM poll daemon:" $DAEMON || ret=$? +- return $ret ++condrestart() { ++ if [ ! -f $LOCK_FILE ]; then ++ msg_not_running $NAME ++ RETVAL=$1 ++ return ++ fi ++ stop ++ start + } + +- +-stop() +-{ +- ret=0 +- action "Signaling LVM poll daemon to exit:" killproc -p $PID_FILE $DAEMON -TERM || ret=$? +- return $ret ++reload() { ++ if [ ! -f $LOCK_FILE ]; then ++ msg_not_running $NAME ++ RETVAL=7 ++ return ++ fi ++ msg_reloading $NAME ++ killproc $DAEMON -HUP ++ RETVAL=$? + } + +-rtrn=1 +- ++RETVAL=0 + # See how we were called. + case "$1" in + start) +- rh_status_q && exit 0 + start +- rtrn=$? +- [ $rtrn = 0 ] && touch $LOCK_FILE + ;; +- +- stop|force-stop) +- rh_status_q || exit 0 ++ stop) + stop +- rtrn=$? +- [ $rtrn = 0 ] && rm -f $LOCK_FILE + ;; +- + restart) +- if stop +- then +- start +- fi +- rtrn=$? ++ stop ++ start + ;; +- + condrestart|try-restart) +- rh_status_q || exit 0 +- if stop +- then +- start +- fi +- rtrn=$? ++ condrestart 0 + ;; +- + status) +- rh_status +- rtrn=$? ++ status $DAEMON ++ exit $? + ;; +- + *) +- echo $"Usage: $0 {start|stop|force-stop|restart|condrestart|try-restart|status}" ++ msg_usage "$0 {start|stop|force-stop|restart|condrestart|try-restart|status}" + ;; + esac +- +-exit $rtrn ++exit $RETVAL +diff -ur LVM2.2.02.132.orig/scripts/lvm2_monitoring_init_red_hat.in LVM2.2.02.132/scripts/lvm2_monitoring_init_red_hat.in +--- LVM2.2.02.132.orig/scripts/lvm2_monitoring_init_red_hat.in 2015-09-22 15:00:59.000000000 +0000 ++++ LVM2.2.02.132/scripts/lvm2_monitoring_init_red_hat.in 2015-10-05 11:33:13.048042000 +0000 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # Copyright (C) 2007-2009 Red Hat, Inc. All rights reserved. # -@@ -46,32 +46,29 @@ +@@ -31,15 +31,12 @@ + + . /etc/init.d/functions + +-DAEMON=lvm2-monitor +-DMEVENTD_DAEMON=dmeventd ++DAEMON="lvm2-monitor" ++DMEVENTD_DAEMON="dmeventd" + +-exec_prefix=@exec_prefix@ +-sbindir=@sbindir@ +- +-VGCHANGE=${sbindir}/vgchange +-VGS=${sbindir}/vgs +-LVS=${sbindir}/lvs ++VGCHANGE="/sbin/vgchange" ++VGS="/sbin/vgs" ++LVS="/sbin/lvs" + LOCK_FILE="/var/lock/subsys/$DAEMON" + PID_FILE="@DMEVENTD_PIDFILE@" +@@ -47,89 +44,69 @@ + WARN=1 + export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1 + +-rh_status() { +- status -p $PID_FILE $DMEVENTD_DAEMON +-} +- +-rh_status_q() { +- rh_status >/dev/null 2>&1 +-} start() { - ret=0 @@ -163,4 +478,69 @@ diff -dur LVM2.2.02.107.orig/scripts/lvm2_monitoring_init_red_hat.in LVM2.2.02.1 - return $ret } - rtrn=1 +-rtrn=1 +- ++RETVAL=0 + # See how we were called. + case "$1" in + start) +- rh_status_q && exit 0 ++ status $DMEVENTD_DAEMON || exit 0 + start +- rtrn=$? +- [ $rtrn = 0 ] && touch $LOCK_FILE ++ RETVAL=$? ++ [ $RETVAL = 0 ] && touch $LOCK_FILE + ;; +- + force-stop) +- rh_status_q || exit 0 ++ status $DMEVENTD_DAEMON || exit 0 + WARN=0 + stop +- rtrn=$? +- [ $rtrn = 0 ] && rm -f $LOCK_FILE ++ RETVAL=$? ++ [ $RETVAL = 0 ] && rm -f $LOCK_FILE + ;; +- + stop) +- rh_status_q || exit 0 ++ status $DMEVENTD_DAEMON || exit 0 + test "$runlevel" = "0" && WARN=0 + test "$runlevel" = "6" && WARN=0 + stop +- rtrn=$? +- [ $rtrn = 0 ] && rm -f $LOCK_FILE ++ RETVAL=$? ++ [ $RETVAL = 0 ] && rm -f $LOCK_FILE + ;; +- + restart) + WARN=0 +- if stop +- then +- start +- fi +- rtrn=$? ++ stop ++ start + ;; +- + status) +- rh_status +- rtrn=$? +- [ $rtrn = 0 ] && $LVS -S 'seg_monitor=monitored' -o lv_full_name,seg_monitor ++ status $DMEVENTD_DAEMON ++ RETVAL=$? ++ [ $RETVAL = 0 ] && $LVS -S 'seg_monitor=monitored' -o lv_full_name,seg_monitor + ;; +- + *) +- echo $"Usage: $0 {start|stop|restart|status|force-stop}" ++ msg_usage "$0 {start|stop|restart|status|force-stop}" + ;; + esac +- +-exit $rtrn ++exit $RETVAL diff --git a/lvm2.spec b/lvm2.spec index ee98394..5d10fdb 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -40,7 +40,7 @@ Summary: The new version of Logical Volume Manager for Linux Summary(pl.UTF-8): Nowa wersja Logical Volume Managera dla Linuksa Name: lvm2 Version: 2.02.132 -Release: 1 +Release: 1.1 License: GPL v2 and LGPL v2.1 Group: Applications/System Source0: ftp://sources.redhat.com/pub/lvm2/LVM2.%{version}.tgz @@ -465,16 +465,23 @@ cp -a libdm/libdevmapper.a $RPM_BUILD_ROOT%{_libdir} rm -rf $RPM_BUILD_ROOT %post +/sbin/chkconfig --add lvm2-lvmetad +%service lvm2-lvmetad restart /sbin/chkconfig --add lvm2-monitor %service lvm2-monitor restart +/sbin/chkconfig --add lvm2-lvmpolld +%service lvm2-lvmpolld restart +# no service restart available /sbin/chkconfig --add blk-availability -# no service blk-availability restart %postun if [ "$1" = "0" ]; then + %service lvm2-lvmetad stop + /sbin/chkconfig --del lvm2-lvmetad + %service lvm2-lvmpolld stop + /sbin/chkconfig --del lvm2-lvmpolld %service lvm2-monitor stop /sbin/chkconfig --del lvm2-monitor - #no service blk-availability stop /sbin/chkconfig --del blk-availability fi -- 2.44.0