File deezer.spec of Package deezer

#
# spec file for package pegasus-frontend
#
# Copyright (c) 2023 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 realname deezer-linux
%define realver  6.0.150-1
%define srcext   tar.gz

Name: deezer
Version: 6.0.150
Release: 1
Url: https://github.com/Jonatas-Goncalves/deezer-linux
Summary: Unofficial Deezer desktop client
Group: System/GUI/KDE
BuildArch:  noarch
BuildRequires: desktop-file-utils
BuildRequires: update-desktop-files
BuildRequires: hicolor-icon-theme
BuildRequires: -post-build-checks
BuildRequires: unzip
Requires: nodejs16
Requires: npm16
Requires: nodejs-common
License: MIT
Source0: %{realname}-%{realver}.%{srcext}
BuildRoot: %{_tmppath}/%{name}-%{version}-1-build

%description
For Windows, Deezer distributes a version of the Electron run time (Windows binary) and the source code of their application itself. The build process of this package extracts the application source from the Windows installer.

This package applies several patches for:

- Compatibility with newer Electron versions
- Compatibility with a Linux environment in general.
- Fixing bugs

%prep

%check

%build

%install
mkdir -p %{buildroot}/usr/share/%{name}/
cp -f %{SOURCE0} %{buildroot}/usr/share/%{name}/%{realname}-%{realver}.%{srcext}

%post
if test -e /usr/share/%{name}/%{realname}-%{realver}.%{srcext} ; then
	tar xf /usr/share/%{name}/%{realname}-%{realver}.%{srcext} -C /
    rm -f "/usr/share/%{name}/%{realname}-%{realver}.%{srcext}"
fi

sudo npm install -g electron@^6 --unsafe-perm=true
sudo npm install -g --engine-strict asar
sudo npm install -g prettier

sudo update-desktop-database --quiet

%preun
if [ "$1" = 0 ]; then
  rm -f "/usr/bin/%{name}"
  rm -r "/usr/share/applications/%{name}.desktop"
  rm -f "/usr/share/pixmaps/%{name}.png"
fi

%files
%defattr(-,root,root)
/usr/share/%{name}
/usr/share/%{name}/%{realname}-%{realver}.%{srcext}

%changelog
openSUSE Build Service is sponsored by