diff options
Diffstat (limited to 'main/iscsitarget')
-rw-r--r-- | main/iscsitarget/APKBUILD | 40 | ||||
-rw-r--r-- | main/iscsitarget/ietd.confd | 30 | ||||
-rw-r--r-- | main/iscsitarget/ietd.initd | 106 | ||||
-rw-r--r-- | main/iscsitarget/iscsitarget-0.4.15-isns-set-scn-flag.patch | 20 | ||||
-rw-r--r-- | main/iscsitarget/iscsitarget-0.4.17-build.patch | 23 |
5 files changed, 219 insertions, 0 deletions
diff --git a/main/iscsitarget/APKBUILD b/main/iscsitarget/APKBUILD new file mode 100644 index 000000000..3bdf98ee0 --- /dev/null +++ b/main/iscsitarget/APKBUILD @@ -0,0 +1,40 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> + +pkgname=iscsitarget +pkgver=0.4.17 +pkgrel=2 +pkgdesc="Open Source iSCSI target with professional features - userspace utils" +url="http://iscsitarget.sourceforge.net/" +license="GPL-2" +depends= +makedepends="openssl-dev" +subpackages="$pkgname-doc" +source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz + $pkgname-0.4.15-isns-set-scn-flag.patch + $pkgname-0.4.17-build.patch + ietd.initd + ietd.confd + " + +build() { + cd "$srcdir"/$pkgname-$pkgver + for i in ../*.patch; do + msg "Applying $i" + patch -p1 < $i || return 1 + done + + make usr || return 1 + make DISTDIR="$pkgdir" install-usr install-doc + + for i in etc/ietd.conf etc/initiators.*; do + install -Dm640 $i "$pkgdir"/$i || return 1 + done + install -Dm755 ../ietd.initd "$pkgdir"/etc/init.d/ietd + install -Dm755 ../ietd.confd "$pkgdir"/etc/conf.d/ietd +} + +md5sums="e79b437695fc50e7d054631855a16b1b iscsitarget-0.4.17.tar.gz +22512c5cf4cb62127730ce53d74ff28f iscsitarget-0.4.15-isns-set-scn-flag.patch +c9a9b839b3afcdecd1601511ee48a171 iscsitarget-0.4.17-build.patch +641513492f58a6cb13247d0028a50906 ietd.initd +06ba479d3533d557b8582abe6f182410 ietd.confd" diff --git a/main/iscsitarget/ietd.confd b/main/iscsitarget/ietd.confd new file mode 100644 index 000000000..3621326b1 --- /dev/null +++ b/main/iscsitarget/ietd.confd @@ -0,0 +1,30 @@ +# Copyright 1999-2006 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# $Header: /var/cvsroot/gentoo-x86/sys-block/iscsitarget/files/ietd-conf.d,v 1.1 2006/02/20 08:33:40 robbat2 Exp $ + +# Address and port to listen on for connections. +#ADDRESS="" # set this to non-empty to listen somewhere specific +PORT=3260 + +# Address of your SNS server +# if available +#ISNS="" + +# User and group to run as +# You must ensure that the UID/GID have access to the files/devices you +# have provided in your configuration. +USER="root" +GROUP="root" + +# Debug level - see ietd(8) for the levels +#DEBUGLEVEL= + +# This setting disables the memory configuration warnings. +# Upstream takes the general policy of forcing all of the memory settings that +# they want, but that doesn't mesh with users that have it set higher. +# Gentoo by default ignores the settings that are higher, but issues warnings +# on those that are lower. +# Uncomment the next line to disable those warnings. +#DISABLE_MEMORY_WARNINGS=1 + +# vim: filetype=gentoo-conf-d tw=72: diff --git a/main/iscsitarget/ietd.initd b/main/iscsitarget/ietd.initd new file mode 100644 index 000000000..6ea9a4b51 --- /dev/null +++ b/main/iscsitarget/ietd.initd @@ -0,0 +1,106 @@ +#!/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/iscsitarget/files/ietd-init.d-2,v 1.1 2008/07/18 16:03:38 flameeyes Exp $ + +MEM_SIZE=1048576 +DAEMON=/usr/sbin/ietd +CONFIG_FILE=/etc/ietd.conf +PID_FILE=/var/run/iscsi_trgt.pid +NAME="iSCSI Enterprise Target" + +ARGS="" +[ -n "$USER" ] && ARGS="${ARGS} --uid=${USER}" +[ -n "$GROUP" ] && ARGS="${ARGS} --gid=${GROUP}" +[ -n "$ISNS" ] && ARGS="${ARGS} --isns=${ISNS}" +[ -n "$PORT" ] && ARGS="${ARGS} --port=${PORT}" +[ -n "$ADDRESS" ] && ARGS="${ARGS} --address=${ADDRESS}" +[ -n "$DEBUGLEVEL" ] && ARGS="${ARGS} --debug=${DEBUGLEVEL}" + +depend() { + use net + after modules +} +checkconfig() { + if [ ! -f $CONFIG_FILE ]; then + eerror "Config file $CONFIG_FILE does not exist!" + return 1 + fi + if [ -z "$DISABLE_MEMORY_WARNINGS" ]; then + check_memsize + fi +} + +check_memsize() { + local wr md sysctl_key v k + for wr in r w; do + for md in max default; do + sysctl_key="net.core.${wr}mem_${md}" + v="$(sysctl -n ${sysctl_key})" + if [ "${v}" -lt "${MEM_SIZE}" ]; then + ewarn "$sysctl_key ($v) is lower than recommended ${MEM_SIZE}" + fi + done + done + for wr in "" r w; do + sysctl_key="net.ipv4.tcp_${wr}mem" + set -- $(sysctl -n ${sysctl_key}) + for k in min default max ; do + if [ "${1}" -lt "${MEM_SIZE}" ]; then + ewarn "$sysctl_key:$k (${1}) is lower than recommended ${MEM_SIZE}" + fi + shift + done + done +} + +do_modules() { + msg="$1" + shift + modules="$1" + shift + opts="$@" + for m in ${modules}; do + ebegin "${msg} - ${m}" + modprobe ${opts} $m + ret=$? + eend $ret + [ $ret -ne 0 ] && return $ret + done + return 0 +} + +start() { + checkconfig || return 1 + do_modules 'Loading iSCSI-Target modules' 'iscsi_trgt' + ebegin "Starting ${NAME}" + start-stop-daemon --start --exec $DAEMON --quiet -- ${ARGS} + eend $? +} + +stop() { + ebegin "Removing ${NAME} devices" + # ugly, but ietadm does not allways provides correct exit values + RETURN="$(ietadm --op delete 2>&1)" + RETVAL=$? + if [ $RETVAL -eq 0 ] && [ "$RETURN" != "something wrong" ] ; then + eend 0 + else + eend 1 + eerror "ietadm failed - $RETURN" + return 1 + fi + + ebegin "Stopping ${NAME}" + start-stop-daemon --stop --quiet --exec $DAEMON --pidfile $PID_FILE + ret=$? + eend $ret + [ $ret -ne 0 ] && return 1 + + # ugly, but pid file is not removed by ietd + rm -f $PID_FILE + do_modules 'Removing iSCSI-Target modules' 'iscsi_trgt' '-r' + return $? +} + +# vim: tw=72: diff --git a/main/iscsitarget/iscsitarget-0.4.15-isns-set-scn-flag.patch b/main/iscsitarget/iscsitarget-0.4.15-isns-set-scn-flag.patch new file mode 100644 index 000000000..4db90793d --- /dev/null +++ b/main/iscsitarget/iscsitarget-0.4.15-isns-set-scn-flag.patch @@ -0,0 +1,20 @@ +http://bugs.gentoo.org/180619 + +--- a/usr/isns.c ++++ b/usr/isns.c +@@ -215,13 +215,13 @@ + + #if __BYTE_ORDER == __LITTLE_ENDIAN + #define set_scn_flag(x) \ +-{ \ ++({ \ + x = (x & 0x55555555) << 1 | (x & 0xaaaaaaaa) >> 1; \ + x = (x & 0x33333333) << 2 | (x & 0xcccccccc) >> 2; \ + x = (x & 0x0f0f0f0f) << 4 | (x & 0xf0f0f0f0) >> 4; \ + x = (x & 0x00ff00ff) << 8 | (x & 0xff00ff00) >> 8; \ + x = (x & 0x0000ffff) << 16 | (x & 0xffff0000) >> 16; \ +-} ++}) + #else + #define set_scn_flag(x) (x) + #endif diff --git a/main/iscsitarget/iscsitarget-0.4.17-build.patch b/main/iscsitarget/iscsitarget-0.4.17-build.patch new file mode 100644 index 000000000..ee676a960 --- /dev/null +++ b/main/iscsitarget/iscsitarget-0.4.17-build.patch @@ -0,0 +1,23 @@ +--- a/usr/Makefile ++++ b/usr/Makefile +@@ -1,16 +1,15 @@ +-CFLAGS += -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include ++CFLAGS ?= -O2 -fno-inline -g + CFLAGS += -D_GNU_SOURCE # required for glibc >= 2.8 ++WARNFLAGS = -Wall -Wstrict-prototypes ++CFLAGS += $(WARNFLAGS) -I../include + PROGRAMS = ietd ietadm +-LIBS = -lcrypto ++LDLIBS = -lcrypto + + all: $(PROGRAMS) + + ietd: ietd.o iscsid.o conn.o session.o target.o message.o ctldev.o log.o chap.o event.o param.o plain.o isns.o + +- $(CC) $^ -o $@ $(LIBS) +- + ietadm: ietadm.o param.o +- $(CC) $^ -o $@ + + clean: + rm -f *.o $(PROGRAMS) |