Skip to content

Commit

Permalink
Added contrib directory with redhat specfile and init script.
Browse files Browse the repository at this point in the history
  • Loading branch information
jouk committed Feb 18, 2011
1 parent cae47cf commit 5d3c14e
Show file tree
Hide file tree
Showing 2 changed files with 203 additions and 0 deletions.
128 changes: 128 additions & 0 deletions contrib/redhat/tvheadend
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
#!/bin/sh
#
# tvheadend Start/Stop the hts tvheadend daemon.
#
# chkconfig: 345 90 60
# 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. It also comes with a powerful and
# easy to use web interface both used for configuration and
# day-to-day operations, such as searching the EPG and
# scheduling recordings.

### BEGIN INIT INFO
# Provides: tvheadend
# Required-Start: $local_fs $syslog
# Required-Stop: $local_fs $syslog
# Default-Start: 345
# Default-Stop: 90
# Short-Description: run tvheadend daemon
# 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. It also comes with a powerful and
# easy to use web interface both used for configuration and
# day-to-day operations, such as searching the EPG and
# scheduling recordings.
### END INIT INFO

[ -f /etc/sysconfig/tvheadend ] || {
[ "$1" = "status" ] && exit 4 || exit 6
}

RETVAL=0
prog="tvheadend"
exec=/usr/local/bin/tvheadend
lockfile=/var/lock/subsys/tvheadend
sysconfig=/etc/sysconfig/tvheadend

# Source function library.
. /etc/rc.d/init.d/functions

[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog

start() {
[ -x $exec ] || exit 5
[ -f $sysconfig ] || exit 6
echo -n $"Starting $prog: "
daemon $exec $OPTIONS
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
}

stop() {
echo -n $"Stopping $prog: "
if [ -n "`pidfileofproc $exec`" ]; then
killproc $exec
RETVAL=3
else
failure $"Stopping $prog"
fi
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
}

restart() {
stop
start
}

reload() {
echo -n $"Reloading $prog: "
if [ -n "`pidfileofproc $exec`" ]; then
killproc $exec -HUP
else
failure $"Reloading $prog"
fi
retval=$?
echo
}

force_reload() {
# new configuration takes effect after restart
restart
}

rh_status() {
# run checks to determine if the service is running or use generic status
status -p /var/run/tvheadend.pid $prog
}

rh_status_q() {
rh_status >/dev/null 2>&1
}


case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $?

75 changes: 75 additions & 0 deletions contrib/redhat/tvheadend.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
Name: tvheadend
Summary: TV streaming server
Version: 2.12.cae47cf
Release: 1%{dist}
License: GPL
Group: Applications/Multimedia
URL: http://www.lonelycoder.com/hts/tvheadend_overview.html
Packager: Jouk Hettema
Source: tvheadend-%{version}.tar.bz2
Prefix: /usr
BuildRequires: avahi-devel, openssl, glibc, zlib

%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.

%prep
%setup -q

%build
%configure --release --prefix=%{prefix}/bin
%{__make}

%install
%{__rm} -rf %{buildroot}

mkdir -p $RPM_BUILD_ROOT/%{prefix}

%{__install} -d -m0755 %{buildroot}%{prefix}/bin
%{__install} -d -m0755 %{buildroot}/etc/tvheadend
%{__install} -d -m0755 %{buildroot}/etc/sysconfig
%{__install} -d -m0755 %{buildroot}/etc/rc.d/init.d
%{__install} -d -m0755 %{buildroot}%{prefix}/shared/man/man1

%{__install} -m0755 build.Linux/tvheadend %{buildroot}%{prefix}/bin/
%{__install} -m0755 man/tvheadend.1 %{buildroot}%{prefix}/shared/man/man1
%{__install} -m0755 contrib/redhat/tvheadend %{buildroot}/etc/rc.d/init.d

cat >> %{buildroot}/etc/sysconfig/tvheadend << EOF
OPTIONS="-f -u tvheadend -g tvheadend -c /etc/tvheadend -s -C"
EOF

%pre
groupadd -f -r tvheadend >/dev/null 2>&! || :
useradd -s /sbin/nologin -c "Tvheadend" -M -r tvheadend -g tvheadend -G video >/dev/null 2>&! || :

%preun
if [ $1 = 0 ]; then
/sbin/service tvheadend stop >/dev/null 2>&1
/sbin/chkconfig --del tvheadend
fi

%post
/sbin/chkconfig --add tvheadend

if [ "$1" -ge "1" ]; then
/sbin/service tvheadend condrestart >/dev/null 2>&1 || :
fi

%clean
%{__rm} -rf %{buildroot}

%files
%defattr(-,root,root)
%doc debian/changelog LICENSE README
%dir %attr(-,tvheadend,root) %{prefix}
%{prefix}/bin/tvheadend
%{prefix}/shared/man/man1/tvheadend.1*
%{_sysconfdir}/rc.d/init.d/tvheadend
/etc/tvheadend
%config /etc/sysconfig/tvheadend

%changelog
* Fri Feb 18 2011 Jouk Hettema <joukio@gmail.com> - 2.12.cae47cf
- initial build for fedora 14

0 comments on commit 5d3c14e

Please sign in to comment.