summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuli Suominen <ssuominen@gentoo.org>2013-03-07 10:23:45 +0000
committerSamuli Suominen <ssuominen@gentoo.org>2013-03-07 10:23:45 +0000
commitca1f3f787e63dae93d8835bebdb8159f6fae45f1 (patch)
tree51a5eee55f1da6791794f3901be884fd99376650 /sys-block
parentUpdate mask for emacs-vcs live ebuilds. (diff)
downloadgentoo-2-ca1f3f787e63dae93d8835bebdb8159f6fae45f1.tar.gz
gentoo-2-ca1f3f787e63dae93d8835bebdb8159f6fae45f1.tar.bz2
gentoo-2-ca1f3f787e63dae93d8835bebdb8159f6fae45f1.zip
Stop using "modprobe -l" which went away with sys-apps/kmod wrt #409931
(Portage version: 2.2.0_alpha163/cvs/Linux x86_64, signed Manifest commit with key 4868F14D)
Diffstat (limited to 'sys-block')
-rw-r--r--sys-block/open-iscsi/ChangeLog8
-rw-r--r--sys-block/open-iscsi/files/open-iscsi-2.0.872-init.d-r1131
-rw-r--r--sys-block/open-iscsi/open-iscsi-2.0.872-r2.ebuild105
3 files changed, 243 insertions, 1 deletions
diff --git a/sys-block/open-iscsi/ChangeLog b/sys-block/open-iscsi/ChangeLog
index 26738b76d953..6f88800bc394 100644
--- a/sys-block/open-iscsi/ChangeLog
+++ b/sys-block/open-iscsi/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for sys-block/open-iscsi
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/ChangeLog,v 1.49 2013/01/06 11:10:30 ago Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/ChangeLog,v 1.50 2013/03/07 10:23:44 ssuominen Exp $
+
+*open-iscsi-2.0.872-r2 (07 Mar 2013)
+
+ 07 Mar 2013; Samuli Suominen <ssuominen@gentoo.org>
+ +open-iscsi-2.0.872-r2.ebuild, +files/open-iscsi-2.0.872-init.d-r1:
+ Stop using "modprobe -l" which went away with sys-apps/kmod wrt #409931
06 Jan 2013; Agostino Sarubbo <ago@gentoo.org> open-iscsi-2.0.872-r1.ebuild:
Add ~sparc, wrt bug #449220
diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.872-init.d-r1 b/sys-block/open-iscsi/files/open-iscsi-2.0.872-init.d-r1
new file mode 100644
index 000000000000..ec991687b59e
--- /dev/null
+++ b/sys-block/open-iscsi/files/open-iscsi-2.0.872-init.d-r1
@@ -0,0 +1,131 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation, Inc.
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/files/open-iscsi-2.0.872-init.d-r1,v 1.1 2013/03/07 10:23:45 ssuominen Exp $
+
+opts="${opts} starttargets stoptargets restarttargets"
+
+depend() {
+ after modules
+ 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!"
+ return 1
+ fi
+ if [ ! -e "${CONFIG_FILE}" ]; then
+ eerror "Config file ${CONFIG_FILE} does not exist!"
+ return 1
+ fi
+ if [ ! -e ${INITIATORNAME_FILE} ] || [ ! "$(grep "^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 modprobe --show --quiet "${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 ${BINARY} -- ${OPTS}
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ eend $?
+ return $?
+ fi
+
+ # Start automatic targets when iscsid is started
+ if [ "${AUTOSTARTTARGETS}" = "yes" ]; then
+ starttargets
+ ret=$?
+ if [ "${AUTOSTART}" = "strict" ] && [ $ret -ne 0 ]; then
+ stop
+ return $ret
+ fi
+ fi
+ return 0
+}
+
+stop() {
+ stoptargets
+ ebegin "Stopping ${SVCNAME}"
+ start-stop-daemon --stop --quiet --exec ${BINARY} --pidfile ${PIDFILE}
+ eend $?
+
+ 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
+ ret=$?
+ eend $ret
+ return $ret
+}
+
+stoptargets() {
+ ebegin "Disconnecting iSCSI targets"
+ sync
+ /usr/sbin/iscsiadm -m node --logoutall=all
+ ret=$?
+ eend $ret
+ return $ret
+}
+
+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.872-r2.ebuild b/sys-block/open-iscsi/open-iscsi-2.0.872-r2.ebuild
new file mode 100644
index 000000000000..d8d12d7c10ee
--- /dev/null
+++ b/sys-block/open-iscsi/open-iscsi-2.0.872-r2.ebuild
@@ -0,0 +1,105 @@
+# Copyright 1999-2013 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.872-r2.ebuild,v 1.1 2013/03/07 10:23:44 ssuominen Exp $
+
+EAPI=2
+inherit versionator linux-info 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="~alpha ~amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE="debug slp"
+DEPEND="slp? ( net-libs/openslp )"
+RDEPEND="${DEPEND}
+ sys-apps/util-linux"
+
+S="${WORKDIR}/${MY_PV}"
+
+pkg_setup() {
+ linux-info_pkg_setup
+
+ if kernel_is -lt 2 6 16; then
+ die "Sorry, your kernel must be 2.6.16-rc5 or newer!"
+ fi
+
+ # Needs to be done, as iscsid currently only starts, when having the iSCSI
+ # support loaded as module. Kernel builtion options don't work. See this for
+ # more information:
+ # http://groups.google.com/group/open-iscsi/browse_thread/thread/cc10498655b40507/fd6a4ba0c8e91966
+ # If there's a new release, check whether this is still valid!
+ CONFIG_CHECK_MODULES="SCSI_ISCSI_ATTRS ISCSI_TCP"
+ if linux_config_exists; then
+ for module in ${CONFIG_CHECK_MODULES}; do
+ linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"
+ done
+ fi
+}
+
+src_prepare() {
+ export EPATCH_OPTS="-d${S}"
+ epatch "${FILESDIR}"/${PN}-2.0.872-makefile-cleanup.patch
+ epatch "${FILESDIR}"/${P}-glibc212.patch
+ epatch "${FILESDIR}"/${P}-dont-call-configure.patch
+ epatch "${FILESDIR}"/${P}-ldflags.patch
+ epatch "${FILESDIR}"/${P}-isns-slp.patch
+ epatch "${FILESDIR}"/${PN}-2.0.872-makefile-cleanup-pass2.patch
+}
+
+src_configure() {
+ cd utils/open-isns || die
+ econf $(use_with slp)
+}
+
+src_compile() {
+ use debug && append-flags -DDEBUG_TCP -DDEBUG_SCSI
+
+ einfo "Building userspace"
+ local SLP_LIBS
+ use slp && SLP_LIBS="-lslp"
+ cd "${S}" && \
+ KSRC="${KV_DIR}" CFLAGS="" \
+ emake \
+ OPTFLAGS="${CFLAGS}" SLP_LIBS="${SLP_LIBS}" \
+ AR="$(tc-getAR)" CC="$(tc-getCC)" \
+ user \
+ || die "emake failed"
+}
+
+src_install() {
+ einfo "Installing userspace"
+ dosbin usr/iscsid usr/iscsiadm usr/iscsistart || die
+
+ einfo "Installing utilities"
+ dosbin utils/iscsi-iname utils/iscsi_discovery || die
+
+ einfo "Installing docs"
+ doman doc/*[1-8] || die
+ dodoc README THANKS || die
+ docinto test || die
+ dodoc test/* || die
+
+ einfo "Installing configuration"
+ insinto /etc/iscsi
+ doins etc/iscsid.conf || die
+ newins "${FILESDIR}"/initiatorname.iscsi initiatorname.iscsi.example || die
+ insinto /etc/iscsi/ifaces
+ doins etc/iface.example || die
+
+ newconfd "${FILESDIR}"/${P}-conf.d iscsid || die
+ newinitd "${FILESDIR}"/${P}-init.d-r1 iscsid || die
+
+ keepdir /var/db/iscsi
+ fperms 700 /var/db/iscsi || die
+ fperms 600 /etc/iscsi/iscsid.conf || die
+}
+
+pkg_postinst() {
+ in='/etc/iscsi/initiatorname.iscsi'
+ if [ ! -f "${ROOT}${in}" -a -f "${ROOT}${in}.example" ]; then
+ cp -f "${ROOT}${in}.example" "${ROOT}${in}"
+ fi
+}