File jellyfin.spec of Package jellyfin-server-bin

#
# spec file for package jellyfin
#
# Copyright (c) 2021 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/
#


Name:           jellyfin
Version:        10.10.7
Release:        0
Summary:        The Free Software Media System
License:        GPL-2.0-only
Group:          Productivity/Multimedia/Other
URL:            https://jellyfin.org/
Source0:        %{name}-server-%{version}.tar.gz
Source1:        %{name}.conf
Source2:        %{name}.service
Source3:        %{name}.desktop
Source4:        %{name}-rpmlintrc
BuildRequires:  systemd-rpm-macros
BuildRequires:  fdupes
BuildRequires:  libbpf1
Requires:       jellyfin-ffmpeg jellyfin-web xdg-utils libbpf1

%description
Jellyfin is the volunteer-built media solution that puts you in control of your media. Stream to any device from your own server, with no strings attached. Your media, your server, your way.

%prep

%build
#Unpack source
tar xvf %{S:0}

%install
#Configuration file
install -D %{S:1} %{buildroot}/etc/%{name}.conf

#Systemd service
install -D -m 0644 %{S:2} %{buildroot}%{_unitdir}/%{name}.service

#Desktop
install -D -m 0644 %{S:3} %{buildroot}/%{_datadir}/applications/%{name}.desktop

#Create application
install -d %{buildroot}/opt
mv %{name}/ %{buildroot}/opt/%{name}

#Create configuration directories
install -d %{buildroot}/opt/%{name}/{data,cache,config,log}

#Create symlink to /var/log
install -d %{buildroot}/%{_localstatedir}/log
ln -sf /opt/%{name}/log %{buildroot}/%{_localstatedir}/log/%{name}

%fdupes %{buildroot}

%pre
%service_add_pre %{name}.service

%post
%service_add_post %{name}.service

%preun
%service_del_preun %{name}.service

%postun
%service_del_postun %{name}.service

%files
/opt/%{name}
%config(noreplace) /etc/%{name}.conf
%{_unitdir}/*
%{_localstatedir}/log/
%{_datadir}/*

%changelog
openSUSE Build Service is sponsored by