File ICAClient.spec of Package ICAClient

#
# spec file for package ICAClient
#
# Copyright (c) 2020 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%define arch \\(64bit\\)
%define lib1 libgst[a-z]*\\-0\\.10\\.so\\.0\\(\\)%arch$
%define lib2 libjavascriptcoregtk\\-1\\.0\\.so\\.0\\(\\)%arch$
%define lib3 libwebkitgtk\\-1\\.0\\.so\\.0\\(\\)%arch$
%define lib4 libcrypto\\.so\\.1\\.0\\.0\\(OPENSSL_1\\.0\\.1[a-z]?\\)%arch$

%global __requires_exclude (%lib1|%lib2|%lib3|%lib4)

Name:           ICAClient
Summary:        Citrix Client Full Package
Version:        20.10.0.6
Release:        0
Url:            https://www.citrix.de/downloads/workspace-app/linux/workspace-app-for-linux-latest.html
Source1:        %{name}-suse-%{version}-0.x86_64.rpm
Source2:        configmgr.desktop
Source3:        conncenter.desktop
Source4:        new_store.desktop
Source5:        selfservice.desktop
Source6:        wfica.desktop
Source7:        T-Telesec_GlobalRoot_Class_2.cer
Source8:        T-Telesec_GlobalRoot_Class_3.cer
Source9:        ctxlog.service
License:        SUSE-NonFree
Group:          Productivity/Networking/Other
BuildRequires:  -brp-check-suse
BuildRequires:  build
BuildRequires:  fdupes
BuildRequires:  shared-mime-info
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(systemd)
ExclusiveArch:  x86_64
%{?systemd_ordering}

%description
Receiver for Linux enables users to access virtual desktops and hosted applications
delivered by XenDesktop and XenApp from devices running the Linux operating system.
Receiver for Linux is available in English, German, Spanish, French, Japanese,
Simplified Chinese and Russian.

%prep

%build

%install
cd %{buildroot}
unrpm %{S:1}

mkdir -p .%{_libexecdir}
mv -f opt/Citrix/%{name} .%{_libexecdir}/
rm -rf opt
rm -rf .%{_libexecdir}/%{name}/PKCS#11
mkdir -p .%{_datadir}/mime
mv .%{_libexecdir}/%{name}/desktop .%{_datadir}/mime/packages
ln -sf %{_libexecdir}/%{name}/util/integrate.sh .%{_libexecdir}/%{name}/util/disintegrate.sh
mkdir -p .%{_datadir}/applications
install -m 644 %{S:2} %{S:3} %{S:4} %{S:5} %{S:6} .%{_datadir}/applications/
sed -i -e 's|LIBDIR|%{_libexecdir}|g' .%{_datadir}/applications/*.desktop
install -m 444 %{S:7} %{S:8} .%{_libexecdir}/%{name}/keystore/cacerts/
mkdir -p .%{_sbindir}
install -D -m 644 %{S:9} .%{_unitdir}/ctxlog.service
ln -sf service .%{_sbindir}/rcctxlog
rm -rf .%{_sysconfdir}

%suse_update_desktop_file configmgr
%suse_update_desktop_file conncenter
%suse_update_desktop_file new_store
%suse_update_desktop_file selfservice
%suse_update_desktop_file wfica

%fdupes -s %{buildroot}

%pre
%service_add_pre ctxlog.service

%post
%service_add_post ctxlog.service
if [ "$1" -eq 1 ];
  then
    mkdir -p %{_sysconfdir}/icalicense
    %{_libexecdir}/%{name}/util/echo_cmd -l >%{_sysconfdir}/icalicense/clientlicense
    chmod 444 %{_sysconfdir}/icalicense/clientlicense
    chmod 555 %{_sysconfdir}/icalicense
    lang=`echo $LANG | cut -c1-2`
    if [ ! -d %{_libexecdir}/%{name}/nls/$lang ]
      then
        lang=en
    fi
    if [ `echo ${LANG: -5}` = "UTF-8" ]
      then
        ln -sf %{_libexecdir}/%{name}/nls/$lang.UTF-8/eula.txt %{_libexecdir}/%{name}/eula.txt
      else
        ln -sf %{_libexecdir}/%{name}/nls/$lang/eula.txt %{_libexecdir}/%{name}/eula.txt
    fi
    ln -sf %{_libexecdir}/%{name}/nls/$lang/appsrv.template %{_libexecdir}/%{name}/config/appsrv.ini
    ln -sf %{_libexecdir}/%{name}/nls/$lang/module.ini %{_libexecdir}/%{name}/config/module.ini
    ln -sf %{_libexecdir}/%{name}/nls/$lang/wfclient.template %{_libexecdir}/%{name}/config/wfclient.ini
fi

%preun
%service_del_preun ctxlog.service
if [ "$1" -eq 0 ];
  then
    rm -rf %{_sysconfdir}/icalicense
    rm -rf %{_libexecdir}/%{name}/eula.txt
    rm -rf %{_libexecdir}/%{name}/config/appsrv.ini
    rm -rf %{_libexecdir}/%{name}/config/module.ini
    rm -rf %{_libexecdir}/%{name}/config/wfclient.ini
fi

%postun
%service_del_postun ctxlog.service

%files
%{_libexecdir}/%{name}
%{_datadir}/applications/*.desktop
%{_datadir}/mime/packages/Citrix-mime_types.xml
%{_unitdir}/ctxlog.service
%{_sbindir}/rcctxlog

%changelog
openSUSE Build Service is sponsored by