File kopano-webapp-plugin-filepreview.spec of Package kopano-webapp-plugin-filepreviewer

%define pluginname filepreviewer
%define plugindir %_datadir/kopano-webapp/plugins

Name:           kopano-webapp-plugin-filepreviewer
Summary:        File previewer plugin for Kopano WebApp
Group:          Productivity/Networking/Email/Clients
License:        AGPL-3.0
Version:        1.1
Release:	1
Url:            http://www.kopano.com
Source:         %{name}-%{version}.tar.xz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:	kopano-webapp-buildtools
BuildArch:      noarch
Obsoletes:	kopano-webapp-pdfbox, kopano-webapp-webodf, kopano-webapp-extbox
Provides:	kopano-webapp-pdfbox, kopano-webapp-webodf, kopano-webapp-extbox

%description
The Kopano file previewer plugin for various image and document formats.

%prep
%setup -qn %{name}-%{version}
find . -type f "(" -name "*.js" -o -name "*.php" ")" \
	-exec chmod a-x "{}" "+";

%build
ant -Dtools-folder=/usr/share/kopano-webapp-buildtools/tools/ -Dserver-folder=/usr/share/kopano-webapp-buildtools/server/ -Dtarget-folder=deploy -Dplugin-folder=%{name} -Dplugin=%{pluginname} deploy;

%install
b="%buildroot";
d="$b/%{plugindir}/%{pluginname}";

install -d "$d";
install -d "$b/%_sysconfdir/kopano/webapp"

cp -rf deploy/%{name}/* "$d/";
install -m644 LICENSE.txt "$d/LICENSE.txt"
mv "$d/config.php" "$b/%_sysconfdir/kopano/webapp/config-%{pluginname}.php"
ln -s "%_sysconfdir/kopano/webapp/config-%{pluginname}.php" "$d/config.php"

%files
%defattr(-,root,root)
%dir %_datadir/kopano-webapp
%dir %plugindir
%dir %_sysconfdir/kopano
%dir %_sysconfdir/kopano/webapp
%plugindir/%{pluginname}
%config(noreplace) %_sysconfdir/kopano/webapp/config-%{pluginname}.php

%changelog
* Thu Jul 23 2015 development@kopano.com
- Current release
openSUSE Build Service is sponsored by