SHA256
1
0
forked from jengelh/kea

Accepting request 1143824 from network:dhcp

- Generate "keadhcp" user with sysusers mechanism

OBS-URL: https://build.opensuse.org/request/show/1143824
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kea?expand=0&rev=14
This commit is contained in:
Ana Guerrero 2024-02-04 18:09:17 +00:00 committed by Git OBS Bridge
commit 17959d5e83
2 changed files with 15 additions and 10 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Sat Feb 3 12:40:17 UTC 2024 - Jan Engelhardt <jengelh@inai.de>
- Generate "keadhcp" user with sysusers mechanism
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Jan 8 22:21:39 UTC 2024 - Richard Rahl <rrahl0@proton.me> Mon Jan 8 22:21:39 UTC 2024 - Richard Rahl <rrahl0@proton.me>

View File

@ -70,9 +70,10 @@ BuildRequires: postgresql-server-devel
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
BuildRequires: python3 BuildRequires: python3
BuildRequires: python3-Sphinx BuildRequires: python3-Sphinx
BuildRequires: sysuser-tools
BuildRequires: xz BuildRequires: xz
BuildRequires: pkgconfig(libcrypto) BuildRequires: pkgconfig(libcrypto)
Requires(pre): shadow %sysusers_requires
Suggests: %name-hooks = %version Suggests: %name-hooks = %version
%if 0%{with regen_files} %if 0%{with regen_files}
BuildRequires: flex BuildRequires: flex
@ -368,8 +369,7 @@ make %{?_smp_mflags}
b=%buildroot b=%buildroot
%make_install %make_install
find %buildroot -type f -name "*.la" -delete -print find %buildroot -type f -name "*.la" -delete -print
mkdir -p "$b/%_unitdir" "$b/%_prefix/lib/tmpfiles.d" mkdir -p "$b/%_unitdir" "$b/%_tmpfilesdir" "$b/%_sysusersdir"
ls -l "$b/%_unitdir/" "$b/%_prefix/lib/tmpfiles.d/" || :
cat <<-EOF >"$b/%_unitdir/kea.service" cat <<-EOF >"$b/%_unitdir/kea.service"
[Unit] [Unit]
Description=ISC Kea DHCP server Description=ISC Kea DHCP server
@ -386,9 +386,12 @@ cat <<-EOF >"$b/%_unitdir/kea.service"
WantedBy=multi-user.target WantedBy=multi-user.target
Alias=dhcp-server.service Alias=dhcp-server.service
EOF EOF
cat <<-EOF >"$b/%_prefix/lib/tmpfiles.d/kea.conf" cat <<-EOF >"$b/%_tmpfilesdir/kea.conf"
d /run/kea 0775 keadhcp keadhcp - d /run/kea 0775 keadhcp keadhcp -
EOF EOF
echo 'u keadhcp - "Kea DHCP server" /var/lib/kea' >system-user-keadhcp.conf
cp -a system-user-keadhcp.conf "$b/%_sysusersdir/"
%sysusers_generate_pre system-user-keadhcp.conf random system-user-keadhcp.conf
perl -i -pe 's{%_localstatedir/log/kea-}{%_localstatedir/log/kea/}' \ perl -i -pe 's{%_localstatedir/log/kea-}{%_localstatedir/log/kea/}' \
"$b/%_sysconfdir/kea"/*.conf "$b/%_sysconfdir/kea"/*.conf
@ -400,11 +403,7 @@ ln -s "%_sbindir/service" "%buildroot/%_sbindir/rc%name"
find "%buildroot/%_libdir" -name "*.so.*" -type l -delete find "%buildroot/%_libdir" -name "*.so.*" -type l -delete
rm -Rf "%buildroot/%python3_sitelib/kea/__pycache__" rm -Rf "%buildroot/%python3_sitelib/kea/__pycache__"
%pre %pre -f random.pre
getent group keadhcp >/dev/null || groupadd -r keadhcp
getent passwd keadhcp >/dev/null || useradd -r -N -M -g keadhcp \
-s /sbin/nologin -d %_localstatedir/lib/kea -c "Kea DHCP server" \
keadhcp
systemd-tmpfiles --create kea.conf || : systemd-tmpfiles --create kea.conf || :
%service_add_pre kea.service %service_add_pre kea.service
@ -474,7 +473,8 @@ systemd-tmpfiles --create kea.conf || :
%_datadir/kea/ %_datadir/kea/
%_unitdir/*.service %_unitdir/*.service
%dir %_localstatedir/lib/kea %dir %_localstatedir/lib/kea
%_prefix/lib/tmpfiles.d/ %_tmpfilesdir/
%_sysusersdir/
%attr(0775,keadhcp,keadhcp) %_localstatedir/log/kea/ %attr(0775,keadhcp,keadhcp) %_localstatedir/log/kea/
%files doc %files doc