postinstall.sh revision 9b5e4e8f5c00e8cd2289a73d173c96e551c79397
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt# VirtualBox postinstall script for Solaris.
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt# Copyright (C) 2008-2010 Oracle Corporation
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt# This file is part of VirtualBox Open Source Edition (OSE), as
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt# available from http://www.virtualbox.org. This file is free software;
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt# you can redistribute it and/or modify it under the terms of the GNU
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt# General Public License (GPL) as published by the Free Software
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt# Foundation, in version 2 as it comes in the "COPYING" file of the
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt# The contents of this file may alternatively be used under the terms
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt# of the Common Development and Distribution License Version 1.0
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt# VirtualBox OSE distribution, in which case the provisions of the
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt# CDDL are applicable instead of those of the GPL.
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt# You may elect to license modified versions of this file under the
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt# terms and conditions of either the GPL or the CDDL or both.
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt# uncompress(directory, file)
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt# Updates package metadata and uncompresses the file.
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt # Uncompress the file (removes compressed file when done)
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt PKGFMRI=`$BIN_PKG contents -H -t set -a name=pkg.fmri -o pkg.fmri pkg:/system/kernel 2> /dev/null`
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt # The format is "pkg://solaris/system/kernel@0.5.11,5.11-0.161:20110315T070332Z"
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt # or "pkg://solaris/system/kernel@0.5.11,5.11-0.175.0.0.0.1.0:20111012T032837Z"
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt STR_KERN=`echo "$PKGFMRI" | sed 's/^.*\@//;s/\:.*//;s/.*,//'`
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt # The format is "5.11-0.161" or "5.11-0.175.0.0.0.1.0"
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt HOST_OS_MAJORVERSION=`echo "$STR_KERN" | cut -f1 -d'-'`
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt HOST_OS_MINORVERSION=`echo "$STR_KERN" | cut -f2 -d'-' | cut -f2 -d '.'`
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt abort "Failed to parse the Solaris kernel version."
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt abort "Failed to detect the Solaris kernel version."
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt if test -z "$HOST_OS_MAJORVERSION" || test "$HOST_OS_MAJORVERSION" != "5.10"; then
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt abort "Solaris $HOST_OS_MAJOR_VERSION detected without executable $BIN_PKG !? Confused."
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt # Major version is S10, Minor version is no longer relevant (or used), use uname -v so it gets something
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt # like "Generic_blah" for purely cosmetic purposes
if test -f "$vboxadditions32_path/VBoxClient.Z" || test -f "$vboxadditions64_path/VBoxClient.Z"; then
if test -f "$vboxadditions32_path/VBoxClient.Z"; then
if test -f "$vboxadditions64_path/VBoxClient.Z"; then
# vboxguest.sh would've been installed, we just need to call it.
if test ! -z "$xorgbin"; then
if test -z "$xorgversion_long"; then
if test -z "$vboxmouse_src"; then
echo "Installing mouse and video drivers for X.Org $xorgversion..."
if test ! -d $vboxmouse32_dest_base; then
if test ! -d $vboxvideo32_dest_base; then
# We try to detect this by looking at bitness of "mouse_drv.so", and adjust our destination paths accordingly.
# We do not rely on using Xorg -version's ABI output because some builds (snv_162 iirc) have 64-bit ABI with
if test -f "$vboxmouse32_dest_base/mouse_drv.so"; then
echo "* Warning mouse_drv.so missing. Assuming Xorg ABI is 64-bit..."
if test -z "$bitsize"; then
if test ! -d $vboxmouse32_dest_base || test ! -d $vboxvideo32_dest_base || test ! -d $vboxmouse64_dest_base || test ! -d $vboxvideo64_dest_base; then
if test -f "$vboxadditions64_path/$vboxmouse_src"; then
# Some distros like Indiana have no xorg.conf, deal with this
# Xorg 1.3.x+ should use the modeline less Xorg confs while older should
if test -d "$vboxclient_dest"; then
/usr/sbin/installf -c none $PKGINST $vboxclient_dest/vboxclient.desktop=$vboxadditions_path/vboxclient.desktop s
if test -d "$vboxclient_dest"; then
/usr/sbin/installf -c none $PKGINST $vboxclient_dest/1099.vboxclient=$vboxadditions_path/1099.vboxclient s
if test -d "$vboxclient_dest"; then
/usr/sbin/installf -c none $PKGINST $vboxclient_dest/1099.vboxclient=$vboxadditions_path/1099.vboxclient s
# Move the appropriate module to kernel/fs & remove the unused module name from pkg and file from disk
if test -f "$vboxadditions64_path/$vboxfsmod"; then
if test -f "$vboxadditions32_path/$vboxfsmod"; then
# install openGL extensions for X.Org
if test ! -z "$xorgbin"; then
if test -f "/usr/lib/VBoxOGL.so"; then
if test -f "/usr/lib/amd64/VBoxOGL.so"; then
if test -x "$BOOTADMBIN"; then
echo "## $BOOTADMBIN not found/executable. Skipped explicit boot-archive update."
if test ! -z "$xorgbin"; then
exit $retval