forked from pool/caddy
Accepting request 1113034 from home:avicenzi:branches:server:http
Switch to sysusers OBS-URL: https://build.opensuse.org/request/show/1113034 OBS-URL: https://build.opensuse.org/package/show/server:http/caddy?expand=0&rev=35
This commit is contained in:
parent
cd383d9776
commit
b5bdf64e5e
@ -1,7 +1,7 @@
|
|||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Sep 21 14:20:37 UTC 2023 - Alexandre Vicenzi <alexandre.vicenzi@suse.com>
|
Thu Sep 21 14:20:37 UTC 2023 - Alexandre Vicenzi <alexandre.vicenzi@suse.com>
|
||||||
|
|
||||||
- Require groupadd and useradd to fix failing build
|
- Switch to sysuser for user setup
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Aug 17 22:55:36 UTC 2023 - jkowalczyk@suse.com
|
Thu Aug 17 22:55:36 UTC 2023 - jkowalczyk@suse.com
|
||||||
|
15
caddy.spec
15
caddy.spec
@ -40,12 +40,13 @@ Source3: caddy.service
|
|||||||
Source4: index.html
|
Source4: index.html
|
||||||
Source5: bash-completion
|
Source5: bash-completion
|
||||||
Source6: zsh-completion
|
Source6: zsh-completion
|
||||||
BuildRequires: /usr/sbin/groupadd
|
Source7: caddy.sysusers
|
||||||
BuildRequires: /usr/sbin/useradd
|
|
||||||
BuildRequires: golang-packaging
|
BuildRequires: golang-packaging
|
||||||
BuildRequires: systemd-rpm-macros
|
BuildRequires: systemd-rpm-macros
|
||||||
|
BuildRequires: sysuser-tools
|
||||||
BuildRequires: golang(API) >= 1.20
|
BuildRequires: golang(API) >= 1.20
|
||||||
%{?systemd_requires}
|
%{?systemd_requires}
|
||||||
|
%{sysusers_requires}
|
||||||
%{go_provides}
|
%{go_provides}
|
||||||
# Make sure that the binary is not getting stripped.
|
# Make sure that the binary is not getting stripped.
|
||||||
%{go_nostrip}
|
%{go_nostrip}
|
||||||
@ -70,6 +71,8 @@ CGO_ENABLED=0
|
|||||||
|
|
||||||
go build -v -buildmode=pie -mod=vendor -ldflags "-s -w" -o caddy cmd/caddy/main.go
|
go build -v -buildmode=pie -mod=vendor -ldflags "-s -w" -o caddy cmd/caddy/main.go
|
||||||
|
|
||||||
|
%sysusers_generate_pre %{SOURCE7} %{name} %{name}.conf
|
||||||
|
|
||||||
%install
|
%install
|
||||||
install -d %{buildroot}/%{_sbindir}
|
install -d %{buildroot}/%{_sbindir}
|
||||||
install -D -p -m 0755 %{name} %{buildroot}%{_bindir}/%{name}
|
install -D -p -m 0755 %{name} %{buildroot}%{_bindir}/%{name}
|
||||||
@ -80,6 +83,7 @@ install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/%{name}/Caddyfile
|
|||||||
# service
|
# service
|
||||||
install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service
|
install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service
|
||||||
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
|
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
|
||||||
|
install -Dpm0644 %{SOURCE7} %{buildroot}%{_sysusersdir}/%{name}.conf
|
||||||
|
|
||||||
# data directory
|
# data directory
|
||||||
install -d -m 0750 %{buildroot}%{_sharedstatedir}/%{name}
|
install -d -m 0750 %{buildroot}%{_sharedstatedir}/%{name}
|
||||||
@ -91,9 +95,7 @@ install -D -p -m 0644 %{SOURCE4} %{buildroot}%{_datadir}/%{name}/index.html
|
|||||||
install -D -p -m 0644 %{SOURCE5} %{buildroot}%{_datadir}/bash-completion/completions/%{name}
|
install -D -p -m 0644 %{SOURCE5} %{buildroot}%{_datadir}/bash-completion/completions/%{name}
|
||||||
install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_datadir}/zsh/site-functions/_%{name}
|
install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_datadir}/zsh/site-functions/_%{name}
|
||||||
|
|
||||||
%pre
|
%pre -f %{name}.pre
|
||||||
getent group %{name} >/dev/null || %{_sbindir}/groupadd -r %{name}
|
|
||||||
getent passwd %{name} >/dev/null || %{_sbindir}/useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s /bin/false -c "Caddy web server" %{name}
|
|
||||||
%service_add_pre %{name}.service
|
%service_add_pre %{name}.service
|
||||||
|
|
||||||
%post
|
%post
|
||||||
@ -111,10 +113,9 @@ getent passwd %{name} >/dev/null || %{_sbindir}/useradd -r -g %{name} -d %{_shar
|
|||||||
%doc AUTHORS README.md
|
%doc AUTHORS README.md
|
||||||
%{_bindir}/%{name}
|
%{_bindir}/%{name}
|
||||||
%{_datadir}/%{name}
|
%{_datadir}/%{name}
|
||||||
|
|
||||||
%{_unitdir}/%{name}.service
|
%{_unitdir}/%{name}.service
|
||||||
%{_sbindir}/rc%{name}
|
%{_sbindir}/rc%{name}
|
||||||
|
%{_sysusersdir}/%{name}.conf
|
||||||
%dir %{_sysconfdir}/%{name}
|
%dir %{_sysconfdir}/%{name}
|
||||||
%config(noreplace) %{_sysconfdir}/%{name}/Caddyfile
|
%config(noreplace) %{_sysconfdir}/%{name}/Caddyfile
|
||||||
%attr(0750,%{name},%{name}) %dir %{_sharedstatedir}/%{name}
|
%attr(0750,%{name},%{name}) %dir %{_sharedstatedir}/%{name}
|
||||||
|
2
caddy.sysusers
Normal file
2
caddy.sysusers
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Type Name ID GECOS [HOME]
|
||||||
|
u caddy - "Caddy web server" /var/lib/caddy
|
Loading…
Reference in New Issue
Block a user