VirtualBox

source: vbox/trunk/src/VBox/Additions/linux/installer/x11config.pl@ 438

Last change on this file since 438 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1#!/usr/bin/perl -w
2#
3# InnoTek VirtualBox
4#
5# Linux Additions X11 config update script
6#
7# Copyright (C) 2006 InnoTek Systemberatung GmbH
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 as published by the Free Software Foundation,
13# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14# distribution. VirtualBox OSE is distributed in the hope that it will
15# be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17# If you received this file as part of a commercial VirtualBox
18# distribution, then only the terms of your commercial VirtualBox
19# license agreement apply instead of the previous paragraph.
20#
21
22my $temp="/tmp/xorg.conf";
23my @cfg_files = ("/etc/X11/xorg.conf-4", "/etc/X11/xorg.conf", "/etc/xorg.conf",
24 "/usr/etc/X11/xorg.conf-4", "/usr/etc/X11/xorg.conf", "/usr/lib/X11/xorg.conf-4",
25 "/usr/lib/X11/xorg.conf", "/etc/X11/XF86Config-4", "/etc/X11/XF86Config",
26 "/etc/XF86Config", "/usr/X11R6/etc/X11/XF86Config-4", "/usr/X11R6/etc/X11/XF86Config",
27 "/usr/X11R6/lib/X11/XF86Config-4", "/usr/X11R6/lib/X11/XF86Config");
28my $CFG;
29my $TMP;
30
31my $count_config = 0;
32
33foreach $cfg (@cfg_files)
34{
35
36 if (open(CFG, $cfg))
37 {
38 open(TMP, ">$temp") or die "Can't create $TMP: $!\n";
39
40 my $have_mouse = 0;
41 my $in_section = 0;
42
43 while (defined ($line = <CFG>))
44 {
45 if ($line =~ /^\s*Section\s*"([a-zA-Z]+)"/i)
46 {
47 my $section = lc($1);
48 if (($section eq "inputdevice") || ($section eq "device"))
49 {
50 $in_section = 1;
51 }
52 } else {
53 if ($line =~ /^\s*EndSection/i)
54 {
55 $in_section = 0;
56 }
57 }
58
59 if ($in_section)
60 {
61 if ($line =~ /^\s*driver\s+\"(?:mouse|vboxmouse)\"/i)
62 {
63 $line = " Driver \"vboxmouse\"\n";
64 $have_mouse = 1
65 }
66
67 if ($line =~ /^\s*driver\s+\"(?:fbdev|vga|vesa|vboxvideo|ChangeMe)\"/i)
68 {
69 $line = " Driver \"vboxvideo\"\n";
70 }
71 }
72 print TMP $line;
73 }
74
75 rename $cfg, $cfg.".bak";
76 rename $temp, $cfg;
77
78 if ($have_mouse == 0) {
79 system("echo >> $cfg");
80 system("echo 'Section \"InputDevice\"' >> $cfg");
81 system("echo ' Identifier \"VBoxMouse\"' >> $cfg");
82 system("echo ' Driver \"vboxmouse\"' >> $cfg");
83 system("echo ' Option \"CorePointer\"' >> $cfg");
84 system("echo 'EndSection' >> $cfg");
85 }
86 $config_count++;
87 }
88}
89
90$config_count != 0 or die "Could not find any X11 configuration files";
Note: See TracBrowser for help on using the repository browser.

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