Accepting request 911064 from devel:kubic

- Don't require systemd (works without, too)

- Change to sysuser-tools to create system user

OBS-URL: https://build.opensuse.org/request/show/911064
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/etcd?expand=0&rev=28
This commit is contained in:
Richard Brown 2021-08-12 07:01:09 +00:00 committed by Git OBS Bridge
commit cc4c1e9917
3 changed files with 21 additions and 5 deletions

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Mon Aug 9 14:22:24 UTC 2021 - Thorsten Kukuk <kukuk@suse.com>
- Don't require systemd (works without, too)
-------------------------------------------------------------------
Sun Aug 8 19:17:44 UTC 2021 - Callum Farmer <gmbr3@opensuse.org>
- Change to sysuser-tools to create system user
-------------------------------------------------------------------
Thu May 13 13:42:05 UTC 2021 - alexandre.vicenzi@suse.com

View File

@ -33,14 +33,15 @@ Source1: vendor.tar.gz
Source11: %{name}.conf
Source12: %{name}.service
Source15: README.security
Source16: system-user-etcd.conf
BuildRequires: golang(API) = 1.14
BuildRequires: golang-packaging
BuildRequires: shadow
BuildRequires: sysuser-tools
BuildRequires: systemd-rpm-macros
BuildRequires: xz
Requires(post): %fillup_prereq
ExcludeArch: s390 %ix86
%{?systemd_requires}
%sysusers_requires
%{go_provides}
# Make sure that the binary is not getting stripped.
%{go_nostrip}
@ -74,6 +75,8 @@ mkdir -p ./bin
go build -v -buildmode=pie -mod=vendor -o ./bin/etcd
go build -v -buildmode=pie -mod=vendor -o ./bin/etcdctl ./etcdctl
%sysusers_generate_pre %{SOURCE16} %{name} system-user-etcd.conf
%install
install -d %{buildroot}/%{_sbindir}
install -D -m 0755 ./bin/etcd %{buildroot}/%{_sbindir}/etcd
@ -95,9 +98,9 @@ echo -e "\n#Enable arm64\nETCD_UNSUPPORTED_ARCH=arm64\n" >> %{buildroot}%{_fillu
# Additional
install -d -m 750 %{buildroot}%{_localstatedir}/lib/%{name}
%pre
getent group %{name} >/dev/null || %{_sbindir}/groupadd -r %{name}
getent passwd %{name} >/dev/null || %{_sbindir}/useradd -r -g %{name} -d %{_localstatedir}/lib/%{name} -s /bin/false -c "etcd daemon" %{name}
install -Dm0644 %{SOURCE16} %{buildroot}%{_sysusersdir}/system-user-etcd.conf
%pre -f %{name}.pre
%service_add_pre %{name}.service
%post
@ -114,6 +117,7 @@ getent passwd %{name} >/dev/null || %{_sbindir}/useradd -r -g %{name} -d %{_loca
%license LICENSE
%doc CONTRIBUTING.md README.md DCO NOTICE README.security
%{_sbindir}/%{name}
%{_sysusersdir}/system-user-etcd.conf
# Service
%{_unitdir}/%{name}.service

2
system-user-etcd.conf Normal file
View File

@ -0,0 +1,2 @@
#Type Name ID GECOS Home directory Shell
u etcd - "etcd daemon" /var/lib/etcd -