VirtualBox

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

Last change on this file since 91999 was 82968, checked in by vboxsync, 5 years ago

Copyright year updates by scm.

  • 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 82968 2020-02-04 10:35:17Z vboxsync $
3## @file
4# Guest Additions X11 config update script
5#
6
7#
8# Copyright (C) 2006-2020 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