# SliTaz package receipt.

PACKAGE="ntfs-3g"
VERSION="2011.1.15"
CATEGORY="system-tools"
SHORT_DESC="The free ntfs driver."
MAINTAINER="pankso@slitaz.org"
DEPENDS="fuse attr"
BUILD_DEPENDS="attr-dev"
TARBALL="$PACKAGE-$VERSION.tgz"
WEB_SITE="http://www.tuxera.com/opensource/" 
WGET_URL="$WEB_SITE/$TARBALL"
CONFIG_FILES="/etc/filesystems"
TAGS="windows"

# Rules to configure and make the package.
compile_rules()
{
	cd $src
	sed -i 's/\terr = ntfs_open\(.*\);/\tntfs_log_clear_levels((u32) -1); if (err = ntfs_open\1) goto err2;/' \
		src/ntfs-3g.c
	./configure --prefix=/usr \
	--mandir=/usr/share/man $CONFIGURE_ARGS &&
	make &&
	make DESTDIR=$PWD/_pkg install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/lib $fs/usr/lib $fs/etc \
			 $fs/usr/share/hal/fdi/policy/10osvendor
	cp -a $_pkg/bin $fs/
	cp -a $_pkg/sbin $fs/
	cp -a $_pkg/lib/*.so* $fs/lib
	cp -a $_pkg/usr/lib/*.so* $fs/usr/lib
	cp -a $_pkg/usr/bin $fs/usr
	touch $fs/etc/filesystems
}

# Pre remove and post install commands for Tazpkg.
pre_remove()
{
	sed -i '/^$PACKAGE$/d' $1/etc/filesystems
}

post_install()
{
	grep -qs ^$PACKAGE$ $1/etc/filesystems || \
		echo "$PACKAGE" >> $1/etc/filesystems
}