diff options
author | Mike Doty <kingtaco@gentoo.org> | 2008-03-25 02:33:04 +0000 |
---|---|---|
committer | Mike Doty <kingtaco@gentoo.org> | 2008-03-25 02:33:04 +0000 |
commit | 269a99a637daa900cfb58c4a667acc4dc32ddcd7 (patch) | |
tree | 535618f4573fda4c4c3486196b5ac58ac7acb466 /sys-block/open-iscsi/files | |
parent | Version bump. https://savannah.gnu.org/forum/forum.php?forum_id=5248 (diff) | |
download | gentoo-2-269a99a637daa900cfb58c4a667acc4dc32ddcd7.tar.gz gentoo-2-269a99a637daa900cfb58c4a667acc4dc32ddcd7.tar.bz2 gentoo-2-269a99a637daa900cfb58c4a667acc4dc32ddcd7.zip |
adding open-iscsi-2.0.868_rc1.ebuild and related files thanks to Craig <craig -at- haquarter.de> Bug 196096
(Portage version: 2.1.4.4)
Diffstat (limited to 'sys-block/open-iscsi/files')
-rw-r--r-- | sys-block/open-iscsi/files/iscsid-2.0.868_rc1.conf.d | 11 | ||||
-rw-r--r-- | sys-block/open-iscsi/files/iscsid-2.0.868_rc1.init.d | 66 |
2 files changed, 77 insertions, 0 deletions
diff --git a/sys-block/open-iscsi/files/iscsid-2.0.868_rc1.conf.d b/sys-block/open-iscsi/files/iscsid-2.0.868_rc1.conf.d new file mode 100644 index 000000000000..37dbbe14d04d --- /dev/null +++ b/sys-block/open-iscsi/files/iscsid-2.0.868_rc1.conf.d @@ -0,0 +1,11 @@ +# /etc/conf.d/iscsid + +# config file to use +CONFIG_FILE=/etc/iscsi/iscsid.conf + +# you need to specify an initiatorname in the file +INITIATORNAME_FILE=/etc/iscsi/initiatorname.iscsi + +# options to pass to iscsid +OPTS="-i ${INITIATORNAME_FILE}" + diff --git a/sys-block/open-iscsi/files/iscsid-2.0.868_rc1.init.d b/sys-block/open-iscsi/files/iscsid-2.0.868_rc1.init.d new file mode 100644 index 000000000000..2b70d6494b4b --- /dev/null +++ b/sys-block/open-iscsi/files/iscsid-2.0.868_rc1.init.d @@ -0,0 +1,66 @@ +#!/sbin/runscript +# Copyright 1999-2005 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.868_rc1.init.d,v 1.1 2008/03/25 02:33:04 kingtaco Exp $ + +depend() { + after modules + use net +} + +checkconfig() { + if [ ! -f $CONFIG_FILE ]; then + eerror "Config file $CONFIG_FILE does not exist!" + return 1 + fi + if ! grep "^InitiatorName=iqn." ${INITIATORNAME_FILE} &>/dev/null; then + ewarn "${INITIATORNAME_FILE} should contain a string with your initiatior name." + IQN=iqn.$(date +%Y-%m).$(hostname -f | awk 'BEGIN { FS=".";}{x=NF; while (x>0) {printf $x ;x--; if (x>0) printf ".";} print ""}'):openiscsi + IQN=${IQN}-$(echo ${RANDOM}${RANDOM}${RANDOM}${RANDOM}${RANDOM} | md5sum | sed -e "s/\(.*\) -/\1/g" -e 's/ //g') + ebegin "Creating InitiatorName ${IQN} in ${INITIATORNAME_FILE}" + echo "InitiatorName=${IQN}" >> ${INITIATORNAME_FILE} + eend $? + fi +} + +do_modules() { + msg="$1" + shift + modules="$1" + shift + opts="$@" + for m in ${modules}; do + ebegin "${msg} - ${m}" + modprobe ${opts} $m + ret=$? + eend $ret + [ $ret -ne 0 ] && return $ret + done + return 0 +} + +start() { + checkconfig + do_modules 'Loading iSCSI modules' 'scsi_transport_iscsi iscsi_tcp' + ret=$? + [ $ret -ne 0 ] && return 1 + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --quiet --exec /usr/sbin/iscsid -- ${OPTS} + ret=$? + eend $ret + return $ret +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --signal HUP --stop --quiet --exec /usr/sbin/iscsid #--pidfile $PID_FILE + eend $? + + # ugly, but pid file is not removed by iscsid + rm -f $PID_FILE + + do_modules 'Removing iSCSI modules' 'iscsi_tcp scsi_transport_iscsi' '-r' + ret=$? + return $ret +} + |