summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2012-02-09 08:35:05 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2012-02-09 08:35:05 +0000
commitbf55f8dee1ca081014d60b9b4ac798d1d98b9829 (patch)
tree0e1df1183d124e46230758eff401543ae161b969 /sys-block/open-iscsi
parentBug #383437: Fix iSNS SLP linking in the main binaries. (diff)
downloadgentoo-2-bf55f8dee1ca081014d60b9b4ac798d1d98b9829.tar.gz
gentoo-2-bf55f8dee1ca081014d60b9b4ac798d1d98b9829.tar.bz2
gentoo-2-bf55f8dee1ca081014d60b9b4ac798d1d98b9829.zip
Bug #307619: improve init script for BL2.
(Portage version: 2.2.0_alpha84/cvs/Linux x86_64)
Diffstat (limited to 'sys-block/open-iscsi')
-rw-r--r--sys-block/open-iscsi/ChangeLog6
-rw-r--r--sys-block/open-iscsi/files/iscsid-2.0.871-r1.init.d28
-rw-r--r--sys-block/open-iscsi/files/iscsid-conf.d5
3 files changed, 26 insertions, 13 deletions
diff --git a/sys-block/open-iscsi/ChangeLog b/sys-block/open-iscsi/ChangeLog
index 4098cad51e48..faf0c2cede0f 100644
--- a/sys-block/open-iscsi/ChangeLog
+++ b/sys-block/open-iscsi/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for sys-block/open-iscsi
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/ChangeLog,v 1.39 2012/02/09 08:29:45 robbat2 Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/ChangeLog,v 1.40 2012/02/09 08:35:05 robbat2 Exp $
+
+ 09 Feb 2012; Robin H. Johnson <robbat2@gentoo.org>
+ files/iscsid-2.0.871-r1.init.d, files/iscsid-conf.d:
+ Bug #307619: improve init script for BL2.
09 Feb 2012; Robin H. Johnson <robbat2@gentoo.org> open-iscsi-2.0.872.ebuild,
+files/open-iscsi-2.0.872-isns-slp.patch:
diff --git a/sys-block/open-iscsi/files/iscsid-2.0.871-r1.init.d b/sys-block/open-iscsi/files/iscsid-2.0.871-r1.init.d
index 179c131923eb..afcdb5f76d96 100644
--- a/sys-block/open-iscsi/files/iscsid-2.0.871-r1.init.d
+++ b/sys-block/open-iscsi/files/iscsid-2.0.871-r1.init.d
@@ -1,7 +1,7 @@
#!/sbin/runscript
-# Copyright 1999-2008 Gentoo Technologies, Inc.
+# Copyright 1999-2012 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
-# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/files/iscsid-2.0.871-r1.init.d,v 1.1 2009/11/12 09:29:48 robbat2 Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/files/iscsid-2.0.871-r1.init.d,v 1.2 2012/02/09 08:35:05 robbat2 Exp $
opts="${opts} starttargets stoptargets restarttargets"
@@ -10,6 +10,9 @@ depend() {
use net
}
+PIDFILE=${PIDFILE:-/var/run/${SVCNAME}.pid}
+BINARY="/usr/sbin/iscsid"
+
checkconfig() {
if [ ! -e /etc/conf.d/${SVCNAME} ]; then
eerror "Config file /etc/conf.d/${SVCNAME} does not exist!"
@@ -71,7 +74,7 @@ start() {
fi
ebegin "Starting ${SVCNAME}"
- start-stop-daemon --start --quiet --exec /usr/sbin/iscsid -- ${OPTS}
+ start-stop-daemon --start --quiet --exec ${BINARY} -- ${OPTS}
ret=$?
if [ $ret -ne 0 ]; then
eend $?
@@ -81,7 +84,11 @@ start() {
# Start automatic targets when iscsid is started
if [ "${AUTOSTARTTARGETS}" = "yes" ]; then
starttargets
- return $?
+ ret=$?
+ if [ "${AUTOSTART}" = "strict" ] && [ $ret -ne 0 ]; then
+ stop
+ return $ret
+ fi
fi
return 0
}
@@ -89,12 +96,9 @@ start() {
stop() {
stoptargets
ebegin "Stopping ${SVCNAME}"
- start-stop-daemon --signal HUP --stop --quiet --exec /usr/sbin/iscsid #--pidfile $PID_FILE
+ start-stop-daemon --stop --quiet --exec ${BINARY} --pidfile ${PIDFILE}
eend $?
- # ugly, but pid file is not removed by iscsid
- rm -f $PID_FILE
-
do_modules 'Removing iSCSI modules' 'iscsi_tcp scsi_transport_iscsi libiscsi' '-r'
eend $?
}
@@ -102,18 +106,18 @@ stop() {
starttargets() {
ebegin "Setting up iSCSI targets"
/usr/sbin/iscsiadm -m node --loginall=automatic
- ret=$?
+ ret=$?
eend $ret
- return $ret
+ return $ret
}
stoptargets() {
ebegin "Disconnecting iSCSI targets"
sync
/usr/sbin/iscsiadm -m node --logoutall=all
- ret=$?
+ ret=$?
eend $ret
- return $ret
+ return $ret
}
restarttargets() {
diff --git a/sys-block/open-iscsi/files/iscsid-conf.d b/sys-block/open-iscsi/files/iscsid-conf.d
index 1c4cc4054264..02e584fbce52 100644
--- a/sys-block/open-iscsi/files/iscsid-conf.d
+++ b/sys-block/open-iscsi/files/iscsid-conf.d
@@ -11,3 +11,8 @@ OPTS="-i ${INITIATORNAME_FILE}"
# Start automatic targets when iscsid is started
AUTOSTARTTARGETS="yes"
+
+# if set to "strict", iscsid will stop, if connecting the
+# autostart targets failed
+# AUTOSTART="strict"
+