VirtualBox

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

Last change on this file since 93115 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Revision Id
File size: 2.1 KB
Line 
1#!/usr/bin/perl -w
2# $Id: x11restore.pl 93115 2022-01-01 11:31:46Z vboxsync $
3## @file
4# Restore xorg.conf while removing Guest Additions.
5#
6
7#
8# Copyright (C) 2008-2022 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
19
20my $os_type=`uname -s`;
21my @cfg_files = ("/etc/X11/xorg.conf-4", "/etc/X11/xorg.conf", "/etc/X11/.xorg.conf", "/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");
26my $CFG;
27my $BAK;
28
29my $config_count = 0;
30my $vboxpresent = "vboxvideo";
31
32foreach $cfg (@cfg_files)
33{
34 if (open(CFG, $cfg))
35 {
36 @array=<CFG>;
37 close(CFG);
38
39 foreach $line (@array)
40 {
41 if ($line =~ /$vboxpresent/)
42 {
43 if (open(BAK, $cfg.".bak"))
44 {
45 close(BAK);
46 rename $cfg.".bak", $cfg;
47 }
48 else
49 {
50 # On Solaris just delete existing conf if backup is not found (Possible on distros like Indiana)
51 if ($os_type =~ 'SunOS')
52 {
53 unlink $cfg
54 }
55 else
56 {
57 die "Failed to restore xorg.conf! Your existing config. still uses VirtualBox drivers!!";
58 }
59 }
60 }
61 }
62 $config_count++;
63 }
64}
65
66$config_count != 0 or die "Could not find backed-up xorg.conf to restore it.";
67
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