VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/Installer/x11restore.pl@ 105931

Last change on this file since 105931 was 101937, checked in by vboxsync, 13 months ago

Additions/solaris/{Installer,vboxms,vboxservice}: Add support for the
Solaris Guest Additions to be installed into an alternate root path
('pkgad -R'). This also enables the Solaris GAs to be installed in an
automated fashion when building Solaris images using the distribution
constructor (aka the distro_const(8) utility).

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Revision Id
File size: 2.5 KB
Line 
1#!/usr/bin/perl -w
2# $Id: x11restore.pl 101937 2023-11-07 12:15:59Z vboxsync $
3## @file
4# Restore xorg.conf while removing Guest Additions.
5#
6
7#
8# Copyright (C) 2008-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
29
30my $os_type=`uname -s`;
31my @cfg_files = ("/etc/X11/xorg.conf-4", "/etc/X11/xorg.conf", "/etc/X11/.xorg.conf", "/etc/xorg.conf",
32 "/usr/etc/X11/xorg.conf-4", "/usr/etc/X11/xorg.conf", "/usr/lib/X11/xorg.conf-4",
33 "/usr/lib/X11/xorg.conf", "/etc/X11/XF86Config-4", "/etc/X11/XF86Config",
34 "/etc/XF86Config", "/usr/X11R6/etc/X11/XF86Config-4", "/usr/X11R6/etc/X11/XF86Config",
35 "/usr/X11R6/lib/X11/XF86Config-4", "/usr/X11R6/lib/X11/XF86Config");
36my $CFG;
37my $BAK;
38
39my $config_count = 0;
40my $vboxpresent = "vboxvideo";
41
42foreach $cfg (@cfg_files)
43{
44 if (($os_type =~ 'SunOS') && (defined $ENV{PKG_INSTALL_ROOT}))
45 {
46 $cfg = $ENV{PKG_INSTALL_ROOT}.$cfg;
47 }
48 if (open(CFG, $cfg))
49 {
50 @array=<CFG>;
51 close(CFG);
52
53 foreach $line (@array)
54 {
55 if ($line =~ /$vboxpresent/)
56 {
57 if (open(BAK, $cfg.".bak"))
58 {
59 close(BAK);
60 print("Restoring $cfg.back to $cfg.\n");
61 rename $cfg.".bak", $cfg;
62 }
63 else
64 {
65 # On Solaris just delete existing conf if backup is not found (Possible on distros like Indiana)
66 if ($os_type =~ 'SunOS')
67 {
68 unlink $cfg
69 }
70 else
71 {
72 die "Failed to restore xorg.conf! Your existing config. still uses VirtualBox drivers!!";
73 }
74 }
75 }
76 }
77 $config_count++;
78 }
79}
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