File zotero.spec of Package zotero

#
# spec file for package zotero
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2025 Tejas Guruswamy <tejas.guruswamy@opensuse.org>
#
# 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/
#


Name:           zotero
Version:        7.0.11
Release:        0
Summary:        Tool to help collect, organize, cite, and share research sources
License:        AGPL-3.0-only
Group:          Productivity/Office/Organizers
URL:            https://www.zotero.org
Source:         https://download.zotero.org/client/release/%{version}/Zotero-%{version}_linux-x86_64.tar.bz2
BuildRequires:  desktop-file-utils
Requires:       /bin/bash
Provides:       application(zotero.desktop)
Provides:       mimehandler(text/plain)
ExclusiveArch:  x86_64

%description
Zotero is a free, easy-to-use tool to help you collect, organize, cite, and share your research sources.

%define source_dir Zotero_linux-x86_64

%prep
%setup -q -cn %{source_dir}
# Disable APP update
mkdir -p %{source_dir}/defaults/pref
cat <<EOF > %{source_dir}/defaults/pref/autoconfig.js
pref("general.config.filename", "firefox.cfg");
pref("general.config.obscure_value", 0);
EOF

cat <<EOF > %{source_dir}/firefox.cfg
// Start code on the 2nd line
lockPref("app.update.auto", false);
EOF

%build

%install
mkdir -p %{buildroot}/%{_bindir} %{buildroot}/%{_datadir}/applications %{buildroot}/%{_libexecdir}

cp -r %{source_dir}/ %{buildroot}/%{_libexecdir}/%{name}
ln -s ../../%{_libexecdir}/%{name}/%{name} %{buildroot}/%{_bindir}/%{name}
# .desktop
sed -i 's#^Exec=.*#Exec=%{_bindir}/zotero -url "\%U"#; s#^Icon=.*#Icon=%{_libexecdir}/zotero/icons/icon128.png#' %{buildroot}/%{_libexecdir}/%{name}/%{name}.desktop
desktop-file-install --dir %{buildroot}%{_datadir}/applications %{buildroot}/%{_libexecdir}/%{name}/%{name}.desktop

%files
%{_bindir}/%{name}
%{_libexecdir}/%{name}
%{_datadir}/applications/%{name}.desktop

%changelog
openSUSE Build Service is sponsored by