diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-03-26 19:21:20 +0000 |
---|---|---|
committer | <> | 2014-05-08 15:03:54 +0000 |
commit | fb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch) | |
tree | c2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Additions/linux/installer | |
parent | 58ed4748338f9466599adfc8a9171280ed99e23f (diff) | |
download | VirtualBox-master.tar.gz |
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Additions/linux/installer')
-rw-r--r-- | src/VBox/Additions/linux/installer/deffiles | 2 | ||||
-rw-r--r-- | src/VBox/Additions/linux/installer/module-autologon.sh | 169 | ||||
-rwxr-xr-x | src/VBox/Additions/linux/installer/vboxadd-service.sh | 2 | ||||
-rwxr-xr-x | src/VBox/Additions/linux/installer/vboxadd-x11.sh | 112 | ||||
-rwxr-xr-x | src/VBox/Additions/linux/installer/vboxadd.sh | 16 |
5 files changed, 252 insertions, 49 deletions
diff --git a/src/VBox/Additions/linux/installer/deffiles b/src/VBox/Additions/linux/installer/deffiles index 074ab224..02d54663 100644 --- a/src/VBox/Additions/linux/installer/deffiles +++ b/src/VBox/Additions/linux/installer/deffiles @@ -25,6 +25,7 @@ DEFAULT_FILE_NAMES=" \ /usr/bin/vboxadd-xclient \ /usr/bin/VBoxClient \ /usr/bin/VBoxControl \ + /usr/sbin/vbox-greeter \ /usr/sbin/vboxadd-timesync \ /usr/sbin/vboxadd-service \ /usr/sbin/VBoxService \ @@ -43,6 +44,7 @@ DEFAULT_FILE_NAMES=" \ /usr/lib64/VBoxOGLpassthroughspu.so \ /usr/lib/VBoxOGL.so \ /usr/lib64/VBoxOGL.so \ + /usr/share/xgreeters/vbox-greeter.desktop \ /etc/X11/Xsession.d/98vboxadd-xclient \ /etc/X11/xinit.d/98vboxadd-xclient \ /etc/X11/xinit/xinitrc.d/98vboxadd-xclient.sh \ diff --git a/src/VBox/Additions/linux/installer/module-autologon.sh b/src/VBox/Additions/linux/installer/module-autologon.sh new file mode 100644 index 00000000..f7262f33 --- /dev/null +++ b/src/VBox/Additions/linux/installer/module-autologon.sh @@ -0,0 +1,169 @@ +# Oracle VM VirtualBox +# VirtualBox Linux Guest Additions installer - autologon module +# + +# Copyright (C) 2012 Oracle Corporation +# +# This file is part of VirtualBox Open Source Edition (OSE), as +# available from http://www.virtualbox.org. This file is free software; +# you can redistribute it and/or modify it under the terms of the GNU +# General Public License (GPL) as published by the Free Software +# Foundation, in version 2 as it comes in the "COPYING" file of the +# VirtualBox OSE distribution. VirtualBox OSE is distributed in the +# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. +# + +# @todo Document functions and their usage! + +MOD_AUTOLOGON_DEFAULT_LIGHTDM_CONFIG="/etc/lightdm/lightdm.conf" +MOD_AUTOLOGON_DEFAULT_LIGHTDM_GREETER_DIR="/usr/share/xgreeters" + +mod_autologon_init() +{ + echo "Initializing auto-logon support ..." + return 0 +} + +mod_autologon_install_ex() +{ + info "Installing auto-logon support ..." + + ## Parameters: + # Greeter directory. Defaults to /usr/share/xgreeters. + greeter_dir="$1" + # LightDM config. Defaults to /etc/lightdm/lightdm.conf. + lightdm_config="$2" + # Whether to force installation if non-compatible distribution + # is detected. + force="$3" + + # Check for Ubuntu and derivates. @todo Debian? + distros="Ubuntu UbuntuStudio Edubuntu Kubuntu Lubuntu Mythbuntu Xubuntu" + ## @todo Map Linux Mint versions to Ubuntu ones. + + ## @todo Move the distro check to a routine / globals as soon as + ## we have other distribution-dependent stuff. + which lsb_release &>/dev/null + if test "$?" -ne "0"; then + info "Error: lsb_release not found (path set?), skipping auto-logon installation" + return 1 + fi + distro_name=$(lsb_release -si) + distro_ver=$(lsb_release -sr) + + for distro_cur in ${distros}; do + if test "$distro_name" = "$distro_cur"; then + distro_found="true" + break + fi + done + + if test -z "$distro_found"; then + if ! test "$force" = "force"; then + info "Error: Unsupported distribution \"$distro_name\" found, skipping auto-logon installation" + return 1 + fi + info "Warning: Unsupported distribution \"$distro_name\" found" + else + # Do we have Ubuntu 11.10 or greater? + # Use AWK for comparison since we run on plan sh. + echo | awk 'END { exit ( !('"$distro_ver >= 11.10"') ); }' + if test "$?" -ne "0"; then + if ! test "$force" = "force"; then + info "Error: Version $distro_ver of \"$distro_name\" not supported, skipping auto-logon installation" + return 1 + fi + info "Warning: Unsupported \"$distro_name\" version $distro_ver found" + fi + fi + + # Install dependencies (lightdm and FLTK 1.3+) using apt-get. + which apt-get &>/dev/null + if test "$?" -ne "0"; then + info "Error: apt-get not found (path set?), skipping auto-logon installation" + return 1 + fi + info "Checking and installing necessary dependencies ..." + apt-get -qqq -y install libfltk1.3 libfltk-images1.3 || return 1 + apt-get -qqq -y install lightdm || return 1 + + # Check for LightDM config. + if ! test -f "$lightdm_config"; then + info "Error: LightDM config \"$lightdm_config\" not found (LightDM installed?), skipping auto-logon installation" + return 1 + fi + + # Check for /usr/share/xgreeters. + if ! test -d "$greeter_dir"; then + if ! test "$force" = "force"; then + info "Error: Directory \"$greeter_dir\" does not exist, skipping auto-logon installation" + return 1 + fi + info "Warning: Directory \"$greeter_dir\" does not exist, creating it" + mkdir -p -m 755 "$greeter_dir" || return 1 + fi + + # Link to required greeter files into $greeter_dir. + add_symlink "$INSTALLATION_DIR/share/VBoxGuestAdditions/vbox-greeter.desktop" "$greeter_dir/vbox-greeter.desktop" + + # Backup and activate greeter config. + if ! test -f "$lightdm_config.vbox-backup"; then + info "Backing up LightDM configuration file ..." + cp "$lightdm_config" "$lightdm_config.vbox-backup" || return 1 + chmod 644 "$lightdm_config.vbox-backup" || return 1 + fi + sed -i -e 's/^\s*greeter-session\s*=.*/greeter-session=vbox-greeter/g' "$lightdm_config" || return 1 + chmod 644 "$lightdm_config" || return 1 + + info "Auto-logon installation successful" + return 0 +} + +mod_autologon_install() +{ + if [ -z "$MOD_AUTOLOGON_LIGHTDM_GREETER_DIR" ]; then + MOD_AUTOLOGON_LIGHTDM_GREETER_DIR=$MOD_AUTOLOGON_DEFAULT_LIGHTDM_GREETER_DIR + fi + if [ -z "$MOD_AUTOLOGON_LIGHTDM_CONFIG" ]; then + MOD_AUTOLOGON_LIGHTDM_CONFIG=$MOD_AUTOLOGON_DEFAULT_LIGHTDM_CONFIG + fi + + mod_autologon_install_ex "$MOD_AUTOLOGON_LIGHTDM_GREETER_DIR" "$MOD_AUTOLOGON_LIGHTDM_CONFIG" "$MOD_AUTOLOGON_FORCE" + return $? +} + +mod_autologon_pre_uninstall() +{ + echo "Preparing to uninstall auto-logon support ..." + return 0 +} + +mod_autologon_uninstall() +{ + if test -z "$MOD_AUTOLOGON_LIGHTDM_CONFIG"; then + return 0 + fi + info "Un-installing auto-logon support ..." + + # Switch back to original greeter. + if test -f "$MOD_AUTOLOGON_LIGHTDM_CONFIG.vbox-backup"; then + mv "$MOD_AUTOLOGON_LIGHTDM_CONFIG.vbox-backup" "$MOD_AUTOLOGON_LIGHTDM_CONFIG" + if test "$?" -ne "0"; then + info "Warning: Could not restore original LightDM config \"$MOD_AUTOLOGON_LIGHTDM_CONFIG\"" + fi + fi + + # Remove greeter directory (if not empty). + rm "$MOD_AUTOLOGON_LIGHTDM_GREETER_DIR" 2>/dev/null + + info "Auto-logon uninstallation successful" + return 0 +} + +mod_autologon_config_save() +{ + echo " +MOD_AUTOLOGON_LIGHTDM_CONFIG='$MOD_AUTOLOGON_LIGHTDM_CONFIG' +MOD_AUTOLOGON_LIGHTDM_GREETER_DIR='$MOD_AUTOLOGON_LIGHTDM_GREETER_DIR'" +} + diff --git a/src/VBox/Additions/linux/installer/vboxadd-service.sh b/src/VBox/Additions/linux/installer/vboxadd-service.sh index caec2111..cf30b9e4 100755 --- a/src/VBox/Additions/linux/installer/vboxadd-service.sh +++ b/src/VBox/Additions/linux/installer/vboxadd-service.sh @@ -2,7 +2,7 @@ # # Linux Additions Guest Additions service daemon init script. # -# Copyright (C) 2006-2010 Oracle Corporation +# Copyright (C) 2006-2012 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/linux/installer/vboxadd-x11.sh b/src/VBox/Additions/linux/installer/vboxadd-x11.sh index ffa1e16d..7188e4f8 100755 --- a/src/VBox/Additions/linux/installer/vboxadd-x11.sh +++ b/src/VBox/Additions/linux/installer/vboxadd-x11.sh @@ -1,10 +1,10 @@ #! /bin/sh # -# Linux Additions X11 setup init script ($Revision: 80787 $) +# Linux Additions X11 setup init script ($Revision: 92745 $) # # -# Copyright (C) 2006-2010 Oracle Corporation +# Copyright (C) 2006-2012 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; @@ -38,22 +38,25 @@ cpu=`uname -m`; case "$cpu" in i[3456789]86|x86) cpu="x86" - LIB="/usr/lib" + lib_candidates="/usr/lib/i386-linux-gnu /usr/lib /lib" ;; x86_64|amd64) cpu="amd64" - if test -d "/usr/lib64"; then - LIB="/usr/lib64" - else - LIB="/usr/lib" - fi + lib_candidates="/usr/lib/x86_64-linux-gnu /usr/lib64 /usr/lib /lib64 /lib" ;; esac +for i in $lib_candidates; do + if test -d "$i/VBoxGuestAdditions"; then + LIB=$i + break + fi +done # Find the version of X installed # The last of the three is for the X.org 6.7 included in Fedora Core 2 xver=`X -version 2>&1` x_version=`echo "$xver" | sed -n 's/^X Window System Version \([0-9.]\+\)/\1/p'``echo "$xver" | sed -n 's/^XFree86 Version \([0-9.]\+\)/\1/p'``echo "$xver" | sed -n 's/^X Protocol Version 11, Revision 0, Release \([0-9.]\+\)/\1/p'``echo "$xver" | sed -n 's/^X.Org X Server \([0-9.]\+\)/\1/p'` +x_version_short=`echo "${x_version}" | sed 's/\([0-9]*\.[0-9]*\)\..*/\1/'` # Version of Redhat or Fedora installed. Needed for setting up selinux policy. redhat_release=`cat /etc/redhat-release 2> /dev/null` # All the different possible locations for XFree86/X.Org configuration files @@ -283,9 +286,9 @@ setup() dox11config="true" # By default, we want to run our xorg.conf setup script setupxorgconf="true" - # On all but the oldest X servers we want to use our new mouse - # driver. - newmouse="--newMouse" + # All but the oldest supported X servers can automatically set up the + # keyboard driver. + autokeyboard="--autoKeyboard" # On more recent servers our kernel mouse driver will be used # automatically automouse="--autoMouse" @@ -300,6 +303,9 @@ setup() vboxmouse_src= # The driver extension driver_ext=".so" + # The configuration file we generate if no original was found but we need + # one. + main_cfg="/etc/X11/xorg.conf" modules_dir=`X -showDefaultModulePath 2>&1` || modules_dir= if [ -z "$modules_dir" ]; then @@ -312,7 +318,11 @@ setup() fi test -z "$x_version" -o -z "$modules_dir" && - fail "Could not find the X.Org or XFree86 Window System." + { + echo + echo "Could not find the X.Org or XFree86 Window System, skipping." + exit 0 + } echo # openSUSE 10.3 shipped X.Org 7.2 with X.Org Server 1.3, but didn't @@ -328,16 +338,6 @@ setup() echo "installing the X.Org drivers." dox11config="" ;; - 1.13.* ) - xserver_version="X.Org Server 1.13" - vboxvideo_src=vboxvideo_drv_113.so - test "$system" = "redhat" || setupxorgconf="" - ;; - 1.12.* ) - xserver_version="X.Org Server 1.12" - vboxvideo_src=vboxvideo_drv_112.so - test "$system" = "redhat" || setupxorgconf="" - ;; 1.11.* ) xserver_version="X.Org Server 1.11" vboxvideo_src=vboxvideo_drv_111.so @@ -351,7 +351,7 @@ setup() 1.9.* ) xserver_version="X.Org Server 1.9" vboxvideo_src=vboxvideo_drv_19.so - # Fedora 14 and later patched out vboxvideo detection + # Fedora 14 to 16 patched out vboxvideo detection test "$system" = "redhat" || setupxorgconf="" ;; 1.8.* ) @@ -412,20 +412,39 @@ setup() automouse="" ;; 6.7* | 6.8.* | 4.2.* | 4.3.* ) - # Assume X.Org post-fork or XFree86 + # As the module binaries are the same we use one text for these + # four server versions. xserver_version="XFree86 4.2/4.3 and X.Org 6.7/6.8" driver_ext=.o vboxvideo_src=vboxvideo_drv.o vboxmouse_src=vboxmouse_drv.o automouse="" + autokeyboard="" + case $x_version in + 6.8.* ) + autokeyboard="true" + ;; + 4.2.* | 4.3.* ) + main_cfg="/etc/X11/XF86Config" + ;; + esac ;; * ) - echo "Warning: unknown version of the X Window System installed. Not installing" - echo "X Window System drivers." - dox11config="" + # Anything else, including all X server versions as of 1.12. + xserver_version="X.Org Server ${x_version_short}" + vboxvideo_src=vboxvideo_drv_`echo ${x_version_short} | sed 's/\.//'`.so + setupxorgconf="" + test -f "${lib_dir}/${vboxvideo_src}" || + { + echo "Warning: unknown version of the X Window System installed. Not installing" + echo "X Window System drivers." + dox11config="" + vboxvideo_src="" + } ;; esac - begin "Installing $xserver_version modules" + test -n "${dox11config}" && + begin "Installing $xserver_version modules" rm "$modules_dir/drivers/vboxvideo_drv$driver_ext" 2>/dev/null rm "$modules_dir/input/vboxmouse_drv$driver_ext" 2>/dev/null case "$vboxvideo_src" in ?*) @@ -458,7 +477,7 @@ setup() if grep -q "VirtualBox generated" "$i"; then generated="$generated `printf "$i\n"`" else - "$lib_dir/x11config.sh" $newmouse $automouse $nopsaux "$i" + "$lib_dir/x11config.sh" $autokeyboard $automouse $nopsaux "$i" fi configured="true" fi @@ -468,12 +487,11 @@ setup() done # X.Org Server 1.5 and 1.6 can detect hardware they know, but they # need a configuration file for VBoxVideo. - main_cfg="/etc/X11/xorg.conf" - nobak="/etc/X11/xorg.vbox.nobak" + nobak_cfg="`expr "${main_cfg}" : '\([^.]*\)'`.vbox.nobak" if test -z "$configured"; then touch "$main_cfg" - "$lib_dir/x11config.sh" $newmouse $automouse $nopsaux --noBak "$main_cfg" - touch "$nobak" + "$lib_dir/x11config.sh" $autokeyboard $automouse $nopsaux --noBak "$main_cfg" + touch "${nobak_cfg}" fi fi succ_msg @@ -540,24 +558,30 @@ EOF cleanup() { # Restore xorg.conf files as far as possible - ## List of generated files which have been changed since we generated them + # List of generated files which have been changed since we generated them newer="" - ## Are we dealing with a legacy information which didn't support + # Are we dealing with a legacy information which didn't support # uninstallation? legacy="" - ## Do any of the restored configuration files still reference our drivers? + # Do any of the restored configuration files still reference our drivers? failed="" + # Have we encountered a "nobak" configuration file which means that there + # is no original file to restore? + nobak="" test -r "$CONFIG_DIR/$CONFIG" || legacy="true" - main_cfg="/etc/X11/xorg.conf" - nobak="/etc/X11/xorg.vbox.nobak" - if test -r "$nobak"; then - test -r "$main_cfg" && - if test -n "$legacy" -o ! "$nobak" -ot "$main_cfg"; then - rm -f "$nobak" "$main_cfg" + for main_cfg in "/etc/X11/xorg.conf" "/etc/X11/XF86Config"; do + nobak_cfg="`expr "${main_cfg}" : '\([^.]*\)'`.vbox.nobak" + if test -r "${nobak_cfg}"; then + test -r "${main_cfg}" && + if test -n "${legacy}" -o ! "${nobak_cfg}" -ot "${main_cfg}"; then + rm -f "${nobak_cfg}" "${main_cfg}" else - newer="$newer`printf " $main_cfg (no original)\n"`" + newer="${newer}`printf " ${main_cfg} (no original)\n"`" fi - else + nobak="true" + fi + done + if test -n "${nobak}"; then for i in $x11conf_files; do if test -r "$i.vbox"; then if test ! "$i" -nt "$i.vbox" -o -n "$legacy"; then diff --git a/src/VBox/Additions/linux/installer/vboxadd.sh b/src/VBox/Additions/linux/installer/vboxadd.sh index 5112da1e..1eb00146 100755 --- a/src/VBox/Additions/linux/installer/vboxadd.sh +++ b/src/VBox/Additions/linux/installer/vboxadd.sh @@ -1,10 +1,10 @@ #! /bin/sh # -# Linux Additions kernel module init script ($Revision: 81678 $) +# Linux Additions kernel module init script ($Revision: 90030 $) # # -# Copyright (C) 2006-2010 Oracle Corporation +# Copyright (C) 2006-2012 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; @@ -228,6 +228,11 @@ running_vboxsf() lsmod | grep -q "vboxsf[^_-]" } +running_vboxvideo() +{ + lsmod | grep -q "vboxvideo[^_-]" +} + do_vboxguest_non_udev() { if [ ! -c $dev ]; then @@ -279,7 +284,7 @@ do_vboxguest_non_udev() start() { begin "Starting the VirtualBox Guest Additions "; - uname -r | grep -q '^2\.6' 2>/dev/null && + uname -r | grep -q -E '^2\.6|^3' 2>/dev/null && ps -A -o comm | grep -q '/*udevd$' 2>/dev/null || no_udev=1 running_vboxguest || { @@ -314,6 +319,9 @@ start() } } + # This is needed as X.Org Server 1.13 does not auto-load the module. + running_vboxvideo || $MODPROBE vboxvideo > /dev/null 2>&1 + # Mount all shared folders from /etc/fstab. Normally this is done by some # other startup script but this requires the vboxdrv kernel module loaded. # This isn't necessary anymore as the vboxsf module is autoloaded. @@ -432,7 +440,7 @@ extra_setup() # Add a group "vboxsf" for Shared Folders access # All users which want to access the auto-mounted Shared Folders have to # be added to this group. - groupadd -f vboxsf >/dev/null 2>&1 + groupadd -r -f vboxsf >/dev/null 2>&1 # Create udev description file if [ -d /etc/udev/rules.d ]; then |