diff options
author | Tobias Scherbaum <dertobi123@gentoo.org> | 2008-12-06 16:57:10 +0000 |
---|---|---|
committer | Tobias Scherbaum <dertobi123@gentoo.org> | 2008-12-06 16:57:10 +0000 |
commit | 5e8d0e19174ee6ae5281dbc1f93d5b4c004634ee (patch) | |
tree | e0c67d6ce9a9ae6f4ebb1beea432ffda62b490cb /sys-block | |
parent | Fix linking with --as-needed, bug #247775 (diff) | |
download | gentoo-2-5e8d0e19174ee6ae5281dbc1f93d5b4c004634ee.tar.gz gentoo-2-5e8d0e19174ee6ae5281dbc1f93d5b4c004634ee.tar.bz2 gentoo-2-5e8d0e19174ee6ae5281dbc1f93d5b4c004634ee.zip |
Check if /etc/conf.d/iscsid exists and INITIATOR_FILENAME isn't empty. Thanks to Marcel Pennewiß and Craig (#196096)
(Portage version: 2.2_rc17/cvs/Linux 2.6.25-gentoo-r7 x86_64)
Diffstat (limited to 'sys-block')
-rw-r--r-- | sys-block/open-iscsi/ChangeLog | 9 | ||||
-rw-r--r-- | sys-block/open-iscsi/files/iscsid-2.0.870.init.d-r1 | 120 | ||||
-rw-r--r-- | sys-block/open-iscsi/open-iscsi-2.0.870-r1.ebuild | 100 |
3 files changed, 228 insertions, 1 deletions
diff --git a/sys-block/open-iscsi/ChangeLog b/sys-block/open-iscsi/ChangeLog index e3f021f8d850..23118627249f 100644 --- a/sys-block/open-iscsi/ChangeLog +++ b/sys-block/open-iscsi/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for sys-block/open-iscsi # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/ChangeLog,v 1.18 2008/11/17 20:58:44 dertobi123 Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/ChangeLog,v 1.19 2008/12/06 16:57:10 dertobi123 Exp $ + +*open-iscsi-2.0.870-r1 (06 Dec 2008) + + 06 Dec 2008; Tobias Scherbaum <dertobi123@gentoo.org> + +files/iscsid-2.0.870.init.d-r1, +open-iscsi-2.0.870-r1.ebuild: + Check if /etc/conf.d/iscsid exists and INITIATOR_FILENAME isn't empty. + Thanks to Marcel Pennewiß and Craig (#196096) *open-iscsi-2.0.870 (17 Nov 2008) diff --git a/sys-block/open-iscsi/files/iscsid-2.0.870.init.d-r1 b/sys-block/open-iscsi/files/iscsid-2.0.870.init.d-r1 new file mode 100644 index 000000000000..252702c56fae --- /dev/null +++ b/sys-block/open-iscsi/files/iscsid-2.0.870.init.d-r1 @@ -0,0 +1,120 @@ +#!/sbin/runscript +# Copyright 1999-2008 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.870.init.d-r1,v 1.1 2008/12/06 16:57:10 dertobi123 Exp $ + +opts="${opts} starttargets stoptargets restarttargets" + +depend() { + after modules + use net +} + +checkconfig() { + if [ ! -e /etc/conf.d/${SVCNAME} ]; then + eerror "Config file /etc/conf.d/${SVCNAME} does not exist!" + return 1 + fi + if [ ! -e "${CONFIG_FILE}" ]; then + eerror "Config file ${CONFIG_FILE} does not exist!" + return 1 + fi + if [ ! -e "${INITIATORNAME_FILE}" ]; then + eerror "Config file for InitiatorName (${INITIATORNAME_FILE}) does not exist!" + return 1 + fi + if ! grep -q "^InitiatorName=iqn\." "${INITIATORNAME_FILE}"; 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 + modopts="$@" + for m in ${modules} + do + if [ -n "$(modprobe -l | grep ${m})" ] + then + ebegin "${msg} ${m}" + modprobe ${modopts} ${m} + ret=$? + eend ${ret} + if [ ${ret} -ne 0 ]; then + return ${ret} + fi + else + ebegin "${msg} ${m}: not found" + return 1 + fi + done + return 0 +} + +start() { + ebegin "Checking open-iSCSI configuration" + checkconfig + ret=$? + if [ $ret -ne 0 ]; then + eend 1 + return 1 + fi + ebegin "Loading iSCSI modules" + do_modules 'Loading' 'libiscsi scsi_transport_iscsi iscsi_tcp' + ret=$? + if [ $ret -ne 0 ]; then + eend 1 + return 1 + fi + + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --quiet --exec /usr/sbin/iscsid -- ${OPTS} + eend $? + + # Start automatic targets when iscsid is started + [ "${AUTOSTARTTARGETS}" = "yes" ] && starttargets + return 0 +} + +stop() { + stoptargets + 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 libiscsi' '-r' + eend $? +} + +starttargets() { + ebegin "Setting up iSCSI targets" + /usr/sbin/iscsiadm -m node --loginall=automatic + eend $? +} + +stoptargets() { + ebegin "Disconnecting iSCSI targets" + sync + /usr/sbin/iscsiadm -m node --logoutall=all + eend $? +} + +restarttargets() { + stoptargets + starttargets +} + +status() { + ebegin "Showing current active iSCSI sessions" + /usr/sbin/iscsiadm -m session +} diff --git a/sys-block/open-iscsi/open-iscsi-2.0.870-r1.ebuild b/sys-block/open-iscsi/open-iscsi-2.0.870-r1.ebuild new file mode 100644 index 000000000000..2f7bf0e08bd2 --- /dev/null +++ b/sys-block/open-iscsi/open-iscsi-2.0.870-r1.ebuild @@ -0,0 +1,100 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/open-iscsi-2.0.870-r1.ebuild,v 1.1 2008/12/06 16:57:10 dertobi123 Exp $ + +inherit versionator linux-mod eutils flag-o-matic toolchain-funcs + +DESCRIPTION="Open-iSCSI is a high performance, transport independent, multi-platform implementation of RFC3720" +HOMEPAGE="http://www.open-iscsi.org/" +MY_PV="${PN}-$(replace_version_separator 2 "-" $MY_PV)" +SRC_URI="http://www.open-iscsi.org/bits/${MY_PV}.tar.gz" +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86 ~amd64 ~ppc ~mips" +IUSE="modules utils debug" +DEPEND="virtual/libc + virtual/linux-sources" +RDEPEND="${DEPEND} + virtual/modutils + sys-apps/util-linux" + +S="${WORKDIR}/${MY_PV}" + +MODULE_NAMES_ARG="kernel/drivers/scsi:${S}/kernel" +MODULE_NAMES="iscsi_tcp(${MODULE_NAMES_ARG}) scsi_transport_iscsi(${MODULE_NAMES_ARG}) libiscsi(${MODULE_NAMES_ARG})" +BUILD_TARGETS="all" +CONFIG_CHECK="CRYPTO_CRC32C" +ERROR_CFG="open-iscsi needs CRC32C support in your kernel." + +src_unpack() { + unpack ${A} + export EPATCH_OPTS="-d${S}" + if [ $KV_PATCH -lt 15 ]; then + die "Sorry, your kernel must be 2.6.16-rc5 or newer!" + fi +} + +src_compile() { + use debug && append-flags -DDEBUG_TCP -DDEBUG_SCSI + + if use modules; then + einfo "Building kernel modules" + export KSRC="${KERNEL_DIR}" + linux-mod_src_compile || die "failed to build modules" + fi + + einfo "Building fwparam_ibft" + cd "${S}"/utils/fwparam_ibft && \ + CFLAGS="" emake OPTFLAGS="${CFLAGS}" CC="$(tc-getCC)" \ + || die "emake failed" + + einfo "Building userspace" + cd "${S}"/usr && \ + CFLAGS="" emake OPTFLAGS="${CFLAGS}" CC="$(tc-getCC)" \ + || die "emake failed" + + if use utils; then + einfo "Building utils" + cd "${S}"/utils && \ + CFLAGS="" emake OPTFLAGS="${CFLAGS}" CC="$(tc-getCC)" \ + || die "emake failed" + fi +} + +src_install() { + if use modules; then + einfo "Installing kernel modules" + export KSRC="${KERNEL_DIR}" + linux-mod_src_install + fi + + einfo "Installing userspace" + dosbin usr/iscsid usr/iscsiadm usr/iscsistart + + if use utils; then + einfo "Installing utilities" + dosbin utils/iscsi-iname utils/iscsi_discovery + fi + + einfo "Installing docs" + doman doc/*[1-8] + dodoc README THANKS + docinto test + dodoc test/* + + einfo "Installing configuration" + insinto /etc/iscsi + doins etc/iscsid.conf + doins "${FILESDIR}"/initiatorname.iscsi + insinto /etc/conf.d + newins "${FILESDIR}"/iscsid-${PV}.conf.d iscsid + newinitd "${FILESDIR}"/iscsid-${PV}.init.d-r1 iscsid + + keepdir /var/db/iscsi + fperms 700 /var/db/iscsi + fperms 600 /etc/iscsi/iscsid.conf +} + +pkg_postinst() { + linux-mod_pkg_postinst +} |