summaryrefslogtreecommitdiffstats
path: root/main/iscsi-scst
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@gmail.com>2011-07-26 14:54:03 +0000
committerCarlo Landmeter <clandmeter@gmail.com>2011-07-26 14:54:03 +0000
commita25ab113f02d4a78796fcd434d7d1a7f700a835d (patch)
tree7f4f850ff7697b5aa62e2b63a64186105abf7c1e /main/iscsi-scst
parentaddfbe32d5fd892efad607710562ef66f174405d (diff)
downloadaports-a25ab113f02d4a78796fcd434d7d1a7f700a835d.tar.bz2
aports-a25ab113f02d4a78796fcd434d7d1a7f700a835d.tar.xz
testing/iscsi-scst: move to main
Diffstat (limited to 'main/iscsi-scst')
-rw-r--r--main/iscsi-scst/APKBUILD47
-rw-r--r--main/iscsi-scst/iscsi-scst.confd1
-rw-r--r--main/iscsi-scst/iscsi-scst.initd68
-rw-r--r--main/iscsi-scst/scst.conf7
4 files changed, 123 insertions, 0 deletions
diff --git a/main/iscsi-scst/APKBUILD b/main/iscsi-scst/APKBUILD
new file mode 100644
index 000000000..8a2fd4664
--- /dev/null
+++ b/main/iscsi-scst/APKBUILD
@@ -0,0 +1,47 @@
+# Contributor: Carlo Landmeter
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+
+pkgname=iscsi-scst
+pkgver=2.0.0
+pkgrel=2
+pkgdesc="ISCSI target for SCST - userspace tools"
+url="http://iscsi-scst.sourceforge.net/"
+arch="x86_64"
+license="GPL-2"
+depends=
+install=
+makedepends="openssl-dev bash"
+subpackages=
+source="http://downloads.sourceforge.net/scst/$pkgname-$pkgver.tar.gz
+ http://downloads.sourceforge.net/scst/scst-$pkgver.tar.gz
+ $pkgname.initd
+ $pkgname.confd
+ scst.conf
+ "
+
+_builddir="$srcdir/$pkgname-$pkgver"
+prepare() {
+ cd "$_builddir"
+ cp Makefile_user_space_only Makefile
+}
+
+build() {
+ cd "$_builddir"
+ make all SCST_INC_DIR="$srcdir/scst-$pkgver/include" || return 1
+}
+
+package() {
+ cd "$_builddir"
+ # make install is broken
+ install -D usr/iscsi-scstd "$pkgdir"/usr/sbin/iscsi-scstd
+ 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="04e623184f9061bea06b9ba10631a620 iscsi-scst-2.0.0.tar.gz
+e7262a26d38d8311d0296b36718d593b scst-2.0.0.tar.gz
+6440aac6ffdf18c90ae9824f04f8c638 iscsi-scst.initd
+6d8b6e27d47748f7805fdb318b62bb3b iscsi-scst.confd
+e8eda9872b3da3a55605c7fa17cb6c68 scst.conf"
diff --git a/main/iscsi-scst/iscsi-scst.confd b/main/iscsi-scst/iscsi-scst.confd
new file mode 100644
index 000000000..1a13034dd
--- /dev/null
+++ b/main/iscsi-scst/iscsi-scst.confd
@@ -0,0 +1 @@
+MEM_SIZE=""
diff --git a/main/iscsi-scst/iscsi-scst.initd b/main/iscsi-scst/iscsi-scst.initd
new file mode 100644
index 000000000..b63a3e57d
--- /dev/null
+++ b/main/iscsi-scst/iscsi-scst.initd
@@ -0,0 +1,68 @@
+#!/sbin/runscript
+#
+# Start the iSCSI-SCST Target.
+#
+
+depend() {
+ 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() {
+ 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"
+ start-stop-daemon --stop --exec /usr/sbin/iscsi-scstd
+ rmmod -w iscsi-scst
+ eend 0
+}
+
diff --git a/main/iscsi-scst/scst.conf b/main/iscsi-scst/scst.conf
new file mode 100644
index 000000000..341a0db9a
--- /dev/null
+++ b/main/iscsi-scst/scst.conf
@@ -0,0 +1,7 @@
+TARGET_DRIVER iscsi {
+ enabled 1
+
+ TARGET iqn.2010-12.net.alpinelinux:tgt {
+ }
+}
+