diff --git a/vboxdrv.sh b/vboxdrv.sh index 57da4da..57bed21 100644 --- a/vboxdrv.sh +++ b/vboxdrv.sh @@ -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 diff --git a/virtualbox.changes b/virtualbox.changes index bcb92ca..9515246 100644 --- a/virtualbox.changes +++ b/virtualbox.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Sat Dec 8 18:10:09 UTC 2018 - Hans-Peter Jansen + +- proper permissions for /etc/vbox/*.cfg + +------------------------------------------------------------------- +Sat Dec 8 14:17:50 UTC 2018 - Hans-Peter Jansen + +- 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 diff --git a/virtualbox.spec b/virtualbox.spec index 977b755..d5b0604 100644 --- a/virtualbox.spec +++ b/virtualbox.spec @@ -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)