From 65d4b3fa3bba8a3ee12e39c2d292a669390d08fb0244441e5c2d97bf59dd3113 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Fri, 22 Sep 2023 16:51:10 +0000 Subject: [PATCH] Accepting request 1112996 from home:gmbr3:Active - Convert to systemd-sysusers OBS-URL: https://build.opensuse.org/request/show/1112996 OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=710 --- virtualbox.changes | 5 +++++ virtualbox.spec | 39 +++++++++++++++++++++++++++++---------- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/virtualbox.changes b/virtualbox.changes index edfc9fe..ab0a6f8 100644 --- a/virtualbox.changes +++ b/virtualbox.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Sep 22 12:19:15 UTC 2023 - Callum Farmer + +- Convert to systemd-sysusers + ------------------------------------------------------------------- Wed Sep 20 22:06:33 UTC 2023 - Larry Finger diff --git a/virtualbox.spec b/virtualbox.spec index b91b55e..2658d90 100644 --- a/virtualbox.spec +++ b/virtualbox.spec @@ -217,6 +217,7 @@ BuildRequires: python3-devel BuildRequires: rpm BuildRequires: sed BuildRequires: systemd-rpm-macros +BuildRequires: sysuser-tools BuildRequires: update-desktop-files BuildRequires: which BuildRequires: xorg-x11-server @@ -247,7 +248,6 @@ BuildRequires: pkgconfig(xrandr) Requires: %{name}-kmp = %{version} Requires(pre): %fillup_prereq Requires(pre): permissions -Requires(pre): shadow Recommends: %{name}-gui = %{version} # package i4l-vbox from source package i4l-base shares the directory /etc/vbox # with us, but with different owner. @@ -256,6 +256,7 @@ Conflicts: i4l-vbox Provides: %{name}-ose = %{version} Obsoletes: %{name}-ose < %{version} %{?systemd_ordering} +%{?sysusers_requires} %if 0%{?suse_version} > 1325 BuildRequires: libboost_headers-devel %else @@ -337,6 +338,7 @@ Obsoletes: xorg-x11-driver-virtualbox-ose < %{version} %if ! 0%{?suse_version} > 1325 Requires(pre): net-tools-deprecated %endif +%{?sysusers_requires} %description guest-tools VirtualBox guest addition tools. @@ -530,6 +532,23 @@ echo "build VNC extension pack" sed -i 's/tar /tar --format=gnu /' src/VBox/ExtPacks/VNC/Makefile.kmk kmk -C src/VBox/ExtPacks/VNC packing +###################################################### +# system users and groups +cat >> vbox.conf << EOF +g vboxusers - - - - +EOF + +cat >> vbox-guest-tools.conf << EOF +g vboxguest - - - - +g vboxsf - - - - +%if 0%{?suse_version} <= 1500 +g vboxvideo - - - - +%endif +EOF + +%sysusers_generate_pre vbox.conf vbox vbox.conf +%sysusers_generate_pre vbox-guest-tools.conf vbox-guest-tools vbox-guest-tools.conf + %install ################################# echo "create directory structure" @@ -735,6 +754,11 @@ done popd # ###################################################### +# system users and groups + +install -Dm0644 vbox.conf %{buildroot}%{_sysusersdir}/vbox.conf +install -Dm0644 vbox-guest-tools.conf %{buildroot}%{_sysusersdir}/vbox-guest-tools.conf +###################################################### # run fdupes ###################################################### #run fdupes because we lost link for virtualbox/components directory @@ -750,18 +774,11 @@ popd # scriptlets - pre ###################################################### -%pre -getent group vboxusers >/dev/null || groupadd -r vboxusers +%pre -f vbox.pre %service_add_pre vboxdrv.service %service_add_pre vboxautostart-service.service -%pre guest-tools -# Add groups for seamless mode and shared folders: -getent group vboxguest >/dev/null || groupadd -r vboxguest -getent group vboxsf >/dev/null || groupadd -r vboxsf -%if 0%{?suse_version} <= 1500 -getent group vboxvideo >/dev/null || groupadd -r vboxvideo -%endif +%pre guest-tools -f vbox-guest-tools.pre %service_add_pre vboxadd-service.service %pre websrv @@ -940,6 +957,7 @@ export DISABLE_RESTART_ON_UPDATE=yes %{_unitdir}/multi-user.target.wants/vboxweb-service.service %{_unitdir}/multi-user.target.wants/vboxdrv.service %{_unitdir}/multi-user.target.wants/vboxautostart-service.service +%{_sysusersdir}/vbox.conf %{_sbindir}/rcvboxdrv %{_sbindir}/rcvboxautostart %{_sbindir}/vboxconfig @@ -1006,6 +1024,7 @@ export DISABLE_RESTART_ON_UPDATE=yes %{_sysconfdir}/X11/xinit/xinitrc.d/98vboxadd-xclient %{_unitdir}/vboxclient.service %{_unitdir}/vboxservice.service +%{_sysusersdir}/vbox-guest-tools.conf %dir %{_sysconfdir}/xdg %dir %{_sysconfdir}/xdg/autostart %{_sysconfdir}/xdg/autostart/vboxclient.desktop