The virtualbox shared folders code couldn't be skipped during runtime,
so add support boot option "novboxsf" to skip shared folders setup.
While at it reduce code complexity in config_virtualbox_shared_folders()
(by returning when not running under virtualbox).
Also do not hard code "grml" user to be added to vboxsf group, but rely
on $fstabuser instead.
If VirtualBox (not the guest additions, but the application itself) can
be started on Grml live system, then the /usr/bin/VBox exectuable is
present. The vboxdrv driver might not be loaded yet, take care of it via
vboxdrv.service. Also add user to vboxusers group. To be able to easily
skip it (via boot option "novbox") integrate in grml-autoconfig and not
into systemd presets.
This work was funded by Grml-Forensic.
CONFIG_TIME='yes' # set clock, check for bootparam utc/gmt [only in live-mode]
CONFIG_TIMEZONE='yes' # get bootparam 'tz' and set it as /etc/localtime [only in live-mode]
CONFIG_VIRTUALBOX_SHARED_FOLDERS='yes' # set up shared folders in VirtualBox environment
CONFIG_TIME='yes' # set clock, check for bootparam utc/gmt [only in live-mode]
CONFIG_TIMEZONE='yes' # get bootparam 'tz' and set it as /etc/localtime [only in live-mode]
CONFIG_VIRTUALBOX_SHARED_FOLDERS='yes' # set up shared folders in VirtualBox environment
+CONFIG_VIRTUALBOX_SETUP='yes' # set up VirtuaBox service (iff present)
CONFIG_VNC='yes' # check for bootparam vnc
CONFIG_XSTARTUP='yes' # start X window system via grml-x [only in live-mode]
CONFIG_VNC='yes' # check for bootparam vnc
CONFIG_XSTARTUP='yes' # start X window system via grml-x [only in live-mode]
# {{{ virtualbox shared folders
config_virtualbox_shared_folders() {
# {{{ virtualbox shared folders
config_virtualbox_shared_folders() {
-if $VIRTUALBOX ; then
- einfo "VirtualBox detected, trying to set up Shared Folders."
- if ! modinfo vboxsf &>/dev/null ; then
- ewarn "vboxsf driver not present, not setting up VirtualBox Shared Folders."
- eend 0
- elif ! [ -x /usr/sbin/VBoxService ] ; then
- ewarn "virtualbox-guest-utils not installed, not setting up VirtualBox Shared Folders."
- eend 0
+ if ! $VIRTUALBOX ; then
+ return
+ fi
+
+ if checkbootparam 'novboxsf' ; then
+ ewarn "Skipping VirtualBox Shared Folders setup as requested on boot commandline." ; eend 0
+ einfo "VirtualBox detected, trying to set up Shared Folders."
+ if ! modinfo vboxsf &>/dev/null ; then
+ ewarn "vboxsf driver not present, not setting up VirtualBox Shared Folders."
+ eend 0
+ elif ! [ -x /usr/sbin/VBoxService ] ; then
+ ewarn "virtualbox-guest-utils not installed, not setting up VirtualBox Shared Folders."
+ eend 0
+ else
+ eindent
einfo "Loading vboxsf driver."
lsmod | grep -q vboxsf || modprobe vboxsf
einfo "Loading vboxsf driver."
lsmod | grep -q vboxsf || modprobe vboxsf
- einfo "Adding $fstabuser to group vboxsf."
- adduser grml vboxsf &>/dev/null
+ einfo "Adding user ${fstabuser:-grml} to group vboxsf."
+ adduser "${fstabuser:-grml}" vboxsf >>"${DEBUG}" 2>&1
eend $?
einfo "Starting VBoxService."
eend $?
einfo "Starting VBoxService."
+ eoutdent
+ fi
+ fi
+}
+# }}}
+
+# {{{ VirtualBox application
+config_virtualbox_setup() {
+ if checkbootparam 'novbox' ; then
+ ewarn "Skipping VirtualBox setup as requested on boot commandline." ; eend 0
+ return
+ fi
+
+ if [ -x /usr/bin/VBox ] ; then
+ einfo "VirtualBox service detected, trying to set up."
+ service_wrapper vboxdrv restart >>"${DEBUG}" 2>&1 ; eend $?
+
+ config_userfstab
+
+ einfo "Adding user ${fstabuser:-grml} to group vboxusers."
+ adduser "${fstabuser:-grml}" vboxusers >>"${DEBUG}" 2>&1
+ eend $?
checkvalue $CONFIG_VIRTUALBOX_SHARED_FOLDERS && config_virtualbox_shared_folders
checkvalue $CONFIG_VIRTUALBOX_SHARED_FOLDERS && config_virtualbox_shared_folders
+checkvalue $CONFIG_VIRTUALBOX_SETUP && config_virtualbox_setup
+
checkvalue $CONFIG_MYPATH && config_mypath
checkvalue $CONFIG_DISTRI && config_distri
checkvalue $CONFIG_MYPATH && config_mypath
checkvalue $CONFIG_DISTRI && config_distri