From: Michael Prokop Date: Mon, 11 Jul 2011 15:52:26 +0000 (+0200) Subject: Automatically set up shared folder environment if running in VirtualBox environment. X-Git-Tag: v0.9.32~1 X-Git-Url: http://git.grml.org/?p=grml-autoconfig.git;a=commitdiff_plain;h=a4ecc329533467739c63ede3348cbb25b3d6f94d;ds=sidebyside Automatically set up shared folder environment if running in VirtualBox environment. If the Shared Folder configuration is enabled in the host settings then Grml automatically provides the mountpoint /media/sf_Shared-Folder enabled if running in VirtualBox environment and if virtualbox tools and drivers are present. Acked by: Christian Hofstaedtler --- diff --git a/autoconfig b/autoconfig index 3a01933..b4c48a4 100644 --- a/autoconfig +++ b/autoconfig @@ -101,6 +101,7 @@ CONFIG_TIME='yes' # set clock, check for bootparam utc/gmt [only in CONFIG_TIMEZONE='yes' # get bootparam 'tz' and set it as /etc/localtime [only in live-mode] CONFIG_TOHD='yes' # bootoption tohd=... CONFIG_USERFSTAB='yes' # check for username of uid 1000 +CONFIG_VIRTUALBOX_SHARED_FOLDERS='yes' # set up shared folders in VirtualBox environment CONFIG_VNC='yes' # check for bootparam vnc CONFIG_WELCOME='yes' # play welcome sound (audio) CONFIG_WONDERSHAPER='yes' # start wondershaper with options provided via bootparam diff --git a/autoconfig.functions b/autoconfig.functions index 04f8088..5e7c807 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -2300,6 +2300,45 @@ fi # checkbootparam "BOOT_IMAGE=debian2hd } # }}} +config_virtualbox_shared_folders() { +if [ -r /proc/acpi/battery/BAT0/info ] && grep -q 'OEM info:.*innotek' /proc/acpi/battery/BAT0/info ; then + einfo "VirtualBox detected, trying to set up Shared Folders." + if ! modprobe -l | grep -q vboxsf.ko ; 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 + eend $? + + einfo "Adjusting /dev/vboxguest." + chown root:vboxsf /dev/vboxguest + chmod 660 /dev/vboxguest + eend $? + + if [ -n "$CONFIG_FSTAB_USER" ] ; then + fstabuser="$CONFIG_FSTAB_USER" + else + fstabuser=$(getent passwd 1000 | cut -d: -f1) + fi + einfo "Adding $fstabuser to group vboxsf." + adduser grml vboxsf &>/dev/null + eend $? + + einfo "Starting VBoxService." + VBoxService >/dev/null & + eend $? + + eoutdent + fi +fi +} + # {{{ Support customization config_distri(){ if checkbootparam 'distri'; then diff --git a/grml-autoconfig b/grml-autoconfig index 0952394..b15acb0 100755 --- a/grml-autoconfig +++ b/grml-autoconfig @@ -224,6 +224,8 @@ checkvalue $CONFIG_FIX_UNIONFS && fix_unionfs checkvalue $CONFIG_915RESOLUTION && config_915resolution +checkvalue $CONFIG_VIRTUALBOX_SHARED_FOLDERS && config_virtualbox_shared_folders + checkvalue $CONFIG_MYPATH && config_mypath checkvalue $CONFIG_DISTCC && config_distcc