# SliTaz package receipt.

PACKED_SIZE="184.0K"
UNPACKED_SIZE="568.0K"
PACKAGE="ntfs-3g"
VERSION="2017.3.23"
CATEGORY="system-tools"
SHORT_DESC="Read/write NTFS driver for FUSE"
MAINTAINER="pankso@slitaz.org"
LICENSE="GPL2"
SOURCE="ntfs-3g_ntfsprogs"
TARBALL="$SOURCE-$VERSION.tgz"
WEB_SITE="https://www.tuxera.com/community/open-source-ntfs-3g/"
WGET_URL="https://tuxera.com/opensource/$TARBALL"
CONFIG_FILES="/etc/filesystems"
TAGS="windows"

DEPENDS="fuse attr"
BUILD_DEPENDS="fuse-dev attr-dev util-linux-uuid-dev libtool"

# Rules to configure and make the package.
compile_rules()
{
	mkdir -p $DESTDIR/lib
	./configure --prefix=/usr \
	--disable-static \
	--with-fuse=internal \
	--mandir=/usr/share/man $CONFIGURE_ARGS &&
	make &&
	make DESTDIR=$DESTDIR install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/etc
	cp -a $install/. $fs/.
	rm -rf $fs/usr/bin/ntfs[a-z]* $fs/sbin/mkfs.ntfs $fs/usr/s*
	rm -rf $fs/usr/share $fs/usr/lib/pkgconfig $fs/usr/lib/*.a $fs/usr/include
	touch $fs/etc/filesystems
	#this link allow udisks2 to use ntfs-3g
	cd $fs/sbin
	ln -s mount.ntfs-3g mount.ntfs
}

# 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"
}
