VirtualBox

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

Last change on this file since 99743 was 98103, checked in by vboxsync, 2 years ago

Copyright year updates by scm.

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