VirtualBox

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

Last change on this file since 34575 was 32388, checked in by vboxsync, 14 years ago

more branding fixes

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Revision
File size: 2.1 KB
Line 
1#!/usr/bin/perl -w
2# $Revision: 32388 $
3#
4# Restore xorg.conf while removing Guest Additions.
5#
6# Copyright (C) 2008-2010 Oracle Corporation
7#
8# This file is part of VirtualBox Open Source Edition (OSE), as
9# available from http://www.virtualbox.org. This file is free software;
10# you can redistribute it and/or modify it under the terms of the GNU
11# General Public License (GPL) as published by the Free Software
12# Foundation, in version 2 as it comes in the "COPYING" file of the
13# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15#
16
17
18my $os_type=`uname -s`;
19my @cfg_files = ("/etc/X11/xorg.conf-4", "/etc/X11/xorg.conf", "/etc/X11/.xorg.conf", "/etc/xorg.conf",
20 "/usr/etc/X11/xorg.conf-4", "/usr/etc/X11/xorg.conf", "/usr/lib/X11/xorg.conf-4",
21 "/usr/lib/X11/xorg.conf", "/etc/X11/XF86Config-4", "/etc/X11/XF86Config",
22 "/etc/XF86Config", "/usr/X11R6/etc/X11/XF86Config-4", "/usr/X11R6/etc/X11/XF86Config",
23 "/usr/X11R6/lib/X11/XF86Config-4", "/usr/X11R6/lib/X11/XF86Config");
24my $CFG;
25my $BAK;
26
27my $config_count = 0;
28my $vboxpresent = "vboxmouse";
29
30foreach $cfg (@cfg_files)
31{
32 if (open(CFG, $cfg))
33 {
34 @array=<CFG>;
35 close(CFG);
36
37 foreach $line (@array)
38 {
39 if ($line =~ /$vboxpresent/)
40 {
41 if (open(BAK, $cfg.".bak"))
42 {
43 close(BAK);
44 rename $cfg.".bak", $cfg;
45 }
46 else
47 {
48 # On Solaris just delete existing conf if backup is not found (Possible on distros like Indiana)
49 if ($os_type =~ 'SunOS')
50 {
51 unlink $cfg
52 }
53 else
54 {
55 die "Failed to restore xorg.conf! Your existing config. still uses VirtualBox drivers!!";
56 }
57 }
58 }
59 }
60 $config_count++;
61 }
62}
63
64$config_count != 0 or die "Could not find backed-up xorg.conf to restore it.";
65
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