VirtualBox

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

Last change on this file since 69498 was 69498, checked in by vboxsync, 7 years ago

backed out r118835 as it incorrectly updated the 'This file is based on' file headers.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id Revision
File size: 3.1 KB
Line 
1#!/usr/bin/perl
2# $Id: x11config15sol.pl 69498 2017-10-28 15:07:25Z vboxsync $
3## @file
4# Guest Additions X11 config update script
5#
6
7#
8# Copyright (C) 2006-2012 Oracle Corporation
9#
10# This file is part of VirtualBox Open Source Edition (OSE), as
11# available from http://www.virtualbox.org. This file is free software;
12# you can redistribute it and/or modify it under the terms of the GNU
13# General Public License (GPL) as published by the Free Software
14# Foundation, in version 2 as it comes in the "COPYING" file of the
15# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17#
18
19use strict;
20use warnings;
21
22my $temp="/tmp/xorg.conf";
23my $os_type=`uname -s`;
24my @cfg_files = ("/etc/X11/xorg.conf", "/etc/X11/.xorg.conf", "/etc/X11/xorg.conf-4", "/etc/xorg.conf",
25 "/usr/etc/X11/xorg.conf-4", "/usr/etc/X11/xorg.conf", "/usr/lib/X11/xorg.conf-4",
26 "/usr/lib/X11/xorg.conf", "/etc/X11/XF86Config-4", "/etc/X11/XF86Config",
27 "/etc/XF86Config", "/usr/X11R6/etc/X11/XF86Config-4", "/usr/X11R6/etc/X11/XF86Config",
28 "/usr/X11R6/lib/X11/XF86Config-4", "/usr/X11R6/lib/X11/XF86Config");
29
30## @todo: r=ramshankar: Hmm, why do we use the same variable name with upper/lower case for different variables?
31my $cfg;
32my $CFG;
33my $TMP;
34my $line;
35my $config_count = 0;
36
37# Command line options
38if ($#ARGV < 0)
39{
40 die "x11config15sol.pl: Missing driver name argument to configure for X.org";
41}
42my $driver_name = $ARGV[0];
43
44# Loop through all possible config files and change them. It's done this wasy for hysterical raisins
45# as we didn't know what the correct config file is so we update all of them. However, for Solaris it's
46# most likely -only- one of the 2 config files (/etc/X11/xorg.conf, /etc/X11/.xorg.conf).
47foreach $cfg (@cfg_files)
48{
49 if (open(CFG, $cfg))
50 {
51 open(TMP, ">$temp") or die "Can't create $TMP: $!\n";
52
53 my $in_section = 0;
54
55 while (defined ($line = <CFG>))
56 {
57 if ($line =~ /^\s*Section\s*"([a-zA-Z]+)"/i)
58 {
59 my $section = lc($1);
60 if ($section eq "device")
61 {
62 $in_section = 1;
63 }
64 }
65 else
66 {
67 if ($line =~ /^\s*EndSection/i)
68 {
69 $in_section = 0;
70 }
71 }
72
73 if ($in_section)
74 {
75 if ($line =~ /^\s*driver\s+\"(?:fbdev|vga|vesa|vboxvideo|ChangeMe)\"/i)
76 {
77 $line = " Driver \"$driver_name\"\n";
78 }
79 }
80 print TMP $line;
81 }
82
83 close(TMP);
84
85 rename $cfg, $cfg.".bak";
86 system("cp $temp $cfg");
87 unlink $temp;
88
89 # Solaris specific: Rename our modified .xorg.conf to xorg.conf for it to be used
90 if (($os_type =~ 'SunOS') && ($cfg =~ '/etc/X11/.xorg.conf'))
91 {
92 system("mv -f $cfg /etc/X11/xorg.conf");
93 }
94
95 $config_count++;
96 }
97}
98
99$config_count != 0 or die "Could not find any X11 configuration files";
100
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