File libreoffice-templates-de.spec of Package libreoffice-templates-de

#
# spec file for package libreoffice-templates-de
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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/
#


Name:           libreoffice-templates-de
Version:        3.3
Release:        0
Summary:        German Templates for LibreOffice
License:        BSD-4-Clause and LGPL-2.1+
Group:          Productivity/Office/Suite
Url:            http://extensions.services.openoffice.org/project/TemplatePackII
Source0:        ooo-templates-de-2.0.4.tar.bz2
Source1:        ooo-templates-de-suse-2.0.4.tar.bz2
Source2:        Sun_ODF_Template_Pack_de-non-layout.tar.bz2
Provides:       locale(OpenOffice_org:de)
Provides:       locale(libreoffice:de)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
A compilation of German templates for LibreOffice.

%prep
%setup -q -c -b1 -b2
# update the Sun templates dir
sun_name=Sun_ODF_Template_Pack
sun_dir=${sun_name}_de-non-layout
mv $sun_dir/template/groupuinames.xml $sun_dir
mv $sun_dir/LICENSE $sun_dir/LICENSE.$sun_name
# generate README about Sun templates
cat >$sun_dir/README.$sun_name <<EOF
The following list of templates comes from the Sun_ODF_Template_Pack_de.oxt
that is originaly available at
http://extensions.services.openoffice.org/project/TemplatePackII
See LICENSE.$sun_name for more details.
EOF
echo >>$sun_dir/README.$sun_name
find $sun_dir/template -type f | sed "s|$sun_dir/template/||" >>$sun_dir/README.$sun_name

%build

%install
install -m 755 -d %{buildroot}%{_datadir}/templates/libreoffice/
cp -a ooo-templates-de-*/de %{buildroot}%{_datadir}/templates/libreoffice/
cp -a Sun_ODF_Template_Pack_de-non-layout/template/* %{buildroot}%{_datadir}/templates/libreoffice/de
# Convert to ascii names
find %{buildroot}%{_datadir}/templates/libreoffice/ -type f > utf8list
iconv -f UTF-8 -t ASCII//TRANSLIT utf8list > asciilist
for file in $(cat utf8list); do
	newname=$(head -$i asciilist | tail -1 | tr -d '\n')
	if [ -e $newname ] ; then
		rm $file
	else
		mv $file $newname
	fi
done

%files
%defattr(-, root, root)
%doc ooo-templates-de-*/README*.txt Sun*/{README.*,LICENSE.*}
%{_datadir}/templates/

%changelog
openSUSE Build Service is sponsored by