VirtualBox

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

Last change on this file since 59010 was 50345, checked in by vboxsync, 11 years ago

Additions/solaris/Installer: Support VMSVGA.

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