File owncast.spec of Package owncast

#
# spec file for package owncast
#
# 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 _build_id_links none

Name:           owncast
Version:        0.1.3
Release:        1
Summary:        Take control over your live stream by running it yourself
License:        MIT
URL:            https://github.com/owncast/owncast
Source0:        https://github.com/owncast/owncast/releases/download/v%{version}/owncast-%{version}-linux-64bit.zip
Source1:        https://raw.githubusercontent.com/owncast/owncast/develop/LICENSE
Source2:        apache.conf
Source3:        nginx.conf
Source4:        owncast.service
Source5:        sysusers.conf
Source6:        tmpfiles.conf
ExclusiveArch:  x86_64
Conflicts:      owncast owncast-git
BuildRequires:  unzip

%description
Take control over your live stream video by running it yourself. Streaming and chat functionality out of the box.

%prep
unzip -q %{SOURCE0} -d %{_builddir}/owncast-%{version}

%check

%build

%install
install -Dm755 owncast-0.1.3/owncast "$RPM_BUILD_ROOT/usr/lib/owncast/owncast"
install -Dm644 %{SOURCE1} "$RPM_BUILD_ROOT/usr/share/licenses/owncast/LICENSE"
install -Dm644 %{SOURCE4} "$RPM_BUILD_ROOT/usr/lib/systemd/system/owncast.service"
install -Dm644 %{SOURCE2} "$RPM_BUILD_ROOT/usr/share/owncast/example-apache.conf"
install -Dm644 %{SOURCE3} "$RPM_BUILD_ROOT/usr/share/owncast/example-nginx.conf"
install -Dm644 %{SOURCE5} "$RPM_BUILD_ROOT/usr/lib/sysusers.d/owncast.conf"
install -Dm644 %{SOURCE6} "$RPM_BUILD_ROOT/usr/lib/tmpfiles.d/owncast.conf"

install -d "$RPM_BUILD_ROOT/usr/lib"
install -d "$RPM_BUILD_ROOT/usr/bin"
ln -s /usr/lib/owncast/owncast "$RPM_BUILD_ROOT/usr/bin/owncast"

install -d "$RPM_BUILD_ROOT/opt/owncast"
install -d "$RPM_BUILD_ROOT/usr/share/licenses/owncast"
install -d "$RPM_BUILD_ROOT/usr/share/owncast"

%pre
%service_add_pre owncast.service

%post
%service_add_post owncast.service
%tmpfiles_create owncast.conf

%preun
%service_del_preun owncast.service

%postun
%service_del_postun owncast.service

%files
%dir /usr/lib/owncast
%ghost %dir /var/lib/owncast
%ghost %dir /var/lib/owncast/backup
%ghost %dir /var/lib/owncast/webroot
/usr/lib/owncast/owncast
/usr/bin/owncast
/usr/lib/systemd/system/owncast.service
/usr/share/licenses/owncast/
/usr/share/owncast/
/usr/lib/sysusers.d/owncast.conf
/usr/lib/tmpfiles.d/owncast.conf

%changelog
openSUSE Build Service is sponsored by