# SliTaz package receipt.

PACKAGE="open-iscsi"
VERSION="2.0-871"
CATEGORY="network"
SHORT_DESC="Implementation of RFC3720 userland utilities."
MAINTAINER="pascal.bellard@slitaz.org"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WEB_SITE="http://www.open-iscsi.org/"
WGET_URL="${WEB_SITE}bits/$TARBALL"
DEPENDS="linux-scsi"

# Rules to configure and make the package.
compile_rules()
{
	cd $src
	sed -i 's/ install_kernel / /' Makefile
	sed -i 's|dirent.h>|&\n#include <sys/types.h>\n#include <sys/stat.h>|' \
		usr/iscsi_sysfs.c
	make user
	make DESTDIR=$PWD/_pkg install

}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	cp -a $_pkg/etc $fs
	cp -a $_pkg/sbin $fs
}

post_install()
{
	echo "Processing post-install commands..."
	if  [ ! -f $1/etc/iscsi/initiatorname.iscsi ]; then
			echo "InitiatorName=$($1/sbin/iscsi-iname)" > $1/etc/iscsi/initiatorname.iscsi
	fi
}