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.11.5
Release:       0
Summary:       The Free Software Media System
License:       GPL-2.0-only
Group:         Productivity/Multimedia/Other
URL:           https://jellyfin.org/
%ifarch x86_64
Source0:        %{name}-server-%{version}-amd64.tar.xz
%endif
%ifarch aarch64
Source0:       %{name}-server-%{version}-arm64.tar.xz
%endif
ExclusiveArch: x86_64 aarch64
Source1:       %{name}.conf
Source2:       %{name}.service
Source3:       %{name}-rpmlintrc
BuildRequires: systemd-rpm-macros
Requires:      ffmpeg-7 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
%setup -q -c -T
tar -xf %{S:0}

%build

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

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

#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}

%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/

%changelog
openSUSE Build Service is sponsored by