# SliTaz package receipt.

PACKAGE="tazpanel"
VERSION="1.5.7"
CATEGORY="system-tools"
SHORT_DESC="SliTaz administration and configuration panel."
MAINTAINER="pankso@slitaz.org"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WEB_SITE="http://www.slitaz.org/"
WGET_URL="http://hg.slitaz.org/tazpanel/archive/$VERSION.tar.gz"
CONFIG_FILES="/etc/slitaz/tazpanel.conf /etc/slitaz/httpd.conf"

DEPENDS="busybox"
BUILD_DEPENDS=""

# Rules to configure and make the package.
compile_rules()
{
	cd $src # && make && 
		# installer.cgi user validation fix
		patch -p0 < $stuff/installer.patch || return 1
		make &&
	make DESTDIR=$DESTDIR install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/etc/init.d
	cp -a $install/* $fs
	# Init script use tazpanel cmdline
	cd $fs/etc/init.d && ln -s ../../usr/bin/tazpanel .
}

# Pre and post install commands for Tazpkg.
post_install()
{
	grep -qs tazpanel $1/etc/hosts ||
		sed -i 's/^127.0.0.1.*/& tazpanel/' $1/etc/hosts
}