2021-05-05 11:08:17 +02:00
|
|
|
#
|
|
|
|
# spec file for package caddy
|
|
|
|
#
|
2024-02-05 15:30:55 +01:00
|
|
|
# Copyright (c) 2024 SUSE LLC
|
2021-05-05 11:08:17 +02:00
|
|
|
#
|
|
|
|
# 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/
|
|
|
|
#
|
|
|
|
|
2021-09-02 16:38:26 +02:00
|
|
|
|
2023-05-02 10:12:23 +02:00
|
|
|
# SLE-12 _sharedstatedir was /usr/com, _localstatedir is /var as expected
|
|
|
|
# SLE-15+ _sharedstatedir is /var/lib, _localstatedir is /var
|
|
|
|
# _sharedstatedir used here as home directory for newly created user caddy
|
|
|
|
# If not redefined build fails with empty /usr/com not owned by any package
|
|
|
|
%if 0%{?suse_version} < 1500
|
|
|
|
%define _sharedstatedir /var/lib
|
|
|
|
%endif
|
|
|
|
|
2021-05-05 11:08:17 +02:00
|
|
|
Name: caddy
|
2024-05-31 14:27:45 +02:00
|
|
|
Version: 2.8.1
|
2021-05-05 11:08:17 +02:00
|
|
|
Release: 0
|
2021-10-22 15:15:00 +02:00
|
|
|
Summary: Fast, multi-platform web server with automatic HTTPS
|
2021-05-05 11:08:17 +02:00
|
|
|
License: Apache-2.0
|
|
|
|
Group: Productivity/Networking/Web/Proxy
|
|
|
|
URL: https://caddyserver.com/
|
|
|
|
Source0: %{name}-%{version}.tar.gz
|
|
|
|
Source1: vendor.tar.gz
|
|
|
|
Source2: Caddyfile
|
|
|
|
Source3: caddy.service
|
|
|
|
Source4: index.html
|
|
|
|
Source5: bash-completion
|
2022-05-23 10:58:48 +02:00
|
|
|
Source6: zsh-completion
|
2023-09-22 16:48:31 +02:00
|
|
|
Source7: caddy.sysusers
|
2021-05-05 11:08:17 +02:00
|
|
|
BuildRequires: systemd-rpm-macros
|
2023-09-22 16:48:31 +02:00
|
|
|
BuildRequires: sysuser-tools
|
2024-05-31 14:27:45 +02:00
|
|
|
BuildRequires: golang(API) >= 1.21
|
2021-05-05 11:08:17 +02:00
|
|
|
%{?systemd_requires}
|
2023-09-22 16:48:31 +02:00
|
|
|
%{sysusers_requires}
|
2021-05-05 11:08:17 +02:00
|
|
|
|
|
|
|
%description
|
|
|
|
Caddy is a powerful, extensible platform to serve your sites, services, and
|
|
|
|
apps, written in Go.
|
|
|
|
|
|
|
|
It operates primarily at L4 (transport layer) and L7 (application layer) of
|
|
|
|
the OSI model, though it has the ability to work with other layers.
|
|
|
|
|
|
|
|
%prep
|
2024-02-06 16:10:28 +01:00
|
|
|
%autosetup -a 1
|
2021-05-05 11:08:17 +02:00
|
|
|
|
|
|
|
%build
|
2024-02-06 16:10:28 +01:00
|
|
|
# Build the binary.
|
|
|
|
%ifnarch ppc64
|
|
|
|
export GOFLAGS="-buildmode=pie"
|
|
|
|
%endif
|
|
|
|
go build ./cmd/%{name}
|
2021-05-05 11:08:17 +02:00
|
|
|
|
2024-02-06 16:10:28 +01:00
|
|
|
%check
|
|
|
|
# execute the binary as a basic check
|
|
|
|
./%{name} --help
|
2021-05-05 11:08:17 +02:00
|
|
|
|
|
|
|
%install
|
|
|
|
install -d %{buildroot}/%{_sbindir}
|
|
|
|
install -D -p -m 0755 %{name} %{buildroot}%{_bindir}/%{name}
|
|
|
|
|
|
|
|
# configuration
|
|
|
|
install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/%{name}/Caddyfile
|
|
|
|
|
|
|
|
# service
|
|
|
|
install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service
|
|
|
|
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
|
2023-09-22 16:48:31 +02:00
|
|
|
install -Dpm0644 %{SOURCE7} %{buildroot}%{_sysusersdir}/%{name}.conf
|
2021-05-05 11:08:17 +02:00
|
|
|
|
|
|
|
# data directory
|
|
|
|
install -d -m 0750 %{buildroot}%{_sharedstatedir}/%{name}
|
|
|
|
|
|
|
|
# welcome page
|
|
|
|
install -D -p -m 0644 %{SOURCE4} %{buildroot}%{_datadir}/%{name}/index.html
|
|
|
|
|
|
|
|
# bash completion
|
|
|
|
install -D -p -m 0644 %{SOURCE5} %{buildroot}%{_datadir}/bash-completion/completions/%{name}
|
|
|
|
install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_datadir}/zsh/site-functions/_%{name}
|
|
|
|
|
2024-04-01 15:01:38 +02:00
|
|
|
%sysusers_generate_pre %{SOURCE7} %{name} %{name}.conf
|
|
|
|
|
2023-09-22 16:48:31 +02:00
|
|
|
%pre -f %{name}.pre
|
2021-05-05 11:08:17 +02:00
|
|
|
%service_add_pre %{name}.service
|
|
|
|
|
|
|
|
%post
|
|
|
|
%service_add_post %{name}.service
|
|
|
|
%{fillup_only -n %{name}}
|
|
|
|
|
|
|
|
%preun
|
|
|
|
%service_del_preun %{name}.service
|
|
|
|
|
|
|
|
%postun
|
|
|
|
%service_del_postun %{name}.service
|
|
|
|
|
|
|
|
%files
|
|
|
|
%license LICENSE
|
|
|
|
%doc AUTHORS README.md
|
|
|
|
%{_bindir}/%{name}
|
|
|
|
%{_datadir}/%{name}
|
|
|
|
%{_unitdir}/%{name}.service
|
|
|
|
%{_sbindir}/rc%{name}
|
2023-09-22 16:48:31 +02:00
|
|
|
%{_sysusersdir}/%{name}.conf
|
2021-05-05 11:08:17 +02:00
|
|
|
%dir %{_sysconfdir}/%{name}
|
|
|
|
%config(noreplace) %{_sysconfdir}/%{name}/Caddyfile
|
2024-02-06 16:10:28 +01:00
|
|
|
%dir %attr(0750, %{name}, %{name}) %{_sharedstatedir}/%{name}
|
2021-05-05 11:08:17 +02:00
|
|
|
# filesystem owns all the parent directories here
|
|
|
|
%{_datadir}/bash-completion/completions/%{name}
|
|
|
|
# own parent directories in case zsh is not installed
|
|
|
|
%dir %{_datadir}/zsh
|
|
|
|
%dir %{_datadir}/zsh/site-functions
|
|
|
|
%{_datadir}/zsh/site-functions/_%{name}
|
|
|
|
|
|
|
|
%changelog
|