# SliTaz package receipt.

PACKAGE="coreutils-operations"
VERSION="8.12"
CATEGORY="system-tools"
SHORT_DESC="GNU utilities that perform basic operations."
MAINTAINER="rcx@zoominternet.net"
WEB_SITE="http://www.gnu.org/software/coreutils/"
DEPENDS="glibc-base acl"
WANTED="coreutils"

# Rules to gen a SliTaz package suitable for Tazpkg.
#
# This is a special package for installed system or developer. We only take
# a few things, as Busybox provides all the basic utilities, but not for compiling.
# But DO NOT erase a Busybox applet, remove it before with pre_install rules.
#
genpkg_rules()
{
	mkdir -p $fs/bin
	#cp -a $_pkg/usr/bin/cp $fs/bin
	cp -a $_pkg/usr/bin/dd $fs/bin
	cp -a $_pkg/usr/bin/mv $fs/bin
	cp -a $_pkg/usr/bin/ln $fs/bin
	#cp -a $_pkg/usr/bin/rm $fs/bin

	mkdir -p $fs/usr/bin
	cp -a $_pkg/usr/bin/install $fs/usr/bin
	cp -a $_pkg/usr/bin/shred $fs/usr/bin
}

# Pre and post install commands for Tazpkg.
# We must remove all Busybox symlink before installing.
#
pre_install()
{
	local root
	root=$1
	echo "Processing pre-install commands..."
	echo -n "Removing all Busybox replaced utils... "
	rm -f $root/bin/dd $root/bin/mv $root/bin/ln
	rm -f $root/usr/bin/install $root/usr/bin/shred
	# Dont remove cp/rm or the installation will fail because tazpkg use
	# cp and rm during the process.
	#
	#rm -f $root/bin/cp $root/bin/rm
	status
}

post_remove()
{
	# use busybox ln applet directly since /bin/ln
        # in this package is remove already
	/bin/busybox ln -s /bin/busybox $1/bin/cp
	/bin/busybox ln -s /bin/busybox $1/bin/dd
	/bin/busybox ln -s /bin/busybox $1/bin/mv
	/bin/busybox ln -s /bin/busybox $1/bin/ln
	/bin/busybox ln -s /bin/busybox $1/bin/rm
	/bin/busybox ln -s /bin/busybox $1/usr/bin/install
	/bin/busybox ln -s /bin/busybox $1/usr/bin/shred
}