File icecast.spec of Package icecast

# spec file for package icecast
# Parts of this file taken from original SUSE and Fedora packaging

Summary: Streaming media server
Name: icecast
Version: 2.4.4
Release: 1%{?dist}
Group: Applications/Multimedia
#because one way to say this is not enough...
%if 0%{?suse_version} > 1
License: GPL-2.0
License: GPLv2
Source0: icecast2_2.4.4.orig.tar.gz
Source1: icecast2_2.4.4-1.debian.tar.gz
Source2: icecast.init
Source3: icecast.logrotate
Source4: icecast.xml
Source5: icecast.init.suse

%if 0%{?suse_version} > 1
Suggests:	logrotate

Patch0:         icecast-2.4.1_runas_icecast_user.patch
Patch1:         icecast-fix-no-add-needed.patch
PreReq:         %fillup_prereq
PreReq:         %insserv_prereq
PreReq:         /usr/sbin/groupadd
PreReq:         /usr/sbin/useradd

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

Provides: streaming-server

BuildRequires: automake
BuildRequires: libvorbis-devel >= 1.0, libogg-devel >= 1.0, curl-devel >= 7.10.0
BuildRequires: libxml2-devel, libxslt-devel, speex-devel
# To be enabled as soon as Fedora's libtheora supports ogg_stream_init
BuildRequires: libtheora-devel >= 1.0, openssl-devel
# From suse packaging
BuildRequires: libtool,

Requires(pre): /usr/sbin/useradd
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service

This is an official package of Icecast.
Icecast is a streaming media server which currently supports Ogg Vorbis
and Opus audio streams, with MP3 known to work. It can be used to create
an Internet radio station or a privately running jukebox and many things
in between.  It is very versatile in that new formats can be added
relatively easily and supports open standards for commuincation
and interaction.

%setup -q
%if 0%{?suse_version} > 1
find -name "*.html" -or -name "*.jpg" -or -name "*.png" -or -name "*.css" | xargs chmod 644
tar -xzf %{SOURCE1}
%{__sed} -i -e 's/icecast2/icecast/g' debian/icecast2.1

# theora support is to be enabled as soon as Fedora's libtheora supports
# ogg_stream_init
# --disable-theora
%if 0%{?suse_version} > 1
autoreconf -fiv
%{__make} %{?_smp_mflags}

rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
%if 0%{?suse_version} > 1
rm -rf %{buildroot}%{_datadir}/doc/%{name}
# init script
install -d -m 0755 %{buildroot}%{_sbindir}
install -D -m 0755 %{SOURCE5} %{buildroot}%{_sysconfdir}/init.d/%{name}
ln -s -f %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name}
# create missing dirs
install -d -m 0755 %{buildroot}%{_localstatedir}/{lib,log}/%{name}
rm -rf %{buildroot}%{_datadir}/icecast/doc
rm -rf %{buildroot}%{_docdir}/icecast
install -D -m 755 %{SOURCE2} %{buildroot}%{_initrddir}/icecast
install -D -m 640 %{SOURCE4} %{buildroot}%{_sysconfdir}/icecast.xml
install -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/icecast
install -D -m 644 debian/icecast2.1 %{buildroot}%{_mandir}/man1/icecast.1
mkdir -p %{buildroot}%{_localstatedir}/log/icecast
%if 0%{?suse_version} > 1
mkdir -p %{buildroot}%{_localstatedir}/run/icecast
find doc -iname "Makefile*" | xargs rm -f

%if 0%{?suse_version} > 1
[ %{buildroot} != "/" -a -d %{buildroot} ] && rm -rf %{buildroot}
rm -rf %{buildroot}

%if 0%{?suse_version} > 1
/usr/sbin/groupadd   -r %{name} &>/dev/null || :
/usr/sbin/useradd -g %{name} -s /bin/false -r -c "Icecast streaming server" -d %{_localstatedir}/lib/%{name} %{name} &>/dev/null || :
/usr/sbin/useradd -M -r -d /usr/share/icecast -s /sbin/nologin \
	-c "icecast streaming server" icecast > /dev/null 2>&1 || :

%if 0%{?suse_version} > 1
%fillup_and_insserv %{name}
/sbin/chkconfig --add icecast

%if 0%{?suse_version} > 1
%stop_on_removal %{name}
if [ $1 = 0 ]; then
        /sbin/service icecast stop >/dev/null 2>&1
        /sbin/chkconfig --del icecast

