VirtualBox

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

Last change on this file since 16995 was 8178, checked in by vboxsync, 17 years ago

rebranding

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Revision
File size: 2.3 KB
Line 
1#!/usr/bin/perl -w
2# $Revision: 8178 $
3#
4# Sun xVM VirtualBox
5#
6# Restore xorg.conf while removing Guest Additions.
7#
8# Copyright (C) 2008 Sun Microsystems, Inc.
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# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
19# Clara, CA 95054 USA or visit http://www.sun.com if you need
20# additional information or have any questions.
21#
22
23
24my $os_type=`uname -s`;
25my @cfg_files = ("/etc/X11/xorg.conf-4", "/etc/X11/xorg.conf", "/etc/X11/.xorg.conf", "/etc/xorg.conf",
26 "/usr/etc/X11/xorg.conf-4", "/usr/etc/X11/xorg.conf", "/usr/lib/X11/xorg.conf-4",
27 "/usr/lib/X11/xorg.conf", "/etc/X11/XF86Config-4", "/etc/X11/XF86Config",
28 "/etc/XF86Config", "/usr/X11R6/etc/X11/XF86Config-4", "/usr/X11R6/etc/X11/XF86Config",
29 "/usr/X11R6/lib/X11/XF86Config-4", "/usr/X11R6/lib/X11/XF86Config");
30my $CFG;
31my $BAK;
32
33my $config_count = 0;
34my $vboxpresent = "vboxmouse";
35
36foreach $cfg (@cfg_files)
37{
38 if (open(CFG, $cfg))
39 {
40 @array=<CFG>;
41 close(CFG);
42
43 foreach $line (@array)
44 {
45 if ($line =~ /$vboxpresent/)
46 {
47 if (open(BAK, $cfg.".bak"))
48 {
49 close(BAK);
50 rename $cfg.".bak", $cfg;
51 }
52 else
53 {
54 # On Solaris just delete existing conf if backup is not found (Possible on distros like Indiana)
55 if ($os_type =~ 'SunOS')
56 {
57 unlink $cfg
58 }
59 else
60 {
61 die "Failed to restore xorg.conf! Your existing config. still uses VirtualBox drivers!!";
62 }
63 }
64 }
65 }
66 $config_count++;
67 }
68}
69
70$config_count != 0 or die "Could not find backed-up xorg.conf to restore it.";
71
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