preremove.sh revision cfd41a3683178a30bac4417128b4673806653797
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync#!/bin/sh
ee29f83d0638dba8e0380d7f594fe2d726d9403cvboxsync# Sun xVM VirtualBox
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync# VirtualBox pre-remove script for Solaris Guest Additions.
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync#
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync# Copyright (C) 2008 Sun Microsystems, Inc.
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#
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync# Clara, CA 95054 USA or visit http://www.sun.com if you need
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync# additional information or have any questions.
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync#
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync
d0d8559364df06561788980a7a491598eae64fa2vboxsyncecho "Sun xVM VirtualBox Guest Additions - preremove script"
7bff28e0cedd8656acd24b420759649184d8cf00vboxsyncecho "This script will unload the VirtualBox Guest kernel module..."
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync# stop and unregister VBoxService daemon
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync/usr/sbin/svcadm disable -s svc:/system/virtualbox/vboxservice:default
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync/usr/sbin/svccfg delete svc:/system/virtualbox/vboxservice:default
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync
e32fab83316e8fae9d8498539a3510320f610af6vboxsync# stop VBoxClient
e32fab83316e8fae9d8498539a3510320f610af6vboxsyncpkill -INT VBoxClient
e32fab83316e8fae9d8498539a3510320f610af6vboxsync
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync# vboxguest.sh would've been installed, we just need to call it.
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync/opt/VirtualBoxAdditions/vboxguest.sh stop
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
cfd41a3683178a30bac4417128b4673806653797vboxsyncfi
cfd41a3683178a30bac4417128b4673806653797vboxsync
f902ede7eb073d09a81c1d470c089c7b14921714vboxsync# Try and restore xorg.conf!
f902ede7eb073d09a81c1d470c089c7b14921714vboxsyncecho "Restoring Xorg..."
f902ede7eb073d09a81c1d470c089c7b14921714vboxsync/opt/VirtualBoxAdditions/x11restore.pl
f902ede7eb073d09a81c1d470c089c7b14921714vboxsync
7bff28e0cedd8656acd24b420759649184d8cf00vboxsyncecho "Done."
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync