# Compiling Time: 0.06 SBU
# Maintainer: Priyank Gosalia <priyankmg@gmail.com>
# Contributor: Tuxbubling <tuxbubling@tiscali.fr>

pkgname=icecast
pkgver=2.4.3
pkgrel=1
pkgdesc="Icecast is a streaming media server."
url="http://www.icecast.org/"
groups=('network-extra')
archs=('i686' 'x86_64')
depends=('libxslt' 'libvorbis' 'curl')
up2date="lynx -dump http://www.icecast.org/download.php | grep icecast-[0-9\.]*tar.gz | sed -ne 's/.*-//;s/.tar.gz//;1 p'"
source=(http://downloads.us.xiph.org/releases/icecast/$pkgname-$pkgver.tar.gz $pkgname.service)
_F_systemd_units=($pkgname=)
Finclude systemd
sha1sums=('230e2aa5abf80010c42d41cc7c0b078fb542b080' \
          'f94e6484cfb4dc6b51fb9f758bbddc2ffef0a003')

build()
{
	Fmkdir /var/log/icecast
	Fbuild --sysconfdir=/etc/icecast
	Fmv /usr/share/doc/$pkgname /usr/share/doc/$pkgname-$pkgver

	chown -R nobody $Fdestdir/var/log/icecast
	chgrp -R nogroup $Fdestdir/var/log/icecast

	# Activating the changeowner mode in config file
	line=`grep -n "<changeowner>" $Fdestdir/etc/icecast/icecast.xml | cut -d : -f 1`
	line2=`grep -n "</changeowner>" $Fdestdir/etc/icecast/icecast.xml | cut -d : -f 1`
	sed -i "`expr $line - 1` d" $Fdestdir/etc/icecast/icecast.xml
	sed -i "`expr $line2` d" $Fdestdir/etc/icecast/icecast.xml

	Ffile /lib/systemd/system/$pkgname.service
	Fgenscriptlet
}

# optimization OK
