From 559de61b4b92c534a13b71f0dd50631e4f8f47c7 Mon Sep 17 00:00:00 2001 From: Carlo Landmeter Date: Wed, 22 Dec 2010 10:18:05 +0000 Subject: testing/iscsi-scst: fixed init script and added default config --- testing/iscsi-scst/APKBUILD | 14 +++++--- testing/iscsi-scst/iscsi-scst.confd | 1 + testing/iscsi-scst/iscsi-scst.initd | 65 +++++++++++++++++++++++++++++++------ testing/iscsi-scst/scst.conf | 7 ++++ 4 files changed, 73 insertions(+), 14 deletions(-) create mode 100644 testing/iscsi-scst/iscsi-scst.confd create mode 100644 testing/iscsi-scst/scst.conf diff --git a/testing/iscsi-scst/APKBUILD b/testing/iscsi-scst/APKBUILD index f6f6c85b1..0d562dc66 100644 --- a/testing/iscsi-scst/APKBUILD +++ b/testing/iscsi-scst/APKBUILD @@ -3,7 +3,7 @@ pkgname=iscsi-scst pkgver=2.0.0 -pkgrel=0 +pkgrel=1 pkgdesc="ISCSI target for SCST - userspace tools" url="http://iscsi-scst.sourceforge.net/" arch="x86_64" @@ -15,7 +15,9 @@ subpackages= _svn="3161" source="http://alpine.nethq.org/distfiles/$pkgname-$pkgver-svn-$_svn.tar.gz http://alpine.nethq.org/distfiles/scst-$pkgver-svn-$_svn.tar.gz - iscsi-scst.initd + $pkgname.initd + $pkgname.confd + scst.conf " _builddir="$srcdir"/$pkgname @@ -33,10 +35,14 @@ package() { cd "$_builddir" # make install is broken install -D usr/iscsi-scstd "$pkgdir"/usr/sbin/iscsi-scstd - install -D usr/iscsi-scst-adm "$pkgdir"/iscsi-scst-adm + install -D usr/iscsi-scst-adm "$pkgdir"/usr/sbin/iscsi-scst-adm install -D -m 755 "$srcdir"/iscsi-scst.initd "$pkgdir"/etc/init.d/iscsi-scst + install -D -m 644 "$srcdir"/iscsi-scst.confd "$pkgdir"/etc/conf.d/iscsi-scst + install -D -m 644 "$srcdir"/scst.conf "$pkgdir"/etc/scst.conf } md5sums="0980e7f0cc57d3a09cc57ba4b127ef12 iscsi-scst-2.0.0-svn-3161.tar.gz 73c1ec37231918e5183e78f1ec8f2302 scst-2.0.0-svn-3161.tar.gz -05efba84051393bf22ff1f2c718afbe9 iscsi-scst.initd" +ce6abcb6365f4b8609c3e963d5243b22 iscsi-scst.initd +6d8b6e27d47748f7805fdb318b62bb3b iscsi-scst.confd +e8eda9872b3da3a55605c7fa17cb6c68 scst.conf" diff --git a/testing/iscsi-scst/iscsi-scst.confd b/testing/iscsi-scst/iscsi-scst.confd new file mode 100644 index 000000000..1a13034dd --- /dev/null +++ b/testing/iscsi-scst/iscsi-scst.confd @@ -0,0 +1 @@ +MEM_SIZE="" diff --git a/testing/iscsi-scst/iscsi-scst.initd b/testing/iscsi-scst/iscsi-scst.initd index 3563bafa7..b63a3e57d 100644 --- a/testing/iscsi-scst/iscsi-scst.initd +++ b/testing/iscsi-scst/iscsi-scst.initd @@ -4,20 +4,65 @@ # depend() { - need net - after firewall + need net + after firewall +} + +configure_memsize() { + if [ ! -z "$MEM_SIZE" ]; then + if [ -e /proc/sys/net/core/wmem_max ]; then + echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max + fi + + if [ -e /proc/sys/net/core/rmem_max ]; then + echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max + fi + + if [ -e /proc/sys/net/core/wmem_default ]; then + echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default + fi + + if [ -e /proc/sys/net/core/rmem_default ]; then + echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default + fi + + if [ -e /proc/sys/net/ipv4/tcp_mem ]; then + echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem + fi + + if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then + echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem + fi + + if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then + echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem + fi + fi +} + +check_dev_handlers() { + if lsmod | grep "scst_" >/dev/null; then + ewarn "Device handlers found" + else + ewarn "No SCST device handlers loaded!" + ewarn "You can add them in /etc/modules" + fi } start() { - modprobe -q crc32c - modprobe -q iscsi-scst - ebegin "Starting iscsi-scstd" - start-stop-daemon --start --exec /usr/sbin/iscsi-scstd - eend 0 + ebegin "Starting iscsi" + check_dev_handlers + modprobe -q crc32c + modprobe -q iscsi-scst + start-stop-daemon --start --exec /usr/sbin/iscsi-scstd + /usr/sbin/scstadmin -config /etc/scst.conf + eend 0 } stop() { - ebegin "Stopping iscsi-scstd" - start-stop-daemon --stop --exec /usr/sbin/iscsi-scstd - eend 0 + ebegin "Stopping iscsi" + start-stop-daemon --stop --exec /usr/sbin/iscsi-scstd + rmmod -w iscsi-scst + eend 0 } + diff --git a/testing/iscsi-scst/scst.conf b/testing/iscsi-scst/scst.conf new file mode 100644 index 000000000..341a0db9a --- /dev/null +++ b/testing/iscsi-scst/scst.conf @@ -0,0 +1,7 @@ +TARGET_DRIVER iscsi { + enabled 1 + + TARGET iqn.2010-12.net.alpinelinux:tgt { + } +} + -- cgit v1.2.3