]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blame - multipath-tools/patches/0003-RH-root-init-script.patch
Move all packages to root.
[people/ms/ipfire-3.x.git] / multipath-tools / patches / 0003-RH-root-init-script.patch
CommitLineData
dc01aad8
SS
1From e6a23cc9de85a66d774567515592bdbdba7b2ca4 Mon Sep 17 00:00:00 2001
2From: Fabio M. Di Nitto <fdinitto@redhat.com>
3Date: Tue, 13 Oct 2009 08:19:01 +0200
4Subject: [PATCH 03/12] RH: root init script
5
6Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
7---
8:100644 100644 ee776f0... e46b1b8... M multipathd/multipathd.init.redhat
9 multipathd/multipathd.init.redhat | 38 ++++++++++++++++++++++++++++++++++++-
10 1 files changed, 37 insertions(+), 1 deletions(-)
11
12diff --git a/multipathd/multipathd.init.redhat b/multipathd/multipathd.init.redhat
13index ee776f0..e46b1b8 100644
14--- a/multipathd/multipathd.init.redhat
15+++ b/multipathd/multipathd.init.redhat
16@@ -2,7 +2,7 @@
17 #
18 # multipathd Starts the multipath daemon
19 #
20-# chkconfig: - 13 87
21+# chkconfig: - 06 87
22 # description: Manages device-mapper multipath devices
23
24 ### BEGIN INIT INFO
25@@ -17,6 +17,7 @@ prog=`basename $DAEMON`
26 initdir=/etc/rc.d/init.d
27 lockdir=/var/lock/subsys
28 sysconfig=/etc/sysconfig
29+syspath=/sys/block
30
31
32 . $initdir/functions
33@@ -25,6 +26,36 @@ test -r $sysconfig/$prog && . $sysconfig/$prog
34
35 RETVAL=0
36
37+teardown_slaves()
38+{
39+pushd $1 > /dev/null
40+if [ -d "slaves" ]; then
41+for slave in slaves/*;
42+do
43+ if [ "$slave" = "slaves/*" ]; then
44+ read dev < $1/dev
45+ tablename=`dmsetup table --target multipath | sed -n "s/\(.*\): .* $dev .*/\1/p"`
46+ if ! [ -z $tablename ]; then
47+ echo "Root is on a multipathed device, multipathd can not be stopped"
48+ exit 1
49+ fi
50+ else
51+ local_slave=`readlink -f $slave`;
52+ teardown_slaves $local_slave;
53+ fi
54+ done
55+
56+else
57+ read dev < $1/dev
58+ tablename=`dmsetup table --target multipath | sed -n "s/\(.*\): .* $dev .*/\1/p"`
59+ if ! [ -z $tablename ]; then
60+ echo "Root is on a multipathed device, multipathd can not be stopped"
61+ exit 1
62+ fi
63+fi
64+popd > /dev/null
65+}
66+
67 #
68 # See how we were called.
69 #
70@@ -39,6 +70,11 @@ start() {
71 }
72
73 stop() {
74+ root_dev=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/mtab)
75+ dm_num=`dmsetup info -c --noheadings -o minor $root_dev`
76+ root_dm_device="dm-$dm_num"
77+ [ -d $syspath/$root_dm_device ] && teardown_slaves $syspath/$root_dm_device
78+
79 echo -n $"Stopping $prog daemon: "
80 killproc $DAEMON
81 RETVAL=$?
82--
831.6.5.1
84