summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2009-11-12 09:29:49 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2009-11-12 09:29:49 +0000
commit18a76994c5d6c9d6431c3366485f2f6730556a63 (patch)
treeb51748b4ebdcb3b86eec60eb64611ac9ce47912d /sys-block
parentVersion bump (diff)
downloadgentoo-2-18a76994c5d6c9d6431c3366485f2f6730556a63.tar.gz
gentoo-2-18a76994c5d6c9d6431c3366485f2f6730556a63.tar.bz2
gentoo-2-18a76994c5d6c9d6431c3366485f2f6730556a63.zip
Cleanup remaining modules code so that kernel sources are no longer required. Do not decide what to include in the binpkg based on $ROOT, as it may be for use on a different machine. Always install the utils. Bug #273321: Do not build iscsistart statically. Bug #284871: Fix init.d return codes. Bug #291584: install initiatorname.iscsi in the correct place.
(Portage version: 2.2_rc49/cvs/Linux x86_64)
Diffstat (limited to 'sys-block')
-rw-r--r--sys-block/open-iscsi/ChangeLog15
-rw-r--r--sys-block/open-iscsi/files/iscsid-2.0.871-r1.init.d127
-rw-r--r--sys-block/open-iscsi/files/open-iscsi-2.0.871-makefile-cleanup.patch33
-rw-r--r--sys-block/open-iscsi/open-iscsi-2.0.871-r1.ebuild89
4 files changed, 263 insertions, 1 deletions
diff --git a/sys-block/open-iscsi/ChangeLog b/sys-block/open-iscsi/ChangeLog
index 1a4a9c61bf54..21b58fd2ba2e 100644
--- a/sys-block/open-iscsi/ChangeLog
+++ b/sys-block/open-iscsi/ChangeLog
@@ -1,6 +1,19 @@
# ChangeLog for sys-block/open-iscsi
# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/ChangeLog,v 1.23 2009/10/28 16:47:54 dertobi123 Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/ChangeLog,v 1.24 2009/11/12 09:29:49 robbat2 Exp $
+
+*open-iscsi-2.0.871-r1 (12 Nov 2009)
+
+ 12 Nov 2009; Robin H. Johnson <robbat2@gentoo.org>
+ +open-iscsi-2.0.871-r1.ebuild,
+ +files/open-iscsi-2.0.871-makefile-cleanup.patch,
+ +files/iscsid-2.0.871-r1.init.d:
+ Cleanup remaining modules code so that kernel sources are no longer
+ required. Do not decide what to include in the binpkg based on $ROOT, as
+ it may be for use on a different machine. Always install the utils. Bug
+ #273321: Do not build iscsistart statically. Bug #284871: Fix init.d
+ return codes. Bug #291584: install initiatorname.iscsi in the correct
+ place.
*open-iscsi-2.0.871 (28 Oct 2009)
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
new file mode 100644
index 000000000000..179c131923eb
--- /dev/null
+++ b/sys-block/open-iscsi/files/iscsid-2.0.871-r1.init.d
@@ -0,0 +1,127 @@
+#!/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.871-r1.init.d,v 1.1 2009/11/12 09:29:48 robbat2 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} ] || [ ! "$(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 /usr/sbin/iscsid -- ${OPTS}
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ eend $?
+ return $?
+ fi
+
+ # Start automatic targets when iscsid is started
+ if [ "${AUTOSTARTTARGETS}" = "yes" ]; then
+ starttargets
+ return $?
+ fi
+ 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
+ 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.871-makefile-cleanup.patch b/sys-block/open-iscsi/files/open-iscsi-2.0.871-makefile-cleanup.patch
new file mode 100644
index 000000000000..6ca2a4eabab1
--- /dev/null
+++ b/sys-block/open-iscsi/files/open-iscsi-2.0.871-makefile-cleanup.patch
@@ -0,0 +1,33 @@
+diff -Nuar open-iscsi-2.0-871.orig/usr/Makefile open-iscsi-2.0-871/usr/Makefile
+--- open-iscsi-2.0-871.orig/usr/Makefile 2009-07-10 20:55:58.000000000 -0700
++++ open-iscsi-2.0-871/usr/Makefile 2009-11-12 00:58:16.467960344 -0800
+@@ -48,14 +48,14 @@
+ all: $(PROGRAMS)
+
+ iscsid: $(COMMON_SRCS) $(IPC_OBJ) $(INITIATOR_SRCS) iscsid.o
+- $(CC) $(CFLAGS) $^ -o $@
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
+
+ iscsiadm: $(COMMON_SRCS) $(FW_BOOT_SRCS) strings.o discovery.o iscsiadm.o
+- $(CC) $(CFLAGS) $^ -o $@
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
+
+ iscsistart: $(IPC_OBJ) $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \
+ iscsistart.o statics.o
+- $(CC) $(CFLAGS) -static $^ -o $@
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
+ clean:
+ rm -f *.o $(PROGRAMS) .depend $(LIBSYS)
+
+diff -Nuar open-iscsi-2.0-871.orig/utils/Makefile open-iscsi-2.0-871/utils/Makefile
+--- open-iscsi-2.0-871.orig/utils/Makefile 2009-07-10 20:55:58.000000000 -0700
++++ open-iscsi-2.0-871/utils/Makefile 2009-11-12 00:58:56.404623435 -0800
+@@ -6,7 +6,7 @@
+ all: $(PROGRAMS)
+
+ iscsi-iname: md5.o iscsi-iname.o
+- $(CC) $(CFLAGS) $^ $(DBM_LIB) -o $@
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(DBM_LIB) $^
+
+ clean:
+ rm -f *.o $(PROGRAMS) .depend
diff --git a/sys-block/open-iscsi/open-iscsi-2.0.871-r1.ebuild b/sys-block/open-iscsi/open-iscsi-2.0.871-r1.ebuild
new file mode 100644
index 000000000000..ebf24f0944d9
--- /dev/null
+++ b/sys-block/open-iscsi/open-iscsi-2.0.871-r1.ebuild
@@ -0,0 +1,89 @@
+# Copyright 1999-2009 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-r1.ebuild,v 1.1 2009/11/12 09:29:49 robbat2 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="http://www.open-iscsi.org/bits/${MY_PV}.tar.gz"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~amd64 ~ppc ~mips"
+IUSE="debug"
+DEPEND=""
+RDEPEND="${DEPEND}
+ 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!
+ 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}"/CVE-2009-1297.patch
+ epatch "${FILESDIR}"/${PN}-2.0.871-makefile-cleanup.patch
+}
+
+src_compile() {
+ use debug && append-flags -DDEBUG_TCP -DDEBUG_SCSI
+
+ einfo "Building userspace"
+ cd "${S}" && \
+ CFLAGS="" emake OPTFLAGS="${CFLAGS}" user \
+ || die "emake failed"
+}
+
+src_install() {
+ einfo "Installing userspace"
+ dosbin usr/iscsid usr/iscsiadm usr/iscsistart
+
+ einfo "Installing utilities"
+ dosbin utils/iscsi-iname utils/iscsi_discovery
+
+ einfo "Installing docs"
+ doman doc/*[1-8]
+ dodoc README THANKS
+ docinto test
+ dodoc test/*
+
+ einfo "Installing configuration"
+ insinto /etc/iscsi
+ doins etc/iscsid.conf
+ newins "${FILESDIR}"/initiatorname.iscsi initiatorname.iscsi.example
+ insinto /etc/iscsi/ifaces
+ doins etc/iface.example
+
+ newconfd "${FILESDIR}"/iscsid-conf.d iscsid
+ newinitd "${FILESDIR}"/iscsid-2.0.871-r1.init.d iscsid
+
+ keepdir /var/db/iscsi
+ fperms 700 /var/db/iscsi
+ fperms 600 /etc/iscsi/iscsid.conf
+}
+
+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
+}