VirtualBox

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

Last change on this file since 33428 was 32388, checked in by vboxsync, 14 years ago

more branding fixes

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