7bff28e0cedd8656acd24b420759649184d8cf00vboxsync#!/bin/sh
4c03360a8b1f543f717aabb1321ff0bfbd150846vboxsync# $Id$
4c03360a8b1f543f717aabb1321ff0bfbd150846vboxsync## @file
4c03360a8b1f543f717aabb1321ff0bfbd150846vboxsync# VirtualBox preremove script for Solaris Guest Additions.
2291faee92ebb5cc9722cd3f22e499900a5a411fvboxsync#
4c03360a8b1f543f717aabb1321ff0bfbd150846vboxsync
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync#
4c03360a8b1f543f717aabb1321ff0bfbd150846vboxsync# Copyright (C) 2008-2013 Oracle Corporation
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync#
9496b6f77d66eb89f088668752b8838d578d6e10vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
9496b6f77d66eb89f088668752b8838d578d6e10vboxsync# available from http://www.virtualbox.org. This file is free software;
9496b6f77d66eb89f088668752b8838d578d6e10vboxsync# you can redistribute it and/or modify it under the terms of the GNU
9496b6f77d66eb89f088668752b8838d578d6e10vboxsync# General Public License (GPL) as published by the Free Software
9496b6f77d66eb89f088668752b8838d578d6e10vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
9496b6f77d66eb89f088668752b8838d578d6e10vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
9496b6f77d66eb89f088668752b8838d578d6e10vboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync#
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync# The contents of this file may alternatively be used under the terms
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync# of the Common Development and Distribution License Version 1.0
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync# VirtualBox OSE distribution, in which case the provisions of the
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync# CDDL are applicable instead of those of the GPL.
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync#
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync# You may elect to license modified versions of this file under the
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync# terms and conditions of either the GPL or the CDDL or both.
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync#
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync
b28acfbccfb51c10f8c08887210a7231cf7bce98vboxsyncLC_ALL=C
b28acfbccfb51c10f8c08887210a7231cf7bce98vboxsyncexport LC_ALL
b28acfbccfb51c10f8c08887210a7231cf7bce98vboxsync
b28acfbccfb51c10f8c08887210a7231cf7bce98vboxsyncLANG=C
b28acfbccfb51c10f8c08887210a7231cf7bce98vboxsyncexport LANG
b28acfbccfb51c10f8c08887210a7231cf7bce98vboxsync
9b5e4e8f5c00e8cd2289a73d173c96e551c79397vboxsyncecho "Removing VirtualBox service..."
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync
69069b36d01e6c0e9965baca5fcb58d57a1030b6vboxsync# stop and unregister VBoxService
69069b36d01e6c0e9965baca5fcb58d57a1030b6vboxsync/usr/sbin/svcadm disable -s virtualbox/vboxservice
9b5e4e8f5c00e8cd2289a73d173c96e551c79397vboxsync# Don't need to delete, taken care of by the manifest action
9b5e4e8f5c00e8cd2289a73d173c96e551c79397vboxsync# /usr/sbin/svccfg delete svc:/application/virtualbox/vboxservice:default
61aab69cad4c5f9572bc6d00fb4acee64a1d37e9vboxsync/usr/sbin/svcadm restart svc:/system/manifest-import:default
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync
e32fab83316e8fae9d8498539a3510320f610af6vboxsync# stop VBoxClient
e32fab83316e8fae9d8498539a3510320f610af6vboxsyncpkill -INT VBoxClient
e32fab83316e8fae9d8498539a3510320f610af6vboxsync
9b5e4e8f5c00e8cd2289a73d173c96e551c79397vboxsyncecho "Removing VirtualBox kernel modules..."
9b5e4e8f5c00e8cd2289a73d173c96e551c79397vboxsync
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync# vboxguest.sh would've been installed, we just need to call it.
9b5e4e8f5c00e8cd2289a73d173c96e551c79397vboxsync/opt/VirtualBoxAdditions/vboxguest.sh stopall silentunload
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync
cfd41a3683178a30bac4417128b4673806653797vboxsync# remove devlink.tab entry for vboxguest
cfd41a3683178a30bac4417128b4673806653797vboxsyncsed -e '
cfd41a3683178a30bac4417128b4673806653797vboxsync/name=vboxguest/d' /etc/devlink.tab > /etc/devlink.vbox
cfd41a3683178a30bac4417128b4673806653797vboxsyncmv -f /etc/devlink.vbox /etc/devlink.tab
cfd41a3683178a30bac4417128b4673806653797vboxsync
cfd41a3683178a30bac4417128b4673806653797vboxsync# remove the link
cfd41a3683178a30bac4417128b4673806653797vboxsyncif test -h "/dev/vboxguest" || test -f "/dev/vboxguest"; then
cfd41a3683178a30bac4417128b4673806653797vboxsync rm -f /dev/vboxdrv
be88eda1ae15cc22a784487c5d4579df3e003016vboxsyncfi
e27467c77543dda00047807bdd69b62f1cd50feevboxsyncif test -h "/dev/vboxms" || test -f "/dev/vboxms"; then
e27467c77543dda00047807bdd69b62f1cd50feevboxsync rm -f /dev/vboxms
cfd41a3683178a30bac4417128b4673806653797vboxsyncfi
cfd41a3683178a30bac4417128b4673806653797vboxsync
f902ede7eb073d09a81c1d470c089c7b14921714vboxsync# Try and restore xorg.conf!
e12a6ea07ddb7a02b3575e78b24960e13f42bf4cvboxsyncecho "Restoring X.Org..."
f902ede7eb073d09a81c1d470c089c7b14921714vboxsync/opt/VirtualBoxAdditions/x11restore.pl
f902ede7eb073d09a81c1d470c089c7b14921714vboxsync
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync# Restore crogl symlink mess
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync# 32-bit crogl opengl library replacement
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsyncif test -f "/usr/lib/VBoxOGL.so" && test -f "/usr/X11/lib/mesa/libGL_original_.so.1"; then
d35532896f22cd903ae9d2e71e457454fd85b157vboxsync mv -f /usr/X11/lib/mesa/libGL_original_.so.1 /usr/X11/lib/mesa/libGL.so.1
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsyncfi
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync# 64-bit crogl opengl library replacement
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsyncif test -f "/usr/lib/amd64/VBoxOGL.so" && test -f "/usr/X11/lib/mesa/amd64/libGL_original_.so.1"; then
d35532896f22cd903ae9d2e71e457454fd85b157vboxsync mv -f /usr/X11/lib/mesa/amd64/libGL_original_.so.1 /usr/X11/lib/mesa/amd64/libGL.so.1
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsyncfi
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync
6e3cc82d5d5effda92c9fec18b870d54386f99favboxsync
7bff28e0cedd8656acd24b420759649184d8cf00vboxsyncecho "Done."
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync