summaryrefslogtreecommitdiffstats
path: root/src/VBox/Additions/x11/Installer
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Additions/x11/Installer')
-rwxr-xr-xsrc/VBox/Additions/x11/Installer/98vboxadd-xclient48
-rw-r--r--src/VBox/Additions/x11/Installer/linux_xorg_suse11.conf130
-rw-r--r--src/VBox/Additions/x11/Installer/solaris_xorg.conf113
-rw-r--r--src/VBox/Additions/x11/Installer/solaris_xorg_modeless.conf81
-rw-r--r--src/VBox/Additions/x11/Installer/vboxclient.desktop13
-rw-r--r--src/VBox/Additions/x11/Installer/vboxvideo.ids1
-rwxr-xr-xsrc/VBox/Additions/x11/Installer/x11config.pl139
-rwxr-xr-xsrc/VBox/Additions/x11/Installer/x11config.sh171
-rwxr-xr-xsrc/VBox/Additions/x11/Installer/x11config15.pl97
-rwxr-xr-xsrc/VBox/Additions/x11/Installer/x11config15sol.pl110
-rwxr-xr-xsrc/VBox/Additions/x11/Installer/x11config15suse.pl166
-rwxr-xr-xsrc/VBox/Additions/x11/Installer/x11restore.pl77
12 files changed, 1146 insertions, 0 deletions
diff --git a/src/VBox/Additions/x11/Installer/98vboxadd-xclient b/src/VBox/Additions/x11/Installer/98vboxadd-xclient
new file mode 100755
index 00000000..7c9b5989
--- /dev/null
+++ b/src/VBox/Additions/x11/Installer/98vboxadd-xclient
@@ -0,0 +1,48 @@
+#!/bin/sh
+## @file
+# Start the Guest Additions X11 Client
+#
+
+#
+# Copyright (C) 2007-2022 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
+#
+
+# Sanity check: if non-writeable PID-files are present in the user home
+# directory VBoxClient will fail to start.
+for i in $HOME/.vboxclient-*.pid; do
+ test -w $i || rm -f $i
+done
+
+if ! test -c /dev/vboxguest 2>/dev/null; then
+ # Do not start if the kernel module is not present.
+ # Execute notify-send in the back-ground to avoid racing with sddm,
+ # as notify-send may wait for sddm to start while it waits for us to exit.
+ notify-send "VBoxClient: the VirtualBox kernel service is not running. Exiting." &
+elif test -z "${SSH_CONNECTION}"; then
+ # This script can also be triggered by a connection over SSH, which is not
+ # what we had in mind, so we do not start VBoxClient in that case. We do
+ # not use "exit" here as this script is "source"d, not executed.
+ /usr/bin/VBoxClient --clipboard
+ /usr/bin/VBoxClient --checkhostversion
+ /usr/bin/VBoxClient --seamless
+ /usr/bin/VBoxClient --draganddrop
+ /usr/bin/VBoxClient --vmsvga-session # In case VMSVGA emulation is enabled
+fi
diff --git a/src/VBox/Additions/x11/Installer/linux_xorg_suse11.conf b/src/VBox/Additions/x11/Installer/linux_xorg_suse11.conf
new file mode 100644
index 00000000..c55ea88e
--- /dev/null
+++ b/src/VBox/Additions/x11/Installer/linux_xorg_suse11.conf
@@ -0,0 +1,130 @@
+# Default X11 configuration file for SUSE and openSUSE 11 guests in VirtualBox.
+# Based on:
+# SaX generated X11 config file
+# Version: 8.1
+#
+
+Section "Files"
+ FontPath "/usr/share/fonts/misc:unscaled"
+ FontPath "/usr/share/fonts/local"
+ FontPath "/usr/share/fonts/75dpi:unscaled"
+ FontPath "/usr/share/fonts/100dpi:unscaled"
+ FontPath "/usr/share/fonts/Type1"
+ FontPath "/usr/share/fonts/URW"
+ FontPath "/usr/share/fonts/Speedo"
+ FontPath "/usr/share/fonts/PEX"
+ FontPath "/usr/share/fonts/cyrillic"
+ FontPath "/usr/share/fonts/latin2/misc:unscaled"
+ FontPath "/usr/share/fonts/latin2/75dpi:unscaled"
+ FontPath "/usr/share/fonts/latin2/100dpi:unscaled"
+ FontPath "/usr/share/fonts/latin2/Type1"
+ FontPath "/usr/share/fonts/latin7/75dpi:unscaled"
+ FontPath "/usr/share/fonts/baekmuk:unscaled"
+ FontPath "/usr/share/fonts/japanese:unscaled"
+ FontPath "/usr/share/fonts/kwintv"
+ FontPath "/usr/share/fonts/truetype"
+ FontPath "/usr/share/fonts/uni:unscaled"
+ FontPath "/usr/share/fonts/CID"
+ FontPath "/usr/share/fonts/ucs/misc:unscaled"
+ FontPath "/usr/share/fonts/ucs/75dpi:unscaled"
+ FontPath "/usr/share/fonts/ucs/100dpi:unscaled"
+ FontPath "/usr/share/fonts/hellas/misc:unscaled"
+ FontPath "/usr/share/fonts/hellas/75dpi:unscaled"
+ FontPath "/usr/share/fonts/hellas/100dpi:unscaled"
+ FontPath "/usr/share/fonts/hellas/Type1"
+ FontPath "/usr/share/fonts/misc/sgi:unscaled"
+ FontPath "/usr/share/fonts/xtest"
+ FontPath "/opt/kde3/share/fonts"
+ InputDevices "/dev/gpmdata"
+ InputDevices "/dev/input/mice"
+EndSection
+
+Section "ServerFlags"
+ Option "AllowMouseOpenFail" "on"
+ Option "ZapWarning" "on"
+EndSection
+
+Section "Module"
+ Load "dri"
+ Load "dbe"
+ Load "freetype"
+ Load "extmod"
+ Load "glx"
+EndSection
+
+Section "InputDevice"
+ Driver "kbd"
+ Identifier "Keyboard[0]"
+ Option "Protocol" "Standard"
+ Option "XkbLayout" "us"
+ Option "XkbModel" "microsoftpro"
+ Option "XkbRules" "xfree86"
+EndSection
+
+
+Section "InputDevice"
+ Driver "mouse"
+ Identifier "Mouse[1]"
+ Option "Buttons" "9"
+ Option "Device" "/dev/input/mice"
+ Option "Name" "VirtualBox Mouse Buttons"
+ Option "Protocol" "explorerps/2"
+ Option "Vendor" "Oracle Corporation"
+ Option "ZAxisMapping" "4 5"
+EndSection
+
+
+Section "InputDevice"
+ Driver "vboxmouse"
+ Identifier "Mouse[2]"
+ Option "Device" "/dev/vboxguest"
+ Option "Name" "VirtualBox Mouse"
+ Option "Vendor" "Oracle Corporation"
+EndSection
+
+
+Section "Monitor"
+ Identifier "Monitor[0]"
+ ModelName "VirtualBox Virtual Output"
+ VendorName "Oracle Corporation"
+EndSection
+
+
+Section "Screen"
+ SubSection "Display"
+ Depth 24
+ EndSubSection
+ Device "Device[0]"
+ Identifier "Screen[0]"
+ Monitor "Monitor[0]"
+EndSection
+
+
+Section "Device"
+ BoardName "VirtualBox Graphics"
+ Driver "vboxvideo"
+ Identifier "Device[0]"
+ VendorName "Oracle Corporation"
+EndSection
+
+
+
+Section "ServerLayout"
+ Identifier "Layout[all]"
+ InputDevice "Keyboard[0]" "CoreKeyboard"
+ InputDevice "Mouse[1]" "CorePointer"
+ InputDevice "Mouse[2]" "SendCoreEvents"
+ Option "Clone" "off"
+ Option "Xinerama" "off"
+ Screen "Screen[0]"
+EndSection
+
+
+Section "DRI"
+ Group "video"
+ Mode 0660
+EndSection
+
+Section "Extensions"
+EndSection
+
diff --git a/src/VBox/Additions/x11/Installer/solaris_xorg.conf b/src/VBox/Additions/x11/Installer/solaris_xorg.conf
new file mode 100644
index 00000000..dd5d780e
--- /dev/null
+++ b/src/VBox/Additions/x11/Installer/solaris_xorg.conf
@@ -0,0 +1,113 @@
+# Default xorg.conf for Solaris guests.
+#
+# This file was created by VirtualBox Additions installer as it
+# was unable to find any existing configuration file for X.
+
+Section "ServerLayout"
+ Identifier "X.org Configured"
+ Screen 0 "Screen0" 0 0
+ InputDevice "Mouse0" "CorePointer"
+ InputDevice "Keyboard0" "CoreKeyboard"
+EndSection
+
+Section "Files"
+ RgbPath "/usr/X11/lib/X11/rgb"
+ FontPath "/usr/X11/lib/X11/fonts/misc/:unscaled"
+ FontPath "/usr/X11/lib/X11/fonts/100dpi/:unscaled"
+ FontPath "/usr/X11/lib/X11/fonts/75dpi/:unscaled"
+ FontPath "/usr/X11/lib/X11/fonts/misc/"
+ FontPath "/usr/X11/lib/X11/fonts/Type1/"
+ FontPath "/usr/X11/lib/X11/fonts/100dpi/"
+ FontPath "/usr/X11/lib/X11/fonts/75dpi/"
+ FontPath "/usr/X11/lib/X11/fonts/TrueType/"
+ FontPath "/usr/X11/lib/X11/fonts/Type1/sun/"
+ FontPath "/usr/X11/lib/X11/fonts/F3bitmaps/"
+EndSection
+
+Section "Module"
+ Load "IA"
+ Load "dbe"
+ Load "extmod"
+ Load "record"
+ Load "xtrap"
+ Load "Glcore"
+ Load "glx"
+ Load "dri"
+ Load "xtsol"
+ Load "type1"
+ Load "freetype"
+EndSection
+
+Section "InputDevice"
+ Identifier "Keyboard0"
+ Driver "kbd"
+EndSection
+
+Section "InputDevice"
+ Identifier "Mouse0"
+ Driver "mouse"
+ Option "CorePointer"
+ Option "Device" "/dev/mouse"
+ Option "Protocol" "auto"
+ Option "ZAxisMapping" "4 5"
+EndSection
+
+Section "Device"
+ Identifier "Generic Video Card"
+ Driver "vesa"
+ BusID "0:2:0"
+EndSection
+
+Section "Monitor"
+ Identifier "Monitor0"
+ VendorName "Monitor Vendor"
+ ModelName "Monitor Model"
+ HorizSync 30.0 - 110.0
+ VertRefresh 50.0 - 150.0
+EndSection
+
+Section "Device"
+ Identifier "Card0"
+ Driver "vesa"
+ VendorName "Unknown Vendor"
+ BoardName "Unknown Board"
+ BusID "PCI:0:2:0"
+EndSection
+
+Section "Screen"
+ Identifier "Screen0"
+ Device "Card0"
+ Monitor "Monitor0"
+ DefaultDepth 24
+ SubSection "Display"
+ ViewPort 0 0
+ Depth 1
+ Modes "1024x768_75.00" "800x600_75.00" "640x480_60.00"
+ EndSubSection
+ SubSection "Display"
+ ViewPort 0 0
+ Depth 4
+ Modes "1024x768_75.00" "800x600_75.00" "640x480_60.00"
+ EndSubSection
+ SubSection "Display"
+ ViewPort 0 0
+ Depth 8
+ Modes "1024x768_75.00" "800x600_75.00" "640x480_60.00"
+ EndSubSection
+ SubSection "Display"
+ ViewPort 0 0
+ Depth 15
+ Modes "1024x768_75.00" "800x600_75.00" "640x480_60.00"
+ EndSubSection
+ SubSection "Display"
+ ViewPort 0 0
+ Depth 16
+ Modes "1024x768_75.00" "800x600_75.00" "640x480_60.00"
+ EndSubSection
+ SubSection "Display"
+ ViewPort 0 0
+ Depth 24
+ Modes "1024x768_75.00" "800x600_75.00" "640x480_60.00"
+ EndSubSection
+EndSection
+
diff --git a/src/VBox/Additions/x11/Installer/solaris_xorg_modeless.conf b/src/VBox/Additions/x11/Installer/solaris_xorg_modeless.conf
new file mode 100644
index 00000000..0468ba24
--- /dev/null
+++ b/src/VBox/Additions/x11/Installer/solaris_xorg_modeless.conf
@@ -0,0 +1,81 @@
+# Default xorg.conf for Solaris guests.
+#
+# This file was created by VirtualBox Additions installer as it
+# was unable to find any existing configuration file for X.
+
+Section "ServerLayout"
+ Identifier "X.org Configured"
+ Screen 0 "Screen0" 0 0
+ InputDevice "Mouse0" "CorePointer"
+ InputDevice "Keyboard0" "CoreKeyboard"
+EndSection
+
+Section "Files"
+ FontPath "/usr/X11/lib/X11/fonts/misc/:unscaled"
+ FontPath "/usr/X11/lib/X11/fonts/100dpi/:unscaled"
+ FontPath "/usr/X11/lib/X11/fonts/75dpi/:unscaled"
+ FontPath "/usr/X11/lib/X11/fonts/misc/"
+ FontPath "/usr/X11/lib/X11/fonts/Type1/"
+ FontPath "/usr/X11/lib/X11/fonts/100dpi/"
+ FontPath "/usr/X11/lib/X11/fonts/75dpi/"
+ FontPath "/usr/X11/lib/X11/fonts/TrueType/"
+ FontPath "/usr/X11/lib/X11/fonts/Type1/sun/"
+ FontPath "/usr/X11/lib/X11/fonts/F3bitmaps/"
+EndSection
+
+Section "Module"
+ Load "IA"
+ Load "dbe"
+ Load "extmod"
+ Load "record"
+ Load "xtrap"
+ Load "Glcore"
+ Load "glx"
+ Load "dri"
+ Load "xtsol"
+ Load "type1"
+ Load "freetype"
+EndSection
+
+Section "InputDevice"
+ Identifier "Keyboard0"
+ Driver "kbd"
+EndSection
+
+Section "InputDevice"
+ Identifier "Mouse0"
+ Driver "mouse"
+ Option "CorePointer"
+ Option "Device" "/dev/mouse"
+ Option "Protocol" "auto"
+ Option "ZAxisMapping" "4 5"
+EndSection
+
+Section "Device"
+ Identifier "Generic Video Card"
+ Driver "vesa"
+ BusID "0:2:0"
+EndSection
+
+Section "Monitor"
+ Identifier "Monitor0"
+ VendorName "Monitor Vendor"
+ ModelName "Monitor Model"
+ HorizSync 30.0 - 110.0
+ VertRefresh 50.0 - 150.0
+EndSection
+
+Section "Device"
+ Identifier "Card0"
+ Driver "vesa"
+ VendorName "Unknown Vendor"
+ BoardName "Unknown Board"
+ BusID "PCI:0:2:0"
+EndSection
+
+Section "Screen"
+ Identifier "Screen0"
+ Device "Card0"
+ Monitor "Monitor0"
+EndSection
+
diff --git a/src/VBox/Additions/x11/Installer/vboxclient.desktop b/src/VBox/Additions/x11/Installer/vboxclient.desktop
new file mode 100644
index 00000000..b5e4d863
--- /dev/null
+++ b/src/VBox/Additions/x11/Installer/vboxclient.desktop
@@ -0,0 +1,13 @@
+[Desktop Entry]
+Type=Application
+Encoding=UTF-8
+Version=1.0
+Name=vboxclient
+Name[C]=vboxclient
+Comment[C]=VirtualBox User Session Services
+Comment=VirtualBox User Session Services
+Comment[it]=Servizi di sessione utente di VirtualBox
+Comment[pl]=Usługi sesji użytkownika VirtualBox
+Exec=/usr/bin/VBoxClient-all
+X-GNOME-Autostart-enabled=true
+X-KDE-autostart-after=panel
diff --git a/src/VBox/Additions/x11/Installer/vboxvideo.ids b/src/VBox/Additions/x11/Installer/vboxvideo.ids
new file mode 100644
index 00000000..8286a95e
--- /dev/null
+++ b/src/VBox/Additions/x11/Installer/vboxvideo.ids
@@ -0,0 +1 @@
+80eebeef
diff --git a/src/VBox/Additions/x11/Installer/x11config.pl b/src/VBox/Additions/x11/Installer/x11config.pl
new file mode 100755
index 00000000..2583afde
--- /dev/null
+++ b/src/VBox/Additions/x11/Installer/x11config.pl
@@ -0,0 +1,139 @@
+#!/usr/bin/perl -w
+# $Id: x11config.pl $
+## @file
+# Guest Additions X11 config update script
+#
+
+#
+# Copyright (C) 2006-2022 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
+#
+
+my $temp="/tmp/xorg.conf";
+my $os_type=`uname -s`;
+my @cfg_files = ("/etc/X11/xorg.conf-4", "/etc/X11/xorg.conf", "/etc/X11/.xorg.conf", "/etc/xorg.conf",
+ "/usr/etc/X11/xorg.conf-4", "/usr/etc/X11/xorg.conf", "/usr/lib/X11/xorg.conf-4",
+ "/usr/lib/X11/xorg.conf", "/etc/X11/XF86Config-4", "/etc/X11/XF86Config",
+ "/etc/XF86Config", "/usr/X11R6/etc/X11/XF86Config-4", "/usr/X11R6/etc/X11/XF86Config",
+ "/usr/X11R6/lib/X11/XF86Config-4", "/usr/X11R6/lib/X11/XF86Config");
+my $CFG;
+my $TMP;
+
+my $config_count = 0;
+
+foreach $cfg (@cfg_files)
+{
+
+ if (open(CFG, $cfg))
+ {
+ open(TMP, ">$temp") or die "Can't create $TMP: $!\n";
+
+ my $have_mouse = 0;
+ my $in_section = 0;
+
+ while (defined ($line = <CFG>))
+ {
+ if ($line =~ /^\s*Section\s*"([a-zA-Z]+)"/i)
+ {
+ my $section = lc($1);
+ if (($section eq "inputdevice") || ($section eq "device"))
+ {
+ $in_section = 1;
+ }
+ if ($section eq "serverlayout")
+ {
+ $in_layout = 1;
+ }
+ } else {
+ if ($line =~ /^\s*EndSection/i)
+ {
+ $in_section = 0;
+ $in_layout = 0;
+ }
+ }
+
+ if ($in_section)
+ {
+ if ($line =~ /^\s*driver\s+\"(?:mouse|vboxmouse)\"/i)
+ {
+ $line = " Driver \"vboxmouse\"\n Option \"CorePointer\"\n";
+ $have_mouse = 1
+ }
+
+ # Other drivers sending events interfere badly with pointer integration
+ if ($line =~ /^\s*option\s+\"(?:alwayscore|sendcoreevents|corepointer)\"/i)
+ {
+ $line = "";
+ }
+
+ # Solaris specific: /dev/kdmouse for PS/2 and not /dev/mouse
+ if ($os_type =~ 'SunOS')
+ {
+ if ($line =~ /^\s*option\s+\"(?:device)\"\s+\"(?:\/dev\/mouse)\"/i)
+ {
+ $line = " Option \"Device\" \"\/dev\/kdmouse\"\n"
+ }
+ }
+
+ if ($line =~ /^\s*driver\s+\"(?:fbdev|vga|vesa|vboxvideo|ChangeMe)\"/i)
+ {
+ $line = " Driver \"vboxvideo\"\n";
+ }
+ }
+ if ($in_layout)
+ {
+ # Other drivers sending events interfere badly with pointer integration
+ if ( $line =~ /^\s*inputdevice.*\"(?:alwayscore|sendcoreevents)\"/i)
+ {
+ $line = "";
+ }
+ }
+ print TMP $line;
+ }
+
+ if (!$have_mouse) {
+ print TMP "\n";
+ print TMP "Section \"InputDevice\"\n";
+ print TMP " Identifier \"VBoxMouse\"\n";
+ print TMP " Driver \"vboxmouse\"\n";
+ if ($os_type eq 'SunOS')
+ {
+ print TMP " Option \"Device\" \"\/dev\/kdmouse\"\n";
+ }
+ print TMP " Option \"CorePointer\"\n";
+ print TMP "EndSection\n";
+ }
+ close(TMP);
+
+ rename $cfg, $cfg.".bak";
+ system("cp $temp $cfg");
+ unlink $temp;
+
+ # Solaris specific: Rename our modified .xorg.conf to xorg.conf for it to be used
+ if (($os_type =~ 'SunOS') && ($cfg =~ '/etc/X11/.xorg.conf'))
+ {
+ system("mv -f $cfg /etc/X11/xorg.conf");
+ }
+
+ $config_count++;
+ }
+}
+
+$config_count != 0 or die "Could not find any X11 configuration files";
diff --git a/src/VBox/Additions/x11/Installer/x11config.sh b/src/VBox/Additions/x11/Installer/x11config.sh
new file mode 100755
index 00000000..223d9f6e
--- /dev/null
+++ b/src/VBox/Additions/x11/Installer/x11config.sh
@@ -0,0 +1,171 @@
+#!/bin/sh
+# $Id: x11config.sh $
+## @file
+# Guest Additions X11 config update script
+#
+
+#
+# Copyright (C) 2006-2022 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
+#
+
+auto_mouse=""
+auto_keyboard=""
+no_bak=""
+old_mouse_dev="/dev/psaux"
+video_driver="vboxvideo"
+
+tab=`printf '\t'`
+
+ALL_SECTIONS=\
+'^[ '$tab']*[Ss][Ee][Cc][Tt][Ii][Oo][Nn][ '$tab']*'\
+'"\([Ii][Nn][Pp][Uu][Tt][Dd][Ee][Vv][Ii][Cc][Ee]\|'\
+'[Dd][Ee][Vv][Ii][Cc][Ee]\|'\
+'[Ss][Ee][Rr][Vv][Ee][Rr][Ll][Aa][Yy][Oo][Uu][Tt]\|'\
+'[Ss][Cc][Rr][Ee][Ee][Nn]\|'\
+'[Mm][Oo][Nn][Ii][Tt][Oo][Rr]\|'\
+'[Kk][Ee][Yy][Bb][Oo][Aa][Rr][Dd]\|'\
+'[Pp][Oo][Ii][Nn][Tt][Ee][Rr]\)"'
+# ^\s*Section\s*"(InputDevice|Device|ServerLayout|Screen|Monitor|Keyboard|Pointer)"
+
+KBD_SECTION='^[ '$tab']*[Ss][Ee][Cc][Tt][Ii][Oo][Nn][ '$tab']*"'\
+'[Ii][Nn][Pp][Uu][Tt][Dd][Ee][Vv][Ii][Cc][Ee]"' # ^\s*section\s*\"inputdevice\"
+
+END_SECTION='[Ee][Nn][Dd][Ss][Ee][Cc][Tt][Ii][Oo][Nn]' # EndSection
+
+OPT_XKB='^[ '$tab']*option[ '$tab'][ '$tab']*"xkb'
+
+DRIVER_KBD='^[ '$tab']*[Dd][Rr][Ii][Vv][Ee][Rr][ '$tab'][ '$tab']*'\
+'"\(kbd\|keyboard\)"'
+# ^\s*driver\s+\"(kbd|keyboard)\"
+
+reconfigure()
+{
+ cfg="$1"
+ tmp="$cfg.vbox.tmp"
+ test -w "$cfg" || { echo "$cfg does not exist"; return; }
+ rm -f "$tmp"
+ test ! -e "$tmp" || { echo "Failed to delete $tmp"; return; }
+ touch "$tmp"
+ test -w "$tmp" || { echo "Failed to create $tmp"; return; }
+ xkb_opts="`cat "$cfg" | sed -n -e "/$KBD_SECTION/,/$END_SECTION/p" |
+ grep -i "$OPT_XKB"`"
+ kbd_drv="`cat "$cfg" | sed -n -e "/$KBD_SECTION/,/$END_SECTION/p" |
+ sed -n -e "0,/$DRIVER_KBD/s/$DRIVER_KBD/\\1/p"`"
+ test -z "${kbd_drv}" && test -z "${auto_keyboard}" && kbd_drv=keyboard
+ cat > "$tmp" << EOF
+# VirtualBox generated configuration file
+# based on $cfg.
+EOF
+ cat "$cfg" | sed -e "/$ALL_SECTIONS/,/$END_SECTION/s/\\(.*\\)/# \\1/" >> "$tmp"
+ test -n "$kbd_drv" && cat >> "$tmp" << EOF
+Section "InputDevice"
+ Identifier "Keyboard[0]"
+ Driver "$kbd_drv"
+$xkb_opts
+ Option "Protocol" "Standard"
+ Option "CoreKeyboard"
+EndSection
+EOF
+ kbd_line=""
+ test -n "$kbd_drv" && kbd_line=' InputDevice "Keyboard[0]" "CoreKeyboard"'
+ test -z "$auto_mouse" &&
+ cat >> "$tmp" << EOF
+
+Section "InputDevice"
+ Driver "mouse"
+ Identifier "Mouse[1]"
+ Option "Buttons" "9"
+ Option "Device" "$old_mouse_dev"
+ Option "Name" "VirtualBox Mouse Buttons"
+ Option "Protocol" "explorerps/2"
+ Option "Vendor" "Oracle Corporation"
+ Option "ZAxisMapping" "4 5"
+ Option "CorePointer"
+EndSection
+
+Section "InputDevice"
+ Driver "vboxmouse"
+ Identifier "Mouse[2]"
+ Option "Device" "/dev/vboxguest"
+ Option "Name" "VirtualBox Mouse"
+ Option "Vendor" "Oracle Corporation"
+ Option "SendCoreEvents"
+EndSection
+
+Section "ServerLayout"
+ Identifier "Layout[all]"
+${kbd_line}
+ InputDevice "Mouse[1]" "CorePointer"
+ InputDevice "Mouse[2]" "SendCoreEvents"
+ Option "Clone" "off"
+ Option "Xinerama" "off"
+ Screen "Screen[0]"
+EndSection
+EOF
+
+ cat >> "$tmp" << EOF
+
+Section "Monitor"
+ Identifier "Monitor[0]"
+ ModelName "VirtualBox Virtual Output"
+ VendorName "Oracle Corporation"
+EndSection
+
+Section "Device"
+ BoardName "VirtualBox Graphics"
+ Driver "${video_driver}"
+ Identifier "Device[0]"
+ VendorName "Oracle Corporation"
+EndSection
+
+Section "Screen"
+ SubSection "Display"
+ Depth 24
+ EndSubSection
+ Device "Device[0]"
+ Identifier "Screen[0]"
+ Monitor "Monitor[0]"
+EndSection
+EOF
+
+ test -n "$no_bak" -o -f "$cfg.vbox" || cp "$cfg" "$cfg.vbox"
+ test -n "$no_bak" || mv "$cfg" "$cfg.bak"
+ mv "$tmp" "$cfg"
+}
+
+while test -n "$1"
+do
+ case "$1" in
+ --autoMouse)
+ auto_mouse=1 ;;
+ --autoKeyboard)
+ auto_keyboard=1 ;;
+ --noBak)
+ no_bak=1 ;;
+ --nopsaux)
+ old_mouse_dev="/dev/input/mice" ;;
+ --vmsvga)
+ video_driver="vmware" ;;
+ *)
+ reconfigure "$1" ;;
+ esac
+ shift
+done
diff --git a/src/VBox/Additions/x11/Installer/x11config15.pl b/src/VBox/Additions/x11/Installer/x11config15.pl
new file mode 100755
index 00000000..71fb7999
--- /dev/null
+++ b/src/VBox/Additions/x11/Installer/x11config15.pl
@@ -0,0 +1,97 @@
+#!/usr/bin/perl -w
+# $Id: x11config15.pl $
+## @file
+# Guest Additions X11 config update script for X.org 1.5
+#
+
+#
+# Copyright (C) 2006-2022 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
+#
+
+# What this script does: X.org 1.5 introduces full hardware autodetection
+# and no longer requires the user to provide an X.org configuration file.
+# However, if such a file is provided, it will override autodetection of
+# the graphics card (not of vboxmouse as far as I can see). Although this
+# would normally be the user's business, at least Fedora 9 still generates
+# a configuration file by default, so we have to rewrite it if we want
+# the additions to work on a default guest installation. So we simply go
+# through any configuration files we may find on the system and replace
+# references to VESA or framebuffer drivers (which might be autodetected
+# for use on a VirtualBox guest) and replace them with vboxvideo.
+
+use File::Copy;
+
+my $temp="/tmp/xorg.conf";
+# The list of possible names of X.org configuration files
+my @cfg_files = ("/etc/X11/xorg.conf-4", "/etc/X11/xorg.conf", "/etc/X11/.xorg.conf", "/etc/xorg.conf",
+ "/usr/etc/X11/xorg.conf-4", "/usr/etc/X11/xorg.conf", "/usr/lib/X11/xorg.conf-4",
+ "/usr/lib/X11/xorg.conf");
+my $CFG;
+my $TMP;
+
+# Subroutine to roll back after a partial installation
+sub do_fail {
+ foreach $cfg (@cfg_files) {
+ move $cfg.".vbox", $cfg;
+ unlink $cfg.".vbox";
+ }
+ die $1;
+}
+
+# Perform the substitution on any configuration file we may find.
+foreach $cfg (@cfg_files) {
+
+ if (open(CFG, $cfg)) {
+ open(TMP, ">$temp")
+ or &do_fail("Can't create $TMP: $!\n");
+
+ while (defined ($line = <CFG>)) {
+ if ($line =~ /^\s*Section\s*"([a-zA-Z]+)"/i) {
+ my $section = lc($1);
+ if ($section eq "device") {
+ $in_section = 1;
+ }
+ } else {
+ if ($line =~ /^\s*EndSection/i) {
+ $in_section = 0;
+ }
+ }
+
+ if ($in_section) {
+ if ($line =~ /^\s*driver\s+\"(fbdev|vga|vesa|vboxvideo|ChangeMe)\"/i) {
+ $line =~ s/(fbdev|vga|vesa|vboxvideo|ChangeMe)/vboxvideo/i;
+ }
+ }
+ print TMP $line;
+ }
+ close(TMP);
+
+ # We do not overwrite existing $cfg.".vbox" files because that will
+ # likely ruin any future attempts to uninstall the additions
+ copy $cfg, $cfg.".bak";
+ if (! -e $cfg.".vbox") {
+ rename $cfg, $cfg.".vbox";
+ }
+ copy $temp, $cfg
+ or &do_fail("Could not overwrite configuration file $cfg! Exiting...");
+ unlink $temp;
+ }
+}
diff --git a/src/VBox/Additions/x11/Installer/x11config15sol.pl b/src/VBox/Additions/x11/Installer/x11config15sol.pl
new file mode 100755
index 00000000..47e82a6b
--- /dev/null
+++ b/src/VBox/Additions/x11/Installer/x11config15sol.pl
@@ -0,0 +1,110 @@
+#!/usr/bin/perl
+# $Id: x11config15sol.pl $
+## @file
+# Guest Additions X11 config update script
+#
+
+#
+# Copyright (C) 2006-2022 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
+#
+
+use strict;
+use warnings;
+
+my $temp="/tmp/xorg.conf";
+my $os_type=`uname -s`;
+my @cfg_files = ("/etc/X11/xorg.conf", "/etc/X11/.xorg.conf", "/etc/X11/xorg.conf-4", "/etc/xorg.conf",
+ "/usr/etc/X11/xorg.conf-4", "/usr/etc/X11/xorg.conf", "/usr/lib/X11/xorg.conf-4",
+ "/usr/lib/X11/xorg.conf", "/etc/X11/XF86Config-4", "/etc/X11/XF86Config",
+ "/etc/XF86Config", "/usr/X11R6/etc/X11/XF86Config-4", "/usr/X11R6/etc/X11/XF86Config",
+ "/usr/X11R6/lib/X11/XF86Config-4", "/usr/X11R6/lib/X11/XF86Config");
+
+## @todo: r=ramshankar: Hmm, why do we use the same variable name with upper/lower case for different variables?
+my $cfg;
+my $CFG;
+my $TMP;
+my $line;
+my $config_count = 0;
+
+# Command line options
+if ($#ARGV < 0)
+{
+ die "x11config15sol.pl: Missing driver name argument to configure for X.org";
+}
+my $driver_name = $ARGV[0];
+
+# Loop through all possible config files and change them. It's done this wasy for hysterical raisins
+# as we didn't know what the correct config file is so we update all of them. However, for Solaris it's
+# most likely -only- one of the 2 config files (/etc/X11/xorg.conf, /etc/X11/.xorg.conf).
+foreach $cfg (@cfg_files)
+{
+ if (open(CFG, $cfg))
+ {
+ open(TMP, ">$temp") or die "Can't create $TMP: $!\n";
+
+ my $in_section = 0;
+
+ while (defined ($line = <CFG>))
+ {
+ if ($line =~ /^\s*Section\s*"([a-zA-Z]+)"/i)
+ {
+ my $section = lc($1);
+ if ($section eq "device")
+ {
+ $in_section = 1;
+ }
+ }
+ else
+ {
+ if ($line =~ /^\s*EndSection/i)
+ {
+ $in_section = 0;
+ }
+ }
+
+ if ($in_section)
+ {
+ if ($line =~ /^\s*driver\s+\"(?:fbdev|vga|vesa|vboxvideo|ChangeMe)\"/i)
+ {
+ $line = " Driver \"$driver_name\"\n";
+ }
+ }
+ print TMP $line;
+ }
+
+ close(TMP);
+
+ rename $cfg, $cfg.".bak";
+ system("cp $temp $cfg");
+ unlink $temp;
+
+ # Solaris specific: Rename our modified .xorg.conf to xorg.conf for it to be used
+ if (($os_type =~ 'SunOS') && ($cfg =~ '/etc/X11/.xorg.conf'))
+ {
+ system("mv -f $cfg /etc/X11/xorg.conf");
+ }
+
+ $config_count++;
+ }
+}
+
+$config_count != 0 or die "Could not find any X11 configuration files";
+
diff --git a/src/VBox/Additions/x11/Installer/x11config15suse.pl b/src/VBox/Additions/x11/Installer/x11config15suse.pl
new file mode 100755
index 00000000..21ab2876
--- /dev/null
+++ b/src/VBox/Additions/x11/Installer/x11config15suse.pl
@@ -0,0 +1,166 @@
+#!/usr/bin/perl -w
+# $Id: x11config15suse.pl $
+## @file
+# Guest Additions X11 config update script
+#
+
+#
+# Copyright (C) 2006-2022 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
+#
+
+# Versions of (open)SUSE which ship X.Org Server 1.5 still do not enable
+# mouse autodetection, so on these systems we have to enable vboxmouse in the
+# X.Org configuration file as well as vboxvideo. When uninstalling, we enable
+# the fbdev driver, which SUSE prefers over vesa, and we leave the references
+# to vboxmouse in place, as without the driver they are harmless.
+
+use File::Copy;
+
+# This is the file name for the temporary file we write the new configuration
+# to.
+# @todo: perl must have an API for generating this
+my $temp="/tmp/xorg.conf";
+# The list of possible names of X.org configuration files
+my @cfg_files = ("/etc/X11/xorg.conf-4", "/etc/X11/xorg.conf", "/etc/X11/.xorg.conf", "/etc/xorg.conf",
+ "/usr/etc/X11/xorg.conf-4", "/usr/etc/X11/xorg.conf", "/usr/lib/X11/xorg.conf-4",
+ "/usr/lib/X11/xorg.conf");
+# File descriptor of the old configuration file
+my $CFG;
+# File descriptor of the temporary file
+my $TMP;
+
+# The name of the mouse driver we are enabling
+my $mousedrv = 'vboxmouse';
+# The name of the video driver we are enabling
+my $videodrv= 'vboxvideo';
+
+# If we are uninstalling, restore the old video driver
+if (@ARGV && "$ARGV[0]" eq 'uninstall')
+{
+ $videodrv = 'fbdev' # SUSE prefers this one
+}
+
+# How many different configuration files have we found?
+my $config_count = 0;
+
+# Subroutine to roll back after a partial installation
+sub do_fail {
+ foreach $cfg (@cfg_files) {
+ move "$cfg.vbox", $cfg;
+ unlink "$cfg.vbox";
+ }
+ die $_[0];
+}
+
+# Perform the substitution on any configuration file we may find.
+foreach $cfg (@cfg_files) {
+
+ if (open(CFG, $cfg)) {
+ open(TMP, ">$temp")
+ or &do_fail("Can't create $TMP: $!\n");
+
+ my $have_mouse = 0;
+ my $in_section = 0;
+ my $in_layout = 0;
+
+ # Go through the configuration file line by line
+ while (defined ($line = <CFG>)) {
+ # Look for the start of sections
+ if ($line =~ /^\s*Section\s*"([a-zA-Z]+)"/i) {
+ my $section = lc($1);
+ # And see if they are device or input device sections
+ if (($section eq "inputdevice") || $section eq "device") {
+ $in_section = 1;
+ }
+ # Or server layout sections
+ if ($section eq "serverlayout")
+ {
+ $in_section = 1;
+ $in_layout = 1;
+ }
+ } else {
+ if ($line =~ /^\s*EndSection/i && $in_layout) {
+ # We always add this to the end of the server layout.
+ print TMP " InputDevice \"VBoxMouse\"\n"
+ }
+ if ($line =~ /^\s*EndSection/i) {
+ $in_section = 0;
+ $in_layout = 0;
+ }
+ }
+
+ if ($in_section) {
+ # Inside sections, look for any graphics drivers and replace
+ # them with our one.
+ if ($line =~ /^\s*driver\s+\"(fbdev|vga|vesa|vboxvideo|ChangeMe)\"/i) {
+ $line =~ s/(fbdev|vga|vesa|vboxvideo|ChangeMe)/$videodrv/i;
+ }
+ # Also keep track of whether this configuration file contains
+ # an input device section for vboxmouse. If it does, we don't
+ # need to add one later.
+ if ($line =~ /^\s*driver\s+\"(?:vboxmouse)\"/i)
+ {
+ $have_mouse = 1
+ }
+
+ # We add vboxmouse to the server layout section ourselves, so
+ # remove any existing references to it.
+ if ( $line =~ /^\s*inputdevice.*\"vboxmouse\"/i)
+ {
+ $line = "";
+ }
+ }
+ print TMP $line;
+ }
+
+ # We always add a vboxmouse section at the end for SUSE guests using
+ # X.Org 1.5 if vboxmouse is not referenced anywhere else in the file,
+ # and we do not remove it when we uninstall the additions, as it will
+ # not do any harm if it is left.
+ if (!$have_mouse) {
+ print TMP "\n";
+ print TMP "Section \"InputDevice\"\n";
+ print TMP " Identifier \"VBoxMouse\"\n";
+ print TMP " Driver \"$mousedrv\"\n";
+ print TMP " Option \"Device\" \"\/dev\/vboxguest\"\n";
+ print TMP " Option \"SendCoreEvents\" \"on\"\n";
+ print TMP "EndSection\n";
+ }
+ close(TMP);
+
+ # We do not overwrite existing "$cfg.vbox" files in order to keep a
+ # record of what the configuration looked like before the very first
+ # installation of the additions.
+ copy $cfg, "$cfg.bak";
+ if (! -e "$cfg.vbox") {
+ rename $cfg, "$cfg.vbox";
+ }
+ copy $temp, $cfg
+ or &do_fail("Could not overwrite configuration file $cfg! Exiting...");
+ unlink $temp;
+
+ $config_count++;
+ }
+}
+
+# Warn if we did not find any configuration files
+$config_count != 0 or die "Could not find any X11 configuration files";
+
diff --git a/src/VBox/Additions/x11/Installer/x11restore.pl b/src/VBox/Additions/x11/Installer/x11restore.pl
new file mode 100755
index 00000000..9b52333c
--- /dev/null
+++ b/src/VBox/Additions/x11/Installer/x11restore.pl
@@ -0,0 +1,77 @@
+#!/usr/bin/perl -w
+# $Id: x11restore.pl $
+## @file
+# Restore xorg.conf while removing Guest Additions.
+#
+
+#
+# Copyright (C) 2008-2022 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
+#
+
+
+my $os_type=`uname -s`;
+my @cfg_files = ("/etc/X11/xorg.conf-4", "/etc/X11/xorg.conf", "/etc/X11/.xorg.conf", "/etc/xorg.conf",
+ "/usr/etc/X11/xorg.conf-4", "/usr/etc/X11/xorg.conf", "/usr/lib/X11/xorg.conf-4",
+ "/usr/lib/X11/xorg.conf", "/etc/X11/XF86Config-4", "/etc/X11/XF86Config",
+ "/etc/XF86Config", "/usr/X11R6/etc/X11/XF86Config-4", "/usr/X11R6/etc/X11/XF86Config",
+ "/usr/X11R6/lib/X11/XF86Config-4", "/usr/X11R6/lib/X11/XF86Config");
+my $CFG;
+my $BAK;
+
+my $config_count = 0;
+my $vboxpresent = "vboxvideo";
+
+foreach $cfg (@cfg_files)
+{
+ if (open(CFG, $cfg))
+ {
+ @array=<CFG>;
+ close(CFG);
+
+ foreach $line (@array)
+ {
+ if ($line =~ /$vboxpresent/)
+ {
+ if (open(BAK, $cfg.".bak"))
+ {
+ close(BAK);
+ rename $cfg.".bak", $cfg;
+ }
+ else
+ {
+ # On Solaris just delete existing conf if backup is not found (Possible on distros like Indiana)
+ if ($os_type =~ 'SunOS')
+ {
+ unlink $cfg
+ }
+ else
+ {
+ die "Failed to restore xorg.conf! Your existing config. still uses VirtualBox drivers!!";
+ }
+ }
+ }
+ }
+ $config_count++;
+ }
+}
+
+$config_count != 0 or die "Could not find backed-up xorg.conf to restore it.";
+