public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sebastian Pipping" <sping@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/betagarden:master commit in: sys-block/open-iscsi/files/, sys-block/open-iscsi/
Date: Mon, 30 May 2011 23:45:18 +0000 (UTC)	[thread overview]
Message-ID: <3377d2c11b3d72ca8558e31dcbba2abb4ef51708.sping@gentoo> (raw)

commit:     3377d2c11b3d72ca8558e31dcbba2abb4ef51708
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Mon May 30 23:43:56 2011 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Mon May 30 23:43:56 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/betagarden.git;a=commit;h=3377d2c1

sys-block/open-iscsi: 2.0.87 (bug #340425)

---
 sys-block/open-iscsi/files/initiatorname.iscsi     |   31 +++++
 .../open-iscsi/files/open-iscsi-2.0.872-conf.d     |   18 +++
 .../open-iscsi-2.0.872-dont-call-configure.patch   |   11 ++
 .../files/open-iscsi-2.0.872-glibc212.patch        |   10 ++
 .../open-iscsi/files/open-iscsi-2.0.872-init.d     |  131 ++++++++++++++++++++
 .../files/open-iscsi-2.0.872-ldflags.patch         |   11 ++
 .../open-iscsi-2.0.872-makefile-cleanup.patch      |   20 +++
 sys-block/open-iscsi/open-iscsi-2.0.872.ebuild     |   98 +++++++++++++++
 8 files changed, 330 insertions(+), 0 deletions(-)

diff --git a/sys-block/open-iscsi/files/initiatorname.iscsi b/sys-block/open-iscsi/files/initiatorname.iscsi
new file mode 100644
index 0000000..b2a0e02
--- /dev/null
+++ b/sys-block/open-iscsi/files/initiatorname.iscsi
@@ -0,0 +1,31 @@
+# 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/initiatorname.iscsi,v 1.2 2006/03/08 09:19:25 robbat2 Exp $
+#
+# This file must contain a InitiatorName entry!
+# white space is significent here!
+#InitiatorName=iqn.2005-09.tld.domain.hostname:openiscsi-initiator
+#InitiatorAlias=foobar
+
+# Sample documentation follows:
+
+# The InitiatorName should take the following format
+# iqn.${YEAR}-${MONTH}-${DOMAIN_REVERSED}.${HOSTNAME}:${UNIQUE_STRING}
+# Where YEAR and MONTH are the dates that your domain was registered.
+# You can use WHOIS to find when your domain was registered.
+# If you don't have a real domain in the outside world, invent one, but use
+# .local for your top-level.
+
+# Example case #1:
+# This assumes you own foobar.co.uk.
+# Domain name: foobar.co.uk.
+# Registration date: March 2001
+# Hostname: linux
+# InitiatorName=iqn.2001-03.uk.co.foobar.linux:openiscsi-29b48ad602d5f83dd9cd9aa3ef741216
+
+# Example case #2:
+# This assumes you don't have a domain of your own.
+# Domain name: foobar.local
+# Registration date: March 2001
+# Hostname: linux
+# InitiatorName=iqn.2001-03.local.foobar.linux:openiscsi-29b48ad602d5f83dd9cd9aa3ef741216

diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.872-conf.d b/sys-block/open-iscsi/files/open-iscsi-2.0.872-conf.d
new file mode 100644
index 0000000..02e584f
--- /dev/null
+++ b/sys-block/open-iscsi/files/open-iscsi-2.0.872-conf.d
@@ -0,0 +1,18 @@
+# /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}"
+
+# Start automatic targets when iscsid is started
+AUTOSTARTTARGETS="yes"
+
+# if set to "strict", iscsid will stop, if connecting the
+# autostart targets failed
+# AUTOSTART="strict"
+

diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.872-dont-call-configure.patch b/sys-block/open-iscsi/files/open-iscsi-2.0.872-dont-call-configure.patch
new file mode 100644
index 0000000..185f1ac
--- /dev/null
+++ b/sys-block/open-iscsi/files/open-iscsi-2.0.872-dont-call-configure.patch
@@ -0,0 +1,11 @@
+--- open-iscsi-2.0-872.orig/Makefile
++++ open-iscsi-2.0-872/Makefile
+@@ -27,7 +27,7 @@ IFACEFILES = etc/iface.example
+ all: user kernel
+ 
+ user: ;
+-	cd utils/open-isns; ./configure; $(MAKE)
++	cd utils/open-isns; $(MAKE)
+ 	$(MAKE) -C utils/sysdeps
+ 	$(MAKE) -C utils/fwparam_ibft
+ 	$(MAKE) -C usr

diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.872-glibc212.patch b/sys-block/open-iscsi/files/open-iscsi-2.0.872-glibc212.patch
new file mode 100644
index 0000000..6171703
--- /dev/null
+++ b/sys-block/open-iscsi/files/open-iscsi-2.0.872-glibc212.patch
@@ -0,0 +1,10 @@
+--- usr/iscsid.c	2010-10-10 23:06:37.000000000 +0200
++++ usr/iscsid.c	2010-10-10 23:07:55.000000000 +0200
+@@ -31,6 +31,7 @@
+ #include <sys/utsname.h>
+ #include <sys/types.h>
+ #include <sys/wait.h>
++#include <sys/stat.h>
+ 
+ #include "iscsid.h"
+ #include "mgmt_ipc.h"

diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.872-init.d b/sys-block/open-iscsi/files/open-iscsi-2.0.872-init.d
new file mode 100644
index 0000000..844ecdf
--- /dev/null
+++ b/sys-block/open-iscsi/files/open-iscsi-2.0.872-init.d
@@ -0,0 +1,131 @@
+#!/sbin/runscript
+# Copyright 1999-2010 Gentoo Foundation, Inc.
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Header: $
+
+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 [ -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 ${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/files/open-iscsi-2.0.872-ldflags.patch b/sys-block/open-iscsi/files/open-iscsi-2.0.872-ldflags.patch
new file mode 100644
index 0000000..fc02cbc
--- /dev/null
+++ b/sys-block/open-iscsi/files/open-iscsi-2.0.872-ldflags.patch
@@ -0,0 +1,11 @@
+--- utils/Makefile	2011-05-31 01:30:27.302609540 +0200
++++ utils/Makefile	2011-05-31 01:32:50.229602790 +0200
+@@ -6,7 +6,7 @@
+ all: $(PROGRAMS)
+ 
+ iscsi-iname: md5.o iscsi-iname.o
+-	$(CC) $(CFLAGS) $^ $(DBM_LIB) -o $@
++	$(CC) $(CFLAGS) $(LDFLAGS) $^ $(DBM_LIB) -o $@
+ 
+ clean:
+ 	rm -f *.o $(PROGRAMS) .depend

diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.872-makefile-cleanup.patch b/sys-block/open-iscsi/files/open-iscsi-2.0.872-makefile-cleanup.patch
new file mode 100644
index 0000000..b3e93f4
--- /dev/null
+++ b/sys-block/open-iscsi/files/open-iscsi-2.0.872-makefile-cleanup.patch
@@ -0,0 +1,20 @@
+--- usr/Makefile	2010-10-10 22:48:04.000000000 +0200
++++ usr/Makefile.ori	2010-10-10 22:48:34.000000000 +0200
+@@ -53,14 +53,14 @@
+ 
+ iscsid: $(ISCSI_LIB_SRCS) $(IPC_OBJ) $(INITIATOR_SRCS) $(DISCOVERY_SRCS) \
+ 	iscsid.o session_mgmt.o discoveryd.o
+-	$(CC) $(CFLAGS) $^ -o $@ -L../utils/open-isns -lisns -lcrypto
++	$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -L../utils/open-isns -lisns -lcrypto
+ 
+ iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_SRCS) iscsiadm.o session_mgmt.o
+-	$(CC) $(CFLAGS) $^ -o $@ -L../utils/open-isns -lisns -lcrypto
++	$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -L../utils/open-isns -lisns -lcrypto
+ 
+ iscsistart: $(IPC_OBJ) $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \
+ 		iscsistart.o statics.o
+-	$(CC) $(CFLAGS) -static $^ -o $@
++	$(CC) $(CFLAGS) -static $(LDFLAGS) $^ -o $@
+ clean:
+ 	rm -f *.o $(PROGRAMS) .depend $(LIBSYS)
+ 

diff --git a/sys-block/open-iscsi/open-iscsi-2.0.872.ebuild b/sys-block/open-iscsi/open-iscsi-2.0.872.ebuild
new file mode 100644
index 0000000..eb3bed8
--- /dev/null
+++ b/sys-block/open-iscsi/open-iscsi-2.0.872.ebuild
@@ -0,0 +1,98 @@
+# Copyright 1999-2011 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.871.3.ebuild,v 1.3 2010/08/24 13:48:01 ssuominen Exp $
+
+EAPI=2
+inherit versionator linux-info eutils flag-o-matic
+
+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="mirror://kernel/linux/kernel/people/mnc/open-iscsi/releases/${MY_PV}.tar.gz"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~mips ~ppc ~x86"
+IUSE="debug slp"
+DEPEND=""
+RDEPEND="${DEPEND}
+	slp? ( net-libs/openslp )
+	sys-apps/util-linux"
+
+S="${WORKDIR}/${MY_PV}"
+
+pkg_setup() {
+	linux-info_pkg_setup
+
+	if [ $KV_PATCH -lt 15 ]; 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} || die "${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
+}
+
+src_configure() {
+	cd utils/open-isns || die
+	econf $(use_with slp)
+}
+
+src_compile() {
+	use debug && append-flags -DDEBUG_TCP -DDEBUG_SCSI
+
+	einfo "Building userspace"
+	cd "${S}" && \
+	KSRC="${KV_DIR}" CFLAGS="" emake OPTFLAGS="${CFLAGS}" 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 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
+}



             reply	other threads:[~2011-05-30 23:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-30 23:45 Sebastian Pipping [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-06-16 17:02 [gentoo-commits] proj/betagarden:master commit in: sys-block/open-iscsi/files/, sys-block/open-iscsi/ Sebastian Pipping

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3377d2c11b3d72ca8558e31dcbba2abb4ef51708.sping@gentoo \
    --to=sping@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox