VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/Installer/x11config15sol.pl@ 29775

Last change on this file since 29775 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
File size: 4.5 KB
Line 
1#!/usr/bin/perl -w
2#
3# Sun VirtualBox
4#
5# Guest Additions X11 config update script
6#
7# Copyright (C) 2006-2009 Oracle Corporation
8#
9# This file is part of VirtualBox Open Source Edition (OSE), as
10# available from http://www.virtualbox.org. This file is free software;
11# you can redistribute it and/or modify it under the terms of the GNU
12# General Public License (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17
18my $temp="/tmp/xorg.conf";
19my $os_type=`uname -s`;
20my @cfg_files = ("/etc/X11/xorg.conf-4", "/etc/X11/xorg.conf", "/etc/X11/.xorg.conf", "/etc/xorg.conf",
21 "/usr/etc/X11/xorg.conf-4", "/usr/etc/X11/xorg.conf", "/usr/lib/X11/xorg.conf-4",
22 "/usr/lib/X11/xorg.conf", "/etc/X11/XF86Config-4", "/etc/X11/XF86Config",
23 "/etc/XF86Config", "/usr/X11R6/etc/X11/XF86Config-4", "/usr/X11R6/etc/X11/XF86Config",
24 "/usr/X11R6/lib/X11/XF86Config-4", "/usr/X11R6/lib/X11/XF86Config");
25my $CFG;
26my $TMP;
27
28my $config_count = 0;
29
30foreach $cfg (@cfg_files)
31{
32
33 if (open(CFG, $cfg))
34 {
35 open(TMP, ">$temp") or die "Can't create $TMP: $!\n";
36
37 my $have_mouse = 0;
38 my $in_section = 0;
39
40 while (defined ($line = <CFG>))
41 {
42 if ($line =~ /^\s*Section\s*"([a-zA-Z]+)"/i)
43 {
44 my $section = lc($1);
45 if (($section eq "inputdevice") || ($section eq "device"))
46 {
47 $in_section = 1;
48 }
49 if ($section eq "serverlayout")
50 {
51 $in_layout = 1;
52 }
53 } else {
54 if ($line =~ /^\s*EndSection/i)
55 {
56 $in_section = 0;
57 $in_layout = 0;
58 }
59 }
60
61 if ($in_section)
62 {
63 if ($line =~ /^\s*driver\s+\"(?:mouse|vboxmouse)\"/i)
64 {
65 $line = " Driver \"vboxmouse\"\n Option \"CorePointer\"\n";
66 $have_mouse = 1
67 }
68
69 # Other drivers sending events interfere badly with pointer integration
70 if ($line =~ /^\s*option\s+\"(?:alwayscore|sendcoreevents|corepointer)\"/i)
71 {
72 $line = "";
73 }
74
75 # Solaris specific: Use /dev/vboxguest for Xorg 1.5.3+
76 if ($os_type =~ 'SunOS')
77 {
78 if ($line =~ /^\s*option\s+\"(?:device)\"\s+\"(?:\/dev\/kdmouse)\"/i)
79 {
80 $line = " Option \"Device\" \"\/dev\/vboxguest\"\n"
81 }
82
83 if ($line =~ /^\s*option\s+\"(?:device)\"\s+\"(?:\/dev\/mouse)\"/i)
84 {
85 $line = " Option \"Device\" \"\/dev\/vboxguest\"\n"
86 }
87 }
88
89 if ($line =~ /^\s*driver\s+\"(?:fbdev|vga|vesa|vboxvideo|ChangeMe)\"/i)
90 {
91 $line = " Driver \"vboxvideo\"\n";
92 }
93 }
94 if ($in_layout)
95 {
96 # Other drivers sending events interfere badly with pointer integration
97 if ( $line =~ /^\s*inputdevice.*\"(?:alwayscore|sendcoreevents)\"/i)
98 {
99 $line = "";
100 }
101 }
102 print TMP $line;
103 }
104
105 if (!$have_mouse) {
106 print TMP "\n";
107 print TMP "Section \"InputDevice\"\n";
108 print TMP " Identifier \"VBoxMouse\"\n";
109 print TMP " Driver \"vboxmouse\"\n";
110 if ($os_type eq 'SunOS')
111 {
112 print TMP " Option \"Device\" \"\/dev\/vboxguest\"\n";
113 }
114 print TMP " Option \"CorePointer\"\n";
115 print TMP "EndSection\n";
116 }
117 close(TMP);
118
119 rename $cfg, $cfg.".bak";
120 system("cp $temp $cfg");
121 unlink $temp;
122
123 # Solaris specific: Rename our modified .xorg.conf to xorg.conf for it to be used
124 if (($os_type =~ 'SunOS') && ($cfg =~ '/etc/X11/.xorg.conf'))
125 {
126 system("mv -f $cfg /etc/X11/xorg.conf");
127 }
128
129 $config_count++;
130 }
131}
132
133$config_count != 0 or die "Could not find any X11 configuration files";
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette