fcoe-utils/fcoe-utils-1.0.17-init.patch
Petr Sabata 9a79b1c7b8 1.0.18+ bump
BuildRoot and ExcludeArch cleanup
2011-04-20 11:03:37 +02:00

119 lines
2.8 KiB
Diff

--- fcoe-utils-1.0.17/etc/initd/initd.fedora 2011-01-15 01:28:10.000000000 +0100
+++ fcoe-utils-1.0.17/etc/initd/initd.fedora.new 2011-02-04 10:54:50.152483041 +0100
@@ -15,7 +15,7 @@
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
#
-# chkconfig: - 21 80
+# chkconfig: 2345 21 80
#
# Maintained at www.Open-FCoE.org
@@ -23,7 +23,7 @@
# Provides: fcoe
# Required-Start: network
# Required-Stop:
-# Default-Start:
+# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Open-FCoE Initiator
# Description: Open-FCoE Initiator
--- fcoe-utils-1.0.17/etc/initd/initd.fedora 2011-02-04 11:06:42.251483139 +0100
+++ fcoe-utils-1.0.17/etc/initd/initd.fedora.new 2011-02-04 11:35:26.779482986 +0100
@@ -63,6 +63,16 @@
fi
}
+have_fcoe_root() {
+ # This simply checks if root is on a net device
+ local rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab)
+ if [[ "$rootopts" =~ "_netdev" ]]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
start()
{
echo -n $"Starting FCoE initiator service: "
@@ -80,22 +90,27 @@
stop()
{
- local force=$1
-
- pid=$(pidof "$FCOEMON")
- if [ "$force" == "force" ]
- then
- action "Destroying any active fcoe interface/s"
- [ "$pid" ] && kill -HUP $pid
+ if have_fcoe_root; then
+ echo $"Possible FCoE root detected, not stopping FCoE."
+ exit 1
else
- [ "$pid" ] && kill -TERM $pid
- fi
+ local force=$1
- action $"Stopping FCoE initiator service: "
-
- rm -f /var/run/fcoemon.*
- rm -f /tmp/fcoemon.dcbd.*
- rm -f /var/lock/subsys/fcoe
+ pid=$(pidof "$FCOEMON")
+ if [ "$force" == "force" ]
+ then
+ action "Destroying any active fcoe interface/s"
+ [ "$pid" ] && kill -HUP $pid
+ else
+ [ "$pid" ] && kill -TERM $pid
+ fi
+
+ action $"Stopping FCoE initiator service: "
+
+ rm -f /var/run/fcoemon.*
+ rm -f /tmp/fcoemon.dcbd.*
+ rm -f /var/lock/subsys/fcoe
+ fi
}
status()
--- fcoe-utils-1.0.17/etc/initd/initd.fedora 2011-02-04 11:52:53.990483140 +0100
+++ fcoe-utils-1.0.17/etc/initd/initd.fedora.new 2011-02-04 12:46:03.401482934 +0100
@@ -85,6 +85,34 @@
echo
touch /var/lock/subsys/fcoe
+ # Wait for the _netdev devices
+ if [ "$WAIT_TIMEOUT" = "" ]; then
+ WAIT_TIMEOUT=65
+ fi
+ local donewait=1
+ local devs=($(egrep 'by-path\/fc-.*_netdev' /etc/fstab | cut -d ' ' -f1))
+ if [ "$devs" != "" ]; then
+ echo -n "Waiting for FCoE devices . "
+ while [ $WAIT_TIMEOUT -gt 0 ]; do
+ for disk in ${devs[*]}; do
+ if ! test -b $disk; then
+ donewait=0
+ break
+ fi
+ done
+ test $donewait -eq 1 && break;
+ sleep 1
+ echo -n ". "
+ donewait=1
+ WAIT_TIMEOUT=$(($WAIT_TIMEOUT-1))
+ done
+ if [ "$WAIT_TIMEOUT" -eq 0 ]; then
+ echo "timed out!"
+ else
+ echo "done!"
+ fi
+ fi
+
echo
}