Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > 1d30a4f3941a4dcc169b125ff8952fe9 > files > 6

tvheadend-3.2.18-2.mga3.src.rpm

Name:           tvheadend
Summary:        TV streaming server
Version:        3.2.18
Release:        %mkrel 2
License:        GPLv3
URL:            http://www.lonelycoder.com
Group:          Video/Television
Source0:        %{name}-%{version}.tar.gz
Source1:        %{name}.init
Source2:        %{name}.png
Source4:        %{name}.conf
Source5:        README.install.urpmi
BuildRequires:  kdelibs4-devel
BuildRequires:  qt4-devel
BuildRequires:  avahi-client-devel
BuildRequires:  libgcrypt-devel
Requires(post): pwgen
Requires(pre):  rpm-helper
Requires(preun):rpm-helper

%description
Tvheadend is a TV streaming server for Linux supporting DVB-S, DVB-S2, DVB-C,
DVB-T, ATSC, IPTV, and Analog video (V4L) as input sources.

For the full list of features see the documentation at:
https://www.lonelycoder.com/hts/tvheadend/docs/2_12/index.html

%prep
%setup -q
iconv -f iso8859-1 -t utf-8 README -o README

%build
%setup_compile_flags
#temporary workaround until upstream fixes compilation with gcc-4.6
export CFLAGS="%optflags -Wno-error=unused-but-set-variable"
#tvheadend uses a custom configure script, so %%configure2_5x cannot be used
# as not all options are supported
./configure --prefix=%{_prefix} --release --libdir=%{_libdir} --mandir=%{_mandir}/man1 --disable-dvbscan
%make

%install
rm -rf %{buildroot}
%makeinstall_std

cp -v %{SOURCE5} .

mkdir -p %{buildroot}/%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol
cp -v %{SOURCE4} %{buildroot}%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1

mkdir -p %{buildroot}/%{_iconsdir}
cp -v %{SOURCE2} %{buildroot}/%{_iconsdir}/%{name}.png

mkdir -p %{buildroot}/%{_datadir}/applications
cat > %{buildroot}/%{_datadir}/applications/%{name}.desktop << EOF
[Desktop Entry]
Name=Tvheadend
Comment=%{summary}
Exec=%{_bindir}/xdg-open http://localhost:9981/
Icon=%{_iconsdir}/%{name}
Type=Application
Categories=AudioVideo;Video;TV;Recorder;X-Mageia-CrossDesktop;
EOF

mkdir -p %{buildroot}/%{_initddir}
install -m 0755 %{SOURCE1} %{buildroot}/%{_initddir}/%{name}

chmod +x %{buildroot}%{_bindir}/%name

%pre
# create a user "tvheadend" with a home directory /var/lib/tvheadend
# with no login shell and make him a member of the video group
%_pre_useradd %{name} %{_localstatedir}/lib/%{name} /sbin/nologin
gpasswd -a %{name} video >/dev/null

%post
chown %{name}:root %{_localstatedir}/lib/%{name} 
cd %{_localstatedir}/lib/%{name}
chown -R %{name}:video .hts*

# check if the access control file still has the initial dummy password, and
# replace the dummy password by a random, 12-character pwgen-generated password
if  grep -q '"password": "dummypassword"' %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1; then
  sed -i "s,\"password\": \"dummypassword\",\"password\": \"$(pwgen -s 12 1)\"," %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
fi

%_post_service %{name}

%preun
%_preun_service %{name}

%clean
rm -rf %{buildroot}

%files
# debian/changelog is the actual upstream changelog
%doc debian/changelog LICENSE README
%doc README.install.urpmi
%{_bindir}/%name
%{_initddir}/%name
%{_mandir}/man1/%name.1.xz
%{_iconsdir}/%name.png
%{_datadir}/applications/%{name}.desktop
%{_datadir}/%{name}

#home directory and config file 
%dir %attr(-,tvheadend,root) %{_localstatedir}/lib/%{name}
%dir %attr(-,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol
%attr(0600,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1



%changelog

* Mon Jan 14 2013 umeabot <umeabot> 3.2.18-2.mga3
+ Revision: 384907
- Mass Rebuild - https://wiki.mageia.org/en/Feature:Mageia3MassRebuild

* Wed Jan 09 2013 anssi <anssi> 3.2.18-1.mga3
+ Revision: 343709
- update group
- new version
- drop now unneeded patches (mandir.patch, cflags.patch)

* Thu Jan 05 2012 doktor5000 <doktor5000> 2.12-1.mga2
+ Revision: 191744
- temporary workaround for compilation with gcc-4.6
- use %%{_bindir} instead of /usr/bin in .desktop file
- remove unused start script from spec
- use %%setup_compile_flags
- drop %%ifarch-applying of patch
- drop %%ifarch-configure
- fix cflags.patch, so that the Makefile does not overwrite our CFLAGS
- add LSB headers to init script, added Default-Stop for runlevels 0 and 6,
  remove commented-out line
- replaced start script with direct call from .desktop file and avoid
  calling tvheadend a second time additionally to the init script
- fix Icon entry in .desktop file, add X-Mageia-CrossDesktop to categories to
  no display it in "More" sub-menu
- use gpasswd instead of usermod -G, since "usermod -G" replaces groups
  instead of adding them
- check for the existence of the dummy password before replacing it with the
  pwgen-generated one, grep/sed the whole string as safety measure
- move manpage to correct location (mandir.patch)
- use %%{_prefix} instead of /usr
- change README.urpmi to README.install.urpmi, change encoding to UTF8,
  proofread & reword README.install.urpmi, remove german parts
- minor cosmetics
- imported package tvheadend