Date: Friday, November 12, 2010 @ 10:51:27 Author: andrea Revision: 98661
upgpkg: icecast 2.3.2-4 implement a loop to check if icecast is running (FS#18823); remove useless line in logrotate script (FS#20336) Added: icecast/trunk/start-by-nobody.patch Modified: icecast/trunk/PKGBUILD icecast/trunk/icecast.logrotate icecast/trunk/icecastd -----------------------+ PKGBUILD | 28 +++++++++++++++---------- icecast.logrotate | 1 icecastd | 53 ++++++++++++++++++++++++++++++++++++++---------- start-by-nobody.patch | 15 +++++++++++++ 4 files changed, 74 insertions(+), 23 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2010-11-12 14:38:47 UTC (rev 98660) +++ PKGBUILD 2010-11-12 15:51:27 UTC (rev 98661) @@ -1,12 +1,12 @@ # $Id$ # Maintainer: Andrea Scarpino <[email protected]> # Contributor: Andreas Radke <[email protected]> -# Contributer: Jason Chu <[email protected]> +# Contributor: Jason Chu <[email protected]> # Contributor: dorphell <[email protected]> pkgname=icecast pkgver=2.3.2 -pkgrel=3 +pkgrel=4 pkgdesc="Streaming audio over the Internet" arch=('i686' 'x86_64') license=('GPL') @@ -15,34 +15,40 @@ backup=('etc/icecast.xml' 'etc/logrotate.d/icecast') source=("http://downloads.us.xiph.org/releases/${pkgname}/${pkgname}-${pkgver}.tar.gz" - 'icecastd' 'icecast.logrotate') + 'icecastd' 'icecast.logrotate' + 'start-by-nobody.patch') md5sums=('ff516b3ccd2bcc31e68f460cd316093f' - '2cf9bb562e764ff451ed557711883978' - '8fad3bf3283fa2bd651b71fdf505eae9') + '464ef7e110d32998f60e5bea293acc92' + '59c6552bcb1dd9fb542af8670dfabd3c' + 'd8e929d2214123a1954da4383bf16583') build() { cd ${srcdir}/${pkgname}-${pkgver} + + patch -Np1 -i ${srcdir}/start-by-nobody.patch + ./configure --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var - make || return 1 + make } package() { cd ${srcdir}/${pkgname}-${pkgver} - make DESTDIR=${pkgdir} install || return 1 + make DESTDIR=${pkgdir} install # install man-page sed -i -e 's/icecast2/icecast/g' debian/icecast2.1 install -Dm644 debian/icecast2.1 \ - ${pkgdir}/usr/share/man/man1/icecast.1 || return 1 + ${pkgdir}/usr/share/man/man1/icecast.1 # init file install -Dm755 ${srcdir}/icecastd \ - ${pkgdir}/etc/rc.d/icecast || return 1 + ${pkgdir}/etc/rc.d/icecast # rotate the logs (taken from Fedora) install -Dm644 ${srcdir}/icecast.logrotate \ - ${pkgdir}/etc/logrotate.d/icecast || return 1 + ${pkgdir}/etc/logrotate.d/icecast + # install log dir - install -d ${pkgdir}/var/log/icecast || return 1 + install -d -g99 -o99 ${pkgdir}/var/log/icecast } Modified: icecast.logrotate =================================================================== --- icecast.logrotate 2010-11-12 14:38:47 UTC (rev 98660) +++ icecast.logrotate 2010-11-12 15:51:27 UTC (rev 98661) @@ -3,7 +3,6 @@ notifempty sharedscripts postrotate - /bin/kill -HUP `cat /var/run/icecast/icecast.pid 2>/dev/null` 2> /dev/null || true endscript } Modified: icecastd =================================================================== --- icecastd 2010-11-12 14:38:47 UTC (rev 98660) +++ icecastd 2010-11-12 15:51:27 UTC (rev 98661) @@ -3,31 +3,62 @@ . /etc/rc.conf . /etc/rc.d/functions -PID=`pidof -o %PPID /usr/bin/icecast` +getPID() { + echo $(pgrep -u nobody icecast 2>/dev/null); +} + case "$1" in start) stat_busy "Starting Icecast Server" - [ -z "$PID" ] && /usr/bin/icecast -b -c /etc/icecast.xml &>/dev/null - if [ $? -gt 0 ]; then - stat_fail + if [ -z "$(getPID)" ]; then + /usr/bin/icecast -b -c /etc/icecast.xml &>/dev/null + timeo=30 + while [ $timeo -gt 0 ]; do + [ ! -z "$(getPID)" ] && break + sleep 1 + let timeo=${timeo}-1 + done + if [ $timeo -eq 0 ]; then + stat_fail + exit 1 + else + add_daemon icecast + stat_done + fi else - add_daemon icecast - stat_done + stat_fail + exit 1 fi ;; + stop) stat_busy "Stopping Icecast Server" - [ ! -z "$PID" ] && kill $PID &> /dev/null - if [ $? -gt 0 ]; then - stat_fail + if [ ! -z "$(getPID)" ]; then + timeo=30 + kill $(getPID) &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + exit 1 + fi + while [ ! -z "$(getPID)" -a $timeo -gt 0 ]; do + sleep 1 + let timeo=${timeo}-1 + done + if [ -z "$(getPID)" ]; then + rm_daemon icecast + stat_done + else + stat_fail + exit 1 + fi else - rm_daemon icecast stat_done + exit 1 fi ;; + restart) $0 stop - sleep 3 $0 start ;; *) Added: start-by-nobody.patch =================================================================== --- start-by-nobody.patch (rev 0) +++ start-by-nobody.patch 2010-11-12 15:51:27 UTC (rev 98661) @@ -0,0 +1,15 @@ +--- icecast-2.3.2/conf/icecast.xml.in~ 2010-11-12 16:47:54.750000918 +0100 ++++ icecast-2.3.2/conf/icecast.xml.in 2010-11-12 16:48:08.086667585 +0100 +@@ -164,11 +164,9 @@ + + <security> + <chroot>0</chroot> +- <!-- + <changeowner> + <user>nobody</user> +- <group>nogroup</group> ++ <group>nobody</group> + </changeowner> +- --> + </security> + </icecast>
