Summary: Universal Plug'nPlay (uPNP) Media Server
Summary(ja): ユニバーサルプラグアンドプレイ(uPNP)メディアサーバ
Name: ushare
Version: 1.0
Release: 1%{?_dist_release}
License: GPL
Group: Applications/Multimedia
URL: http://ushare.geexbox.org/

Source: http://ushare.geexbox.org/releases/ushare-%{version}.tar.bz2
Source1: ushare.init

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: pkgconfig >= 0.9.0, libupnp-devel
Requires(post): chkconfig
Requires(preun): initscripts, chkconfig
Requires(postun): initscripts

%description
uShare is a UPnP (TM) A/V Media Server. It implements the server 
component that provides UPnP media devices with information on 
available multimedia files. uShare uses the built-in http server 
of libupnp to stream the files to clients.

%prep
%setup

%build
%configure
%{__make} %{?_smp_mflags}

%install
%{__rm} -rf %{buildroot}
%{__make} install DESTDIR="%{buildroot}"
%{__install} -Dp -m0755 %{SOURCE1} %{buildroot}%{_sysconfdir}/rc.d/init.d/ushare
%{__install} -d -m0755 %{buildroot}%{_localstatedir}/lib/ushare/
%find_lang %{name}

%{__rm} %{buildroot}%{_sysconfdir}/init.d/ushare

%pre
if ! /usr/bin/id ushare &>/dev/null; then
        /usr/sbin/useradd -r -M -d %{_localstatedir}/lib/ushare -s /bin/false -c "ushare service accoung" ushare ||:
fi

%post
/sbin/chkconfig --add ushare

%preun
if [ $1 -eq 0 ]; then
	/sbin/service ushare stop &>/dev/null || :
	/sbin/chkconfig --del ushare
fi

%postun
if [ $1 -eq 0 ]; then 
        /usr/sbin/userdel ushare ||:
        /usr/sbin/groupdel ushare ||:
fi
if [ $1 -ge 1 ]; then
	/sbin/service ushare condrestart &>/dev/null || :
fi

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

%files -f %{name}.lang
%defattr(-, root, root, 0755)
%doc AUTHORS ChangeLog COPYING NEWS README
%doc %{_mandir}/man1/ushare.1*
%config(noreplace) %{_sysconfdir}/ushare.conf
%attr(755,root,root) %{_sysconfdir}/rc.d/init.d/ushare
%{_bindir}/ushare

%defattr(-, ushare, ushare, 0770)
%{_localstatedir}/lib/ushare/

%changelog
* Mon Oct 13 2008 Shu KONNO <owa@bg.wakwak.com> 1.0-1vl5
- applied new versioning policy, spec in utf-8

* Tue Jul 31 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0-0vl1
- new upstream release

* Sat May 26 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 0.9.10-0vl1
- initial build for Vine Linux

* Thu Mar 01 2007 Dag Wieers <dag@wieers.com> - 0.9.10-1 - 5190+/dag
- Updated to release 0.9.10.

* Wed Feb 21 2007 Dag Wieers <dag@wieers.com> - 0.9.8-1
- Initial package. (using DAR)
