# SliTaz package receipt.

PACKAGE="swat"
VERSION="3.5.8"
CATEGORY="development"
SHORT_DESC="Samba Web Administration Tool."
MAINTAINER="pascal.bellard@slitaz.org"
WEB_SITE="http://samba.org/"
DEPENDS="samba"
WANTED="samba"

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/share/samba $fs/usr/share/applications
	cp -a $_pkg/usr/share/samba/swat $fs/usr/share/samba
}

post_install()
{
	if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
		if ! grep -q /usr/share/samba/swat/ $1/etc/lighttpd/lighttpd.conf; then
	    		sed -e 's|.*"/examples/" => "/usr/share/examples/",|    "/examples/" => "/usr/share/examples/",\n    "/swat/" => "/usr/share/samba/swat/",|g' -i $1/etc/lighttpd/lighttpd.conf
			if [ -z "$1" ]; then
				# Start Web server.
				/etc/init.d/lighttpd stop
				/etc/init.d/lighttpd start
			fi
		fi
	fi
}