File 2gis.spec of Package 2gis

#
# spec file for package 2gis
#
# Copyright (c) 2015 SUSE LINUX 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/
#


%define _version_amd64 4.15.2-0trusty1+shv280+r339
%define _version_i586 4.15.2-0trusty1+shv260+r15
%define _name   2GIS
Name:           2gis
Version:        4.15.2~shv280
Release:        0
Summary:        Installer for maps & business listings
License:        SUSE-NonFree
Group:          Productivity/Other
Url:            http://2gis.ru/
Source:         fetch-%{name}.sh.in
Source1:        %{name}-files.list
Source2:        %{name}-rpmlintrc
BuildRequires:  hicolor-icon-theme
Requires:       Mesa-libGL1
Requires:       binutils
Requires:       coreutils
Requires:       curl
Requires:       glibc >= 2.19
Requires:       hicolor-icon-theme
Requires:       libX11-6
Requires:       libX11-xcb1
Requires:       libXau6
Requires:       libXcomposite1 >= 0.3
Requires:       libXdmcp6
Requires:       libXi6 >= 1.2.99.4
Requires:       libXrender1
Requires:       mktemp
Requires:       sed
Requires:       tar
Requires:       xz
Requires(post): permissions
ExclusiveArch:	%ix86 x86_64

%description
2GIS provides 3D-maps of 180+ cities, contacts of 1.5 million
companies, car routing and public transport routes and more!

2GIS is a complete and up-to-date directory of organisations with
detailed cities maps.

2GIS provides verified information only.

This package fetches and installs 2GIS from the official website.

%prep
cp -f %{SOURCE1} %{name}-files.list
sed \
  -e 's|__VERSION__|%{version}|'        \
  -e 's|__RELEASE__|%{release}|'        \
%ifarch %ix86
  -e 's|__ALT_VER__|%{_version_i586}|'  \
  -e 's|__ARCH__|i386|'                 \
%else
  -e 's|__ALT_VER__|%{_version_amd64}|' \
  -e 's|__ARCH__|amd64|'                \
%endif
  -e 's|__NAME__|%{name}|'              \
  %{SOURCE0} > fetch-%{name}.sh.in
# Note: do not use %%{_docdir} and user-defined macros:
# they are not expandable by rpm --eval.
rpm --eval "$(cat fetch-%{name}.sh.in)" > fetch-%{name}.sh

%build
# Nothing to build.

%install
%suse_install_update_script fetch-%{name}.sh

mkdir -p %{buildroot}%{_localstatedir}/adm/update-messages/
touch %{buildroot}%{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release}-1

rpm --eval "$(cat %{name}-files.list)" | while read file; do
    file="$(echo "$file" | sed -e 's/^[^"]*"\(.*\)"$/\1/g')"
    mkdir -p "$(echo -n %{buildroot} && dirname "$file")"
    touch "%{buildroot}$file"
done
chmod a+x %{buildroot}%{_bindir}/%{name}

mkdir -p %{buildroot}%{_localstatedir}/cache/%{_name}/v4/

%pre
%{_sbindir}/groupadd doublegis 2> /dev/null || :

%post
%set_permissions %{_localstatedir}/cache/%{_name}/
%set_permissions %{_localstatedir}/cache/%{_name}/v4/
%icon_theme_cache_post

%postun
%icon_theme_cache_postun

%verifyscript
%verify_permissions -e %{_localstatedir}/cache/%{_name}/
%verify_permissions -e %{_localstatedir}/cache/%{_name}/v4/

%files -f %{name}-files.list
%defattr(-,root,root)
%ghost %dir %{_docdir}/%{name}/
%dir %{_libdir}/%{name}/
%dir %{_libdir}/%{name}/v4/
%dir %{_libdir}/%{name}/v4/lib/
%dir %{_libdir}/%{name}/v4/plugins/
%ghost %dir %{_libdir}/%{name}/v4/plugins/*/
%dir %{_datadir}/%{_name}/
%dir %{_datadir}/%{_name}/v4/
%ghost %dir %{_datadir}/%{_name}/v4/*/
%attr(2775,root,doublegis) %dir %{_localstatedir}/cache/%{_name}/
%ghost %attr(2775,root,doublegis) %dir %{_localstatedir}/cache/%{_name}/v4/
%{_localstatedir}/adm/update-scripts/*
%ghost %{_localstatedir}/adm/update-messages/*

%changelog