File ntripcaster.spec of Package ntripcaster

#
# spec file for package ntripcaster
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2005 Dirk Stoecker <stoecker@alberding.eu>.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  dos2unix
BuildRequires:  make
BuildRequires:  unzip

Name:           ntripcaster
Requires:       perl
Version:        0.1.5
Release:        0
Summary:        Ntripcaster GNSS data streaming
License:        GPL-2.0+
Group:          Productivity/Networking/Other
Summary(de):    Ntripcaster GNSS Datenserver
Url:            http://software.rtcm-ntrip.org/
Source0:        ntripcaster%{version}.zip
Source1:        rcscript
Source2:        COPYRIGHT
Source3:        ntripcaster
Patch:          fix_for_rpm.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
NTRIP system main server.

%description -l de
Hauptserver des NTRIP systems.

%prep
%setup -q -n ntripcaster%{version}
%patch -p1

%build
# clean old stuff, which should not be there
cp %{SOURCE2} .
mv ../README.txt .
dos2unix README.txt
rm -r config.h* acconfig* CVS configure */CVS Makefile.in */Makefile.in missing mkinstalldirs stamp-h.in install-sh aclocal.m4
autoreconf -i
automake -a
./configure logdir=/var/log/ etcdir=/etc/ntripcaster/
make

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/usr/sbin
mkdir -p %{buildroot}/etc/%{name}
mkdir -p %{buildroot}/etc/init.d
cp src/ntripcaster %{buildroot}/usr/sbin/
cp conf/ntripcaster.conf.dist %{buildroot}/etc/%{name}/%{name}.conf
cp conf/sourcetable.dat.dist %{buildroot}/etc/%{name}/sourcetable.dat
%if 0%{?suse_version}
cp %{SOURCE1} %{buildroot}/etc/init.d/%{name}
chmod 755 %{buildroot}/etc/init.d/%{name}
ln -s /etc/init.d/%{name} %{buildroot}/usr/sbin/rc%{name}
%else
cp %{SOURCE3} %{buildroot}/etc/init.d/%{name}
%endif

%clean
rm -rf %{buildroot}

%pre
/usr/sbin/useradd -r -d /etc/%{name} -s /bin/bash -c "NtripCaster" -g daemon %{name} 2> /dev/null || :

%preun
%stop_on_removal %{name}

%postun 
%restart_on_update %{name}
%{insserv_cleanup}

%files
%defattr(755,root,root)
/etc/init.d/%{name}
%if 0%{?suse_version}
/usr/sbin/rc%{name}
%endif
/usr/sbin/%{name}
%dir /etc/%{name}
%defattr(644,%{name},daemon)
%config(noreplace) /etc/%{name}/%{name}.conf
%config(noreplace) /etc/%{name}/sourcetable.dat
%defattr(-,%{name},daemon)
%doc COPYRIGHT
%defattr(644,%{name},daemon)
%doc README.txt
%doc CHANGES
%doc conf/NtripSourcetable.doc

%changelog
openSUSE Build Service is sponsored by