%if 0%{?suse_version} > 1
%restart_on_update %{name}
if [ "$1" -ge "1" ]; then
        /sbin/service icecast condrestart >/dev/null 2>&1
if [ $1 = 0 ] ; then
	userdel icecast >/dev/null 2>&1 || :

%doc doc/*.html
%doc doc/assets
%doc doc/img
%doc conf/*.dist
%config(noreplace) %attr(-,root,%{name}) %{_sysconfdir}/icecast.xml
%if 0%{?suse_version} > 1
%config(noreplace) %attr(640,root,root) %{_sysconfdir}/logrotate.d/%{name}
%dir %attr(-,%{name},%{name}) %{_localstatedir}/run/icecast
%dir %attr(-,%{name},%{name}) %{_localstatedir}/log/icecast

* Wed Oct 31 2018 Thomas B. Ruecker <> - 2.4.4-1
- Security fix: Fixed buffer overflows in URL auth code CVE-2018-18820
- For more info see ChangeLog

* Wed Apr 08 2015 Thomas B. Ruecker <> - 2.4.2-1
- security fix for remote DoS vulnerability 

* Sun Dec 14 2014 Thomas B. Ruecker <> - 2.4.1-2
- Packaging fix for docdir problem, as patched upstream
- Adjusted %doc to reflect subdirectories

* Sun Nov 23 2014 Thomas B. Ruecker <> - 2.4.1-1
- Initial packaging of 2.4.1
- See ChangeLog for details

* Sun May 25 2014 Thomas B. Ruecker <> - 2.4.0-1
- SECURITY FIX - Override supplementary groups if <changeowner>
- Added <audio> for supported streams. TNX ePirat
- status2.xsl, broken for a decade, now it's gone!
- Updated docs:
  - logging to STDERR; known issues
  - Refactored docs about client authentication
  - Vastly improved page about Icecast statistics
  - Clean up supported windows versions
  - Quick fixup of the basic setup page
  - Minor fixes to the config file documentation
  - Updated YP documentation
  - Reduced win32 documentation to essentials
- Adding stream_start_iso8601, server_start_iso8601
  ISO8601 compliante timestamps for statistics. Should make usage in
  e.g. JSON much easier.
  Added as new variables to avoid breaking backwards compatibility.
- Nicer looking tables for the admin interface.
  ePirat sent updated tables code that should look much nicer.
  This is admin interface only (and a global css change).
- Set content-type to official "application/json"
- Initial JSON status transform.
  Output roughly limited to data also visible through status.xsl.
- Silence direct calls, add partial array support.
- The XSLT will now return empty if called directly.
  This is a security measure to prevent unintended data leakage.
- Adding partial array support to print sources in an array.
  Code lifted from:
- Adding xml2json XSLT, svn r31 upstream trunk.
- RPM specific changes:
  - remove status3.xsl as it was never part of the official source
  - slight change in default config, more changes later

* Sat Mar 01 2014 Thomas B. Ruecker <> -
- Upgrade to 2.4 beta5
- Updated web interface to be fully XHTML compliant.
  Credit to ePirat
- Send charset in headers for everything, excluding file-serv and streams.
- Documentation updates
- reverted patch affecting stats interface

* Thu Jan 23 2014 Thomas B. Ruecker <> -
- Upgrade to 2.4 beta4
- Updated web interface to be more XHTML compliant.
- Fixed a memory leak. Lost headers of stream because of wrong ref
  counter in associated refbuf objects.
- avoid memory leak in _parse_mount() when "type"-attribute is set
- Completed HTTP PUT support, send 100-continue-header,
  if client requests it. We need to adhere to HTTP1.1 here.
- corrected Date-header format to conform the standard (see RFC1123).
  Thanks to cato for reporting.
- Added a favicon to the web-root content
- We now split handling of command line arguments into two parts.
  Only the critical part of getting the config file is done first (and
  -v as it prevents startup). The rest (currently only -b) is deferred.
  It allows us to log error messages to stderr even if the -b argument
  is passed. This is mainly for the case where the logfile or TCP port
  can't be opened.

* Sat Apr 06 2013 Thomas B. Ruecker <> -
- Upgrade to 2.4 beta3
- This release added a default mount feature

* Sun Mar 31 2013 Thomas B. Ruecker <> -
- Experimental packaging of Icecast 2.4 beta2
openSUSE Build Service is sponsored by