Added new open-iscsi version (kernel -2.6.34)

git-svn-id: svn+ssh://svnintern.kmrc.de/projects/gentoo/iwm-overlay@14278 cbe59ace-07ea-0310-918e-868702b5370d
This commit is contained in:
Torsten Kurbad 2010-08-18 22:30:54 +00:00
parent 9a2d9dff0a
commit 3fa41419f2
5 changed files with 375 additions and 0 deletions

View File

@ -0,0 +1,13 @@
# /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"

View File

@ -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
}

View File

@ -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

View File

@ -0,0 +1,110 @@
# 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.ebuild,v 1.2 2009/10/28 16:49:50 dertobi123 Exp $
inherit versionator linux-mod 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="utils debug"
DEPEND="virtual/linux-sources"
RDEPEND="${DEPEND}
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"
CONFIG_CHECK_MODULES="SCSI_ISCSI_ATTRS ISCSI_TCP"
ERROR_CFG="open-iscsi needs CRC32C support in your kernel."
pkg_setup() {
linux-info_pkg_setup
linux-mod_pkg_setup
# 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!
for module in ${CONFIG_CHECK_MODULES}; do
linux_chkconfig_module ${module} || die "${module} needs to be built as module (builtin doesn't work)"
done
}
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
epatch "${FILESDIR}"/CVE-2009-1297.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
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
insinto /etc/iscsi/ifaces
doins etc/iface.example
# only contains iscsi initiatorname, no need to update
if [ ! -e /etc/iscsi/initiatorname.iscsi ]; then
doins "${FILESDIR}"/initiatorname.iscsi
fi
# if there is a special conf.d for this version, use it
# otherwise, use the default: iscsid-conf.d
insinto /etc/conf.d
if [ -e "${FILESDIR}"/iscsid-${PV}.conf.d ]; then
newins "${FILESDIR}"/iscsid-${PV}.conf.d iscsid
else
newins "${FILESDIR}"/iscsid-conf.d iscsid
fi
# same for init.d
if [ -e "${FILESDIR}"/iscsid-${PV}.init.d ]; then
newinitd "${FILESDIR}"/iscsid-${PV}.init.d iscsid
else
newinitd "${FILESDIR}"/iscsid-init.d iscsid
fi
keepdir /var/db/iscsi
fperms 700 /var/db/iscsi
fperms 600 /etc/iscsi/iscsid.conf
}
pkg_postinst() {
linux-mod_pkg_postinst
}

View File

@ -0,0 +1,92 @@
# Copyright 1999-2010 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.2 2010/03/31 23:19:39 robbat2 Exp $
EAPI=2
inherit versionator linux-info eutils flag-o-matic git
DESCRIPTION="Open-iSCSI is a high performance, transport independent, multi-platform implementation of RFC3720"
HOMEPAGE="http://www.open-iscsi.org/"
#SRC_URI="mirror://kernel/linux/kernel/people/mnc/open-iscsi/releases/${P}.tar.gz"
SRC_URI=""
EGIT_REPO_URI="git://git.kernel.org/pub/scm/linux/kernel/git/mnc/open-iscsi.git"
EGIT_COMMIT="fef28e39efcacad2dcbad4b94f95fe5dbfbcf068"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~arm ~mips ~ppc ~x86"
IUSE="debug"
DEPEND=""
RDEPEND="${DEPEND}
sys-apps/util-linux"
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}"/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-2.0.871-r1.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
}