1
0
forked from pool/virtualbox

Accepting request 662706 from home:frispete:kernel

You missed my latest changes...

- proper permissions for /etc/vbox/*.cfg

- remove ambiguous labels in vboxdrv: fixes restart and such
- make autostarting synchronous again
- improve README.autostart
- add new autostart variables to the existing /etc/default/virtualbox
  in %post, if missing

OBS-URL: https://build.opensuse.org/request/show/662706
OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=460
This commit is contained in:
Larry Finger 2019-01-05 01:23:29 +00:00 committed by Git OBS Bridge
parent 35fb819fbd
commit 86ec07d5cd
3 changed files with 48 additions and 18 deletions

View File

@ -210,7 +210,7 @@ cleanup_usb()
rm -rf /dev/vboxusb
}
start()
start_drv()
{
begin_msg "Starting VirtualBox services" console
if [ -d /proc/xen ]; then
@ -267,7 +267,7 @@ start()
succ_msg "VirtualBox services started"
}
stop()
stop_drv()
{
begin_msg "Stopping VirtualBox services" console
@ -314,7 +314,9 @@ if [ -r $VBOXAUTOSTART_CONFIG ]; then
# Extract the user name - the first word on the line
user=$(echo $i | head -n1 | cut -d "." -f1)
# autostop the VMs for that user
begin_msg "Stopping VMs for user $user" console
su - $user -c "/usr/lib/virtualbox/VBoxAutostart --stop --config $VBOXAUTOSTART_CONFIG"
succ_msg "VMs for user $user stopped"
done
fi
IFS=$OLD_IFS
@ -337,13 +339,15 @@ if [ -r $VBOXAUTOSTART_CONFIG ]; then
# Extract the user name - the first word on the line
user=$(echo $i | head -n1 | cut -d "." -f1)
# autostart the VMs for that user
su - $user -c "/usr/lib/virtualbox/VBoxAutostart --background --start --config $VBOXAUTOSTART_CONFIG"
begin_msg "Starting VMs for user $user" console
su - $user -c "/usr/lib/virtualbox/VBoxAutostart --start --config $VBOXAUTOSTART_CONFIG"
succ_msg "VMs for user $user started"
done
fi
IFS=$OLD_IFS
}
cleanup()
cleanup_vb()
{
for i in /lib/modules/*; do
# We could just do "rm -f", but we only want to try deleting folders if
@ -365,7 +369,7 @@ cleanup()
}
# setup_script
setup()
setup_vb()
{
# Try to build the host kernel modules in case prepackaging has failed
/sbin/vboxconfig
@ -405,18 +409,18 @@ dmnstatus()
case "$1" in
start)
start
start_drv
start_vms
;;
stop)
stop_vms
stop
stop_drv
;;
stop_vms)
stop_vms
;;
restart)
stop && start
"$0" stop && "$0" start
;;
setup)
# Create udev rule and USB device nodes.
@ -425,17 +429,17 @@ setup)
## todo Do we need a udev rule to create /dev/vboxdrv[u] at all? We have
## working fall-back code here anyway, and the "right" code is more complex
## than the fall-back. Unnecessary duplication?
stop && cleanup
stop_drv && cleanup_vb
setup_usb "$GROUP" "$DEVICE_MODE" "$INSTALL_DIR"
setup && start
setup_vb && start_drv
;;
cleanup)
stop && cleanup
stop_drv && cleanup_vb
cleanup_usb
;;
force-reload)
stop
start
"$0" stop
"$0" start
;;
status)
dmnstatus

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Sat Dec 8 18:10:09 UTC 2018 - Hans-Peter Jansen <hpj@urpla.net>
- proper permissions for /etc/vbox/*.cfg
-------------------------------------------------------------------
Sat Dec 8 14:17:50 UTC 2018 - Hans-Peter Jansen <hpj@urpla.net>
- remove ambiguous labels in vboxdrv: fixes restart and such
- make autostarting synchronous again
- improve README.autostart
- add new autostart variables to the existing /etc/default/virtualbox
in %post, if missing
-------------------------------------------------------------------
Wed Dec 5 12:10:20 UTC 2018 - Hans-Peter Jansen <hpj@urpla.net>

View File

@ -1,7 +1,7 @@
#
# spec file for package virtualbox
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -800,6 +800,18 @@ getent group vboxsf >/dev/null || groupadd -r vboxsf
%set_permissions %{_vbox_instdir}/VBoxNetAdpCtl
%set_permissions %{_vbox_instdir}/VBoxHeadless
%service_add_post vboxdrv.service
# add new autostart stuff to the existing default config, if missing
grep -q VBOXAUTOSTART /etc/default/virtualbox || {
cat >> /etc/default/virtualbox << EOF
#
# -------------------------------------------------------------------------------------------------
# Autostart
# -------------------------------------------------------------------------------------------------
VBOXAUTOSTART_DB=/etc/vbox
VBOXAUTOSTART_CONFIG=/etc/vbox/autostart.cfg
EOF
}
%post qt
%set_permissions %{_vbox_instdir}/VirtualBox
@ -928,16 +940,16 @@ export DISABLE_RESTART_ON_UPDATE=yes
%{_unitdir}/vboxdrv.service
%{_unitdir}/multi-user.target.wants/vboxdrv.service
%{_sbindir}/rcvboxdrv
%dir %{_sysconfdir}/vbox
%attr(1775,root,vboxusers) %{_sysconfdir}/vbox
%config %{_sysconfdir}/vbox/vbox.cfg
%config %{_sysconfdir}/vbox/autostart.cfg
/sbin/vboxconfig
%{_vbox_instdir}/VBoxCreateUSBNode.sh
%verify(not mode) %attr(0755,root,vboxusers) %{_vbox_instdir}/VBoxNetNAT
%verify(not mode) %attr(4750,root,vboxusers) %{_vbox_instdir}/VBoxNetDHCP
%verify(not mode) %attr(4750,root,vboxusers) %{_vbox_instdir}/VBoxNetAdpCtl
%verify(not mode) %attr(4750,root,vboxusers) %{_vbox_instdir}/VBoxHeadless
%dir %{_sysconfdir}/vbox
%attr(1775,root,vboxusers) %{_sysconfdir}/vbox
%config %attr(644,root,vboxusers) %{_sysconfdir}/vbox/vbox.cfg
%config %attr(644,root,vboxusers) %{_sysconfdir}/vbox/autostart.cfg
%files qt
%defattr(-, root, root)