postinstall.sh revision c4c106ad74e0ad745ac49a2c4182c4f42ced7248
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync#!/bin/sh
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# innotek VirtualBox
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# VirtualBox postinstall script for Solaris.
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync#
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# Copyright (C) 2008 innotek GmbH
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync#
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# available from http://www.virtualbox.org. This file is free software;
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# you can redistribute it and/or modify it under the terms of the GNU
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# General Public License (GPL) as published by the Free Software
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync#
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsyncecho "innotek VirtualBox Guest Additions - postinstall script"
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsyncecho "This script will setup and load the VirtualBox Guest kernel module..."
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsyncsync
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsyncvboxadditions_path="/opt/VirtualBoxAdditions"
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# vboxguest.sh would've been installed, we just need to call it.
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync$vboxadditions_path/vboxguest.sh restart silentunload
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# suid permissions for timesync
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsyncecho "Setting permissions..."
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsyncchmod 04755 $vboxadditions_path/VBoxService
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# create links
e366e4992f5d81a0b93412e10d2ef9dc06f930edvboxsyncecho "Creating links..."
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync/usr/sbin/installf -c none $PKGINST /dev/vboxguest=../devices/pci@0,0/pci80ee,cafe@4:vboxguest s
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync/usr/sbin/installf -c none $PKGINST /usr/bin/VBoxClient=$vboxadditions_path/VBoxClient s
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync/usr/sbin/installf -c none $PKGINST /usr/bin/VBoxService=$vboxadditions_path/VBoxService s
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync/usr/sbin/installf -c none $PKGINST /usr/bin/VBoxRandR=$vboxadditions_path/VBoxRandR.sh s
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsync# Install Xorg components to the required places
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsyncxorgversion_long=`/usr/bin/X11/Xorg -version 2>&1 | grep "X Window System Version"`
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsyncxorgversion=`/usr/bin/expr "${xorgversion_long}" : 'X Window System Version \([^ ]*\)'`
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsync
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsyncvboxmouse_src=""
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsyncvboxvideo_src=""
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsync
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsynccase "$xorgversion" in
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsync 1.3.* )
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsync vboxmouse_src="$vboxadditions_path/vboxmouse_drv_71.so"
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsync vboxvideo_src="$vboxadditions_path/vboxvideo_drv_13.so"
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsync ;;
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsync 1.4.* )
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync vboxmouse_src="$vboxadditions_path/vboxmouse_drv_14.so"
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync vboxvideo_src="$vboxadditions_path/vboxvideo_drv_14.so"
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync ;;
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsync 7.1.* | *7.2.* )
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsync vboxmouse_src="$vboxadditions_path/vboxmouse_drv_71.so"
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsync vboxvideo_src="$vboxadditions_path/vboxvideo_drv_71.so"
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsync ;;
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsync 6.9.* | 7.0.* )
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsync vboxmouse_src="$vboxadditions_path/vboxmouse_drv_70.so"
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsync vboxvideo_src="$vboxadditions_path/vboxvideo_drv_70.so"
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsync ;;
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsyncesac
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync
retval=0
if test -z "$vboxmouse_src"; then
echo "*** Unknown version of the X Window System installed."
echo "*** Failed to install the VirtualBox X Window System drivers."
# Exit as partially failed installation
retval=2
else
vboxmouse_dest="/usr/lib/X11/modules/input/vboxmouse_drv.so"
vboxvideo_dest="/usr/lib/X11/modules/input/vboxvideo_drv.so"
/usr/sbin/installf -c none $PKGINST "$vboxmouse_dest" f
/usr/sbin/installf -c none $PKGINST "$vboxvideo_dest" f
cp "$vboxmouse_src" "$vboxmouse_dest"
cp "$vboxvideo_src" "$vboxvideo_dest"
echo "Installed VirtualBox mouse and video drivers for Xorg $xorgversion"
# Removing redudant files
/usr/sbin/removef $PKGINST $vboxadditions_path/vboxmouse_drv_* 1>/dev/null 2>/dev/null
/usr/sbin/removef $PKGINST $vboxadditions_path/vboxvideo_drv_* 1>/dev/null 2>/dev/null
rm -f $vboxadditions_path/vboxmouse_drv_*
rm -f $vboxadditions_path/vboxvideo_drv_*
/usr/sbin/removef -f $PKGINST
# Some distros like Indiana have no xorg.conf, deal with this
if test ! -f '/etc/X11/xorg.conf' && test ! -f '/etc/X11/.xorg.conf'; then
mv -f $vboxadditions_path/solaris_xorg.conf /etc/X11/.xorg.conf
fi
echo "Configuring Xorg..."
$vboxadditions_path/x11config.pl
fi
# Setup our VBoxClient
echo "Configuring client..."
vboxclient_src=$vboxadditions_path
vboxclient_dest="/usr/dt/config/Xsession.d"
if test -d "$vboxclient_dest"; then
/usr/sbin/installf -c none $PKGINST "$vboxclient_dest/1099.vboxclient" f
cp "$vboxclient_src/1099.vboxclient" "$vboxclient_dest/1099.vboxclient"
elif test -d "/usr/share/gnome/autostart"; then
vboxclient_dest="/usr/share/gnome/autostart"
/usr/sbin/installf -c none $PKGINST "$vboxclient_dest/vboxclient.desktop" f
cp "$vboxclient_src/vboxclient.desktop" "$vboxclient_dest/vboxclient.desktop"
else
echo "*** Failed to configure client!! Couldn't find autostart directory."
retval=2
fi
# Remove redundant files
/usr/sbin/removef $PKGINST $vboxadditions_path/etc/devlink.tab 1>/dev/null
/usr/sbin/removef $PKGINST $vboxadditions_path/etc 1>/dev/null
rm -rf $vboxadditions_path/etc
/usr/sbin/removef -f $PKGINST
/usr/sbin/installf -f $PKGINST
# Setup our VBoxService SMF service
echo "Configuring service..."
/usr/sbin/svccfg import /var/svc/manifest/system/virtualbox/vboxservice.xml
/usr/sbin/svcadm enable svc:/system/virtualbox/vboxservice
/usr/sbin/devlinks
echo "Done."
if test $retval -eq 0; then
echo "Please restart X Window System for activating the X11 guest additions."
fi
exit $retval