]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
RPM build - config fixes
authorJaroslav Kysela <perex@perex.cz>
Mon, 13 Oct 2014 19:21:18 +0000 (21:21 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 13 Oct 2014 19:49:50 +0000 (21:49 +0200)
rpm/Makefile
rpm/tvheadend.spec.in
rpm/tvheadend.sysconfig
support/version

index 5a9d889269b958ba7465236ca8b58a00f17fc43a..8e2b2c55843fecc7b26f776ef2efbbeb1194f23e 100644 (file)
@@ -20,7 +20,7 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../.config.mk
 
 COMMIT   ?= $(shell git rev-parse HEAD)
 COMMIT1   = $(shell git rev-parse $(COMMIT))
-VERSION   = $(shell cd .. && git describe --match "v*" $(COMMIT1) | sed 's/-/./g' )
+VERSION   = $(shell cd .. && git describe --match "v*" $(COMMIT1) | sed -e 's/-/./g' -e 's/^v//g' )
 
 tvheadend.spec: tvheadend.spec.in
        @sed -e 's/@VERSION@/$(VERSION)/g' \
index c808f6da0fb609548d0836d92bccd93755fd1c05..e9ca863f1b187b40548519ce854957f343722b4c 100644 (file)
@@ -31,6 +31,7 @@ to Showtime, XBMC and various other clients.
 #%patch999 -p1 -b .test
 
 %build
+echo %{version} > %{_builddir}/%{buildsubdir}/rpm/version
 %configure --disable-lockowner --enable-bundle --enable-libffmpeg_static
 %{__make}
 
@@ -40,10 +41,31 @@ mkdir -p -m755 %{buildroot}%{_bindir}
 install -p -m 755 build.linux/tvheadend %{buildroot}%{_bindir}
 # systemd
 mkdir -p -m755 %{buildroot}%{_sysconfdir}/sysconfig
-install -p -m 644 rpm/tvheadend.sysconfig %{buildroot}%{_sysconfdir}/sysconfig
+install -p -m 644 rpm/tvheadend.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/tvheadend
 mkdir -p -m755 %{buildroot}%{_unitdir}
 install -p -m 644 rpm/tvheadend.service %{buildroot}%{_unitdir}
 
+%pre
+getent group tvheadend >/dev/null || groupadd -f -g 283 -r tvheadend
+if ! getent passwd tvheadend > /dev/null ; then
+  if ! getent passwd 283 > /dev/null ; then
+    useradd -r -l -u 283 -g tvheadend -d /home/tvheadend -s /sbin/nologin -c "Tvheadend TV server" tvheadend
+  else
+    useradd -r -l -g tvheadend -d /home/tvheadend -s /sbin/nologin -c "Tvheadend TV server" tvheadend
+  fi
+fi
+if ! test -d /home/tvheadend ; then
+  mkdir -m 0755 /home/tvheadend || exit 1
+  chown tvheadend.tvheadend /home/tvheadend || exit 1
+fi
+exit 0
+
+%post
+%systemd_post tvheadend.service
+
+%postun
+%systemd_postun_with_restart tvheadend.service
+
 %files
 %{_bindir}/*
 %{_sysconfdir}/sysconfig/*
index d62f7513d3bfe2133698a0234000535b32a9f030..6260fac434354a033cfb91cda6ec3043cd359adc 100644 (file)
@@ -1,3 +1,3 @@
 # Configuration file for the tvheadend service.
 
-OPTIONS="-u tvheadend -g tvheadend -6 --http_port=9981 --htsp_port=9982"
+OPTIONS="-c /home/tvheadend/config -u tvheadend -g tvheadend -6 --http_port 9981 --htsp_port 9982"
index 6e4729bb723d49313020508f4e7c6b4d86fb3c21..8c2164e9ca4ffeb75e8a717dc53df8d8594f3957 100755 (executable)
@@ -17,6 +17,8 @@ if [ -d ".git" ]; then
   VER=$(echo $VER | sed "s/^v//" | sed "s/-\([0-9]*\)-\(g[0-9a-f]*\)/.\1~\2/")
 elif [ -f "$(dirname "$0")/../debian/changelog" ]; then
   VER=$(head -1 "$(dirname "$0")/../debian/changelog" | awk '{ print $2 }' | tr -d '()' | cut -d '-' -f 1)
+elif [ -r "$(dirname "$0")/rpm/version" ]; then
+  VER=$(cat "$(dirname "$0")/rpm/version")
 else
   VER="0.0.0~unknown"
 fi