postinstall.sh revision 9ced981a0263f6280ccbf5dc64c0e81fbe4a2fda
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync#!/bin/sh
332d68e9666b04a5aa788a586d9f4c6b1f19c700vboxsync# innotek VirtualBox
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync# VirtualBox postinstall script for Solaris.
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync#
332d68e9666b04a5aa788a586d9f4c6b1f19c700vboxsync# Copyright (C) 2008 innotek GmbH
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
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsyncecho "innotek VirtualBox Guest Additions - postinstall script"
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsyncecho "This script will setup and load the VirtualBox Guest kernel module..."
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync
7bff28e0cedd8656acd24b420759649184d8cf00vboxsyncsync
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsyncvboxadditions_path="/opt/VirtualBoxAdditions"
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync# vboxguest.sh would've been installed, we just need to call it.
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync$vboxadditions_path/vboxguest.sh restart silentunload
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync# suid permissions for timesync
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsyncecho "Setting permissions..."
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsyncchmod 04755 $vboxadditions_path/VBoxService
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync# create links
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsyncecho "Creating links..."
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync/usr/sbin/installf -c none $PKGINST /dev/vboxguest=../devices/pci@0,0/pci80ee,cafe@4:vboxguest s
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync/usr/sbin/installf -c none $PKGINST /usr/bin/VBoxClient=$vboxadditions_path/VBoxClient s
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync/usr/sbin/installf -c none $PKGINST /usr/bin/VBoxService=$vboxadditions_path/VBoxService s
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync/usr/sbin/installf -c none $PKGINST /usr/bin/VBoxRandR=$vboxadditions_path/VBoxRandR.sh s
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync# Install Xorg components to the required places
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsyncxorgversion_long=`/usr/bin/X11/Xorg -version 2>&1 | grep "X Window System Version"`
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsyncxorgversion=`/usr/bin/expr "${xorgversion_long}" : 'X Window System Version \([^ ]*\)'`
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsyncvboxmouse_src=""
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsyncvboxvideo_src=""
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsynccase "$xorgversion" in
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync 1.3.* )
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync vboxmouse_src="$vboxadditions_path/vboxmouse_drv_71.so"
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync vboxvideo_src="$vboxadditions_path/vboxvideo_drv_13.so"
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync ;;
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync 1.4.* )
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync vboxmouse_src="$vboxadditions_path/vboxmouse_drv_14.so"
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync vboxvideo_src="$vboxadditions_path/vboxvideo_drv_14.so"
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync ;;
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync 7.1.* | *7.2.* )
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync vboxmouse_src="$vboxadditions_path/vboxmouse_drv_71.so"
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync vboxvideo_src="$vboxadditions_path/vboxvideo_drv_71.so"
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync ;;
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync 6.9.* | 7.0.* )
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync vboxmouse_src="$vboxadditions_path/vboxmouse_drv_70.so"
9a08dd6ed47cffa9cacbb9d53db1ce71d04db61fvboxsync vboxvideo_src="$vboxadditions_path/vboxvideo_drv_70.so"
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync ;;
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsyncesac
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync
9a08dd6ed47cffa9cacbb9d53db1ce71d04db61fvboxsyncretval=0
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsyncif test -z "$vboxmouse_src"; then
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync echo "*** Unknown version of the X Window System installed."
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync echo "*** Failed to install the VirtualBox X Window System drivers."
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync # Exit as partially failed installation
771761cda2c81e899526a0dce22c8cd2510fff82vboxsync retval=2
53e1c27c7564c45ad0b92676ddea561591a3e869vboxsyncelse
53e1c27c7564c45ad0b92676ddea561591a3e869vboxsync vboxmouse_dest="/usr/lib/X11/modules/input/vboxmouse_drv.so"
53e1c27c7564c45ad0b92676ddea561591a3e869vboxsync vboxvideo_dest="/usr/lib/X11/modules/input/vboxvideo_drv.so"
b459362b1c9b5ce5e6bf4ceb32ffe1294c08be07vboxsync /usr/sbin/installf -c none $PKGINST "$vboxmouse_dest" f
b459362b1c9b5ce5e6bf4ceb32ffe1294c08be07vboxsync /usr/sbin/installf -c none $PKGINST "$vboxvideo_dest" f
b459362b1c9b5ce5e6bf4ceb32ffe1294c08be07vboxsync cp "$vboxmouse_src" "$vboxmouse_dest"
53e1c27c7564c45ad0b92676ddea561591a3e869vboxsync cp "$vboxvideo_src" "$vboxvideo_dest"
53e1c27c7564c45ad0b92676ddea561591a3e869vboxsync echo "Installed VirtualBox mouse and video drivers for Xorg $xorgversion"
b459362b1c9b5ce5e6bf4ceb32ffe1294c08be07vboxsync
53e1c27c7564c45ad0b92676ddea561591a3e869vboxsync # Removing redudant files
53e1c27c7564c45ad0b92676ddea561591a3e869vboxsync /usr/sbin/removef $PKGINST $vboxadditions_path/vboxmouse_drv_* 1>/dev/null 2>/dev/null
53e1c27c7564c45ad0b92676ddea561591a3e869vboxsync /usr/sbin/removef $PKGINST $vboxadditions_path/vboxvideo_drv_* 1>/dev/null 2>/dev/null
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync rm -f $vboxadditions_path/vboxmouse_drv_*
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync rm -f $vboxadditions_path/vboxvideo_drv_*
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync /usr/sbin/removef -f $PKGINST
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync # Some distros like Indiana have no xorg.conf, deal with this
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync if test ! -f '/etc/X11/xorg.conf' && test ! -f '/etc/X11/.xorg.conf'; then
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync mv -f $vboxadditions_path/solaris_xorg.conf /etc/X11/.xorg.conf
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync fi
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync echo "Configuring Xorg..."
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync $vboxadditions_path/x11config.pl
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsyncfi
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync
0c8b774aca1168c2007424a49f6fa159fc23e42bvboxsync
f4ccb18a71e0e531719734918583f84fbc72ebfevboxsync# Setup our VBoxClient
7bff28e0cedd8656acd24b420759649184d8cf00vboxsyncecho "Configuring client..."
cfd41a3683178a30bac4417128b4673806653797vboxsyncvboxclient_src=$vboxadditions_path
cfd41a3683178a30bac4417128b4673806653797vboxsyncvboxclient_dest="/usr/dt/config/Xsession.d"
cfd41a3683178a30bac4417128b4673806653797vboxsyncif test -d "$vboxclient_dest"; then
cfd41a3683178a30bac4417128b4673806653797vboxsync /usr/sbin/installf -c none $PKGINST "$vboxclient_dest/1099.vboxclient" f
cfd41a3683178a30bac4417128b4673806653797vboxsync cp "$vboxclient_src/1099.vboxclient" "$vboxclient_dest/1099.vboxclient"
cfd41a3683178a30bac4417128b4673806653797vboxsyncelif test -d "/usr/share/gnome/autostart"; then
cfd41a3683178a30bac4417128b4673806653797vboxsync vboxclient_dest="/usr/share/gnome/autostart"
cfd41a3683178a30bac4417128b4673806653797vboxsync /usr/sbin/installf -c none $PKGINST "$vboxclient_dest/vboxclient.desktop" f
cfd41a3683178a30bac4417128b4673806653797vboxsync cp "$vboxclient_src/vboxclient.desktop" "$vboxclient_dest/vboxclient.desktop"
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsyncelse
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsync echo "*** Failed to configure client!! Couldn't find autostart directory."
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsync retval=2
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsyncfi
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsync
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsync
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsync# Remove redundant files
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsync/usr/sbin/removef $PKGINST $vboxadditions_path/etc/devlink.tab 1>/dev/null
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync/usr/sbin/removef $PKGINST $vboxadditions_path/etc 1>/dev/null
613c0d015cbaef93be47fc03f0708744c5c24f79vboxsyncrm -rf $vboxadditions_path/etc
9a1578b66f9e563cf99c75ffa881db476f477e3avboxsync/usr/sbin/removef -f $PKGINST
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsync
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsync/usr/sbin/installf -f $PKGINST
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsync
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsync
b8b61ff747c97d77b48c572a474969b1892d591dvboxsync# Setup our VBoxService SMF service
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsyncecho "Configuring service..."
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsync
7bff28e0cedd8656acd24b420759649184d8cf00vboxsync/usr/sbin/svccfg import /var/svc/manifest/system/virtualbox/vboxservice.xml
907ba2c9b3d1821f95be17115ecad9fe8a2cae02vboxsync/usr/sbin/svcadm enable svc:/system/virtualbox/vboxservice
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsync
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsync/usr/sbin/devlinks
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsync
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsyncecho "Done."
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsyncif test $retval -eq 0; then
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsync echo "Please restart X Window System for activating the X11 guest additions."
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsyncfi
771761cda2c81e899526a0dce22c8cd2510fff82vboxsyncexit $retval
f6cc81e94c29cc9b39b896cf32ecfe0501b4a1e5vboxsync
77c85c820fe4467a0856134e0c9e5c5790cd847evboxsync