[vdradmin-am] Make default SVDRP port 6419 when built with vdr-devel >= 1.7.15, try to do the migration on upgrade

Ville Skyttä scop at fedoraproject.org
Sun Nov 6 17:07:05 UTC 2011


commit f3e9c06e66be4f44552a0d2eccc5c8e14898395b
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Nov 6 19:06:55 2011 +0200

    Make default SVDRP port 6419 when built with vdr-devel >= 1.7.15,
    try to do the migration on upgrades.
    Clean up specfile constructs no longer needed with Fedora or EL6+.

 vdradmin-am.spec |   38 +++++++++++++++++++++-----------------
 1 files changed, 21 insertions(+), 17 deletions(-)
---
diff --git a/vdradmin-am.spec b/vdradmin-am.spec
index 3d7ab71..d1d0db3 100644
--- a/vdradmin-am.spec
+++ b/vdradmin-am.spec
@@ -1,15 +1,11 @@
-%define cachedir  %(vdr-config --cachedir  2>/dev/null || echo ERROR)
-%define configdir %(vdr-config --configdir 2>/dev/null || echo ERROR)
-%define videodir  %(vdr-config --videodir  2>/dev/null || echo ERROR)
-
 %global migrfile %{_var}/run/systemd-migr_%{name}-%{version}-%{release}.%{arch}
+%global svdrpport %(pkg-config --atleast-version 1.7.15 vdr && echo 6419 || echo 2001)
 
 Name:           vdradmin-am
 Version:        3.6.8
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        Web interface for VDR
 
-Group:          Applications/Internet
 # infobox.js is GPLv2, crystal icons LGPLv2+, everything else GPLv2+
 License:        GPLv2+ and GPLv2 and LGPLv2+
 URL:            http://andreas.vdr-developer.org/en/
@@ -22,11 +18,9 @@ Patch0:         %{name}-3.6.6-config.patch
 Patch1:         %{name}-3.6.8-logging.patch
 # http://projects.vdr-developer.org/git/vdradmin-am.git/commit/?id=10e18ae
 Patch2:         %{name}-3.6.8-piddir.patch
-BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildArch:      noarch
-BuildRequires:  vdr-devel >= 1.3.27-0.4
-BuildRequires:  gettext
+BuildRequires:  vdr-devel >= 1.6.0-41
 BuildRequires:  perl(CGI)
 BuildRequires:  perl(HTTP::Date)
 BuildRequires:  perl(Locale::gettext)
@@ -51,8 +45,8 @@ to a local or remote VDR install to use this package.
 %patch1 -p1 -F 1
 %patch2 -p1
 %{__perl} -pi -e \
-  's|"/video"|"%{videodir}"| ;
-   s|^(\$CONFIG\{VDRCONFDIR\}\s*=\s*")[^"]*(.*)|$1%{configdir}$2| ;
+  's|"/video"|"%{vdr_videodir}"| ;
+   s|^(\$CONFIG\{VDRCONFDIR\}\s*=\s*")[^"]*(.*)|$1%{vdr_configdir}$2| ;
    s|-s \$AT_FILENAME |-f \$AT_FILENAME|' \
   vdradmind.pl
 for f in CREDITS HISTORY ; do
@@ -70,11 +64,12 @@ install -pm 644 %{SOURCE2} .
 %{__perl} ./vdradmind.tmp --config < /dev/null
 # Would contain build host name, removed to use runtime default
 sed -i -e /^MAIL_FROM/d vdradmind.conf
+# Fix up SVDRP port (6419 in >= 1.7.15, 2001 in older)
+sed -i -e 's/^VDR_PORT.*/VDR_PORT = %{svdrpport}/' vdradmind.conf
 ./make.sh po
 
 
 %install
-rm -rf $RPM_BUILD_ROOT
 install -Dpm 755 vdradmind.pl $RPM_BUILD_ROOT%{_sbindir}/vdradmind
 install -Dpm 644 vdradmind.pl.1 $RPM_BUILD_ROOT%{_mandir}/man8/vdradmind.8
 install -dm 755 $RPM_BUILD_ROOT/usr/share/vdradmin/epgimages
@@ -89,10 +84,6 @@ install -dm 500 $RPM_BUILD_ROOT/etc/pki/tls/private/vdradmin
 %find_lang vdradmin
 
 
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-
 %pre
 getent group vdradmin >/dev/null || groupadd -r vdradmin
 getent passwd vdradmin >/dev/null || \
@@ -108,7 +99,15 @@ fi
 exit 0
 
 %post
-[ $1 -eq 1 ] && systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -eq 1 ] ; then
+   systemctl daemon-reload >/dev/null 2>&1 || :
+%if %{svdrpport} == 6419
+else
+    sed -i -e 's/^VDR_PORT = 2001.*/VDR_PORT = %{svdrpport}/' \
+        /var/lib/vdradmin/vdradmind.conf || :
+    grep VDR_PORT /var/lib/vdradmin/vdradmind.conf
+%endif
+fi
 
 %preun
 if [ $1 -eq 0 ] ; then
@@ -150,6 +149,11 @@ rm -f %{migrfile} >/dev/null 2>&1 || :
 
 
 %changelog
+* Sun Nov  6 2011 Ville Skyttä <ville.skytta at iki.fi> - 3.6.8-4
+- Make default SVDRP port 6419 when built with vdr-devel >= 1.7.15,
+  try to do the migration on upgrades.
+- Clean up specfile constructs no longer needed with Fedora or EL6+.
+
 * Sat Jul 30 2011 Ville Skyttä <ville.skytta at iki.fi> - 3.6.8-3
 - Make systemd migration more robust.
 - Apply upstreamed non-forked logging improvement patches.


More information about the scm-commits mailing list