# SliTaz package receipt.

PACKED_SIZE="140.0K"
UNPACKED_SIZE="768.0K"
PACKAGE="tazpanel"
VERSION="638"
CATEGORY="system-tools"
SHORT_DESC="SliTaz administration and configuration panel."
MAINTAINER="pankso@slitaz.org"
LICENSE="BSD"
WEB_SITE="http://www.slitaz.org/"

TARBALL="$PACKAGE-$VERSION.tar.gz"
WGET_URL="http://hg.slitaz.org/tazpanel/archive/$VERSION.tar.gz"
CONFIG_FILES="/etc/slitaz/tazpanel.conf /etc/slitaz/httpd.conf"

SUGGESTED="tazinst-gui tazinst"
DEPENDS="busybox gettext-base libjpeg sundown"
BUILD_DEPENDS="gettext jsmin tidy-html5"
SIBLINGS="tazpanel-extra"
HOST_ARCH="i486 arm"

current_version()
{
	wget -O - http://hg.slitaz.org/$PACKAGE/ 2>/dev/null | \
	sed '/^Changeset/!d;s|.*">|http://hg.slitaz.org/'$PACKAGE'/rev/|;s|<.*||' | \
	xargs wget -O - 2>/dev/null | sed '/rev /!d;s|.*rev ||;s| .*||'
}

# Rules to configure and make the package.
compile_rules()
{
	make -j 1 &&
	make DESTDIR=$DESTDIR VERSION=$VERSION 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()
{
	rm -f "$1"/var/cache/tazpanel/* 2> /dev/null
	grep -qs tazpanel "$1"/etc/hosts ||
		sed -i 's/^127.0.0.1.*/& tazpanel/' "$1"/etc/hosts

	# Do we need TazPanel restart? It freezes when updating using web interface.
	#[ -z "$1" ] && tazpanel restart
}
