0569fe99ac6ea5da1bf4775fe3523165ac39c030vboxsync# VirtualBox Solaris Guest Additions package creation script.
c58f1213e628a545081c70e26c6b67a841cff880vboxsync# Copyright (C) 2008-2012 Oracle Corporation
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.
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# 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.
3b58b08293698f7f081b5558c52e80741a4a6763vboxsync# makespackage.sh $(PATH_TARGET)/install packagename svnrev
3b58b08293698f7f081b5558c52e80741a4a6763vboxsyncif test -z "$3"; then
3b58b08293698f7f081b5558c52e80741a4a6763vboxsync echo "Usage: $0 installdir packagename svnrev"
35ee142c6ce998dd208090d20cdb5d7fe2fd7c69vboxsyncif test "$ostype" != "Linux" && test "$ostype" != "SunOS" ; then
35ee142c6ce998dd208090d20cdb5d7fe2fd7c69vboxsync echo "Linux/Solaris not detected."
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsyncVBOX_INSTALLED_DIR="$VBOX_BASEPKG_DIR"/opt/VirtualBoxAdditions
c4c106ad74e0ad745ac49a2c4182c4f42ced7248vboxsync# check for GNU grep we use which might not ship with all Solaris
907ba2c9b3d1821f95be17115ecad9fe8a2cae02vboxsyncif test ! -f "$VBOX_GGREP" && test ! -h "$VBOX_GGREP"; then
907ba2c9b3d1821f95be17115ecad9fe8a2cae02vboxsync echo "## GNU grep not found in $VBOX_GGREP."
6e793fadebda53870ee54ac9dcdbe30d612f22b5vboxsync# bail out on non-zero exit status
907ba2c9b3d1821f95be17115ecad9fe8a2cae02vboxsync# Fixup filelist using awk, the parameters must be in awk syntax
907ba2c9b3d1821f95be17115ecad9fe8a2cae02vboxsync# params: filename condition action
907ba2c9b3d1821f95be17115ecad9fe8a2cae02vboxsync "$VBOX_AWK" 'NF == 6 && '"$2"' { '"$3"' } { print }' "$1" > "tmp-$1"
9b5e4e8f5c00e8cd2289a73d173c96e551c79397vboxsync "$VBOX_AWK" 'NF == 6 && $1 == "d" && '"$2"' { '"$3"' } { print }' "$1" > "tmp-$1"
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync# Create relative hardlinks
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync# prepare file list
f09a9ba0e70c09ac2c9728909fbf45cb7f81195dvboxsyncif test -f "./vboxguest.copyright"; then
f09a9ba0e70c09ac2c9728909fbf45cb7f81195dvboxsync echo 'i copyright=./vboxguest.copyright' >> prototype
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync# Exclude directory entries to not cause conflicts (owner,group) with existing directories in the system
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsyncfind . ! -type d | $VBOX_GGREP -v -E 'prototype|makepackage.sh|vboxguest.pkginfo|postinstall.sh|preremove.sh|vboxguest.space|vboxguest.depend|vboxguest.copyright' | pkgproto >> prototype
1826861f34e9be70b29cd5e1a6038caf9fbf37bevboxsync# Include opt/VirtualBoxAdditions and subdirectories as we want uninstall to clean up directory structure as well
9b5e4e8f5c00e8cd2289a73d173c96e551c79397vboxsyncfind . -type d | $VBOX_GGREP -E 'opt/VirtualBoxAdditions|var/svc/manifest/application/virtualbox' | pkgproto >> prototype
1826861f34e9be70b29cd5e1a6038caf9fbf37bevboxsync# Include /etc/fs/vboxfs (as we need to create the subdirectory)
1826861f34e9be70b29cd5e1a6038caf9fbf37bevboxsyncfind . -type d | $VBOX_GGREP -E 'etc/fs/vboxfs' | pkgproto >> prototype
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync# don't grok for the class files
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsyncfilelist_fixup prototype '$2 == "none"' '$5 = "root"; $6 = "bin"'
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsync# VBoxService requires suid
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsyncfilelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/VBoxService"' '$4 = "4755"'
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsyncfilelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxService"' '$4 = "4755"'
9b5e4e8f5c00e8cd2289a73d173c96e551c79397vboxsync# Manifest class action scripts
9b5e4e8f5c00e8cd2289a73d173c96e551c79397vboxsyncfilelist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox/vboxservice.xml"' '$2 = "manifest";$6 = "sys"'
5961f52b7fddac720a0e92654eda9f7d8b647e15vboxsyncfilelist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox/vboxmslnk.xml"' '$2 = "manifest";$6 = "sys"'
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsyncfilelist_fixup prototype '$3 == "usr/kernel/drv/vboxguest"' '$6="sys"'
1ace73711fa06807748eff26632c7273a1f7c2dbvboxsyncfilelist_fixup prototype '$3 == "usr/kernel/drv/amd64/vboxguest"' '$6="sys"'
5961f52b7fddac720a0e92654eda9f7d8b647e15vboxsyncfilelist_fixup prototype '$3 == "usr/kernel/drv/vboxms"' '$6="sys"'
5961f52b7fddac720a0e92654eda9f7d8b647e15vboxsyncfilelist_fixup prototype '$3 == "usr/kernel/drv/amd64/vboxms"' '$6="sys"'
9b5e4e8f5c00e8cd2289a73d173c96e551c79397vboxsync# Use 'root' as group so as to match attributes with the previous installation and prevent a conflict. Otherwise pkgadd bails out thinking
9b5e4e8f5c00e8cd2289a73d173c96e551c79397vboxsync# we're violating directory attributes of another (non existing) package
9b5e4e8f5c00e8cd2289a73d173c96e551c79397vboxsyncdirlist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox"' '$6 = "root"'
332d68e9666b04a5aa788a586d9f4c6b1f19c700vboxsyncecho " --- start of prototype ---"
907ba2c9b3d1821f95be17115ecad9fe8a2cae02vboxsyncecho " --- end of prototype --- "
c4c106ad74e0ad745ac49a2c4182c4f42ced7248vboxsync# explicitly set timestamp to shutup warning
3b58b08293698f7f081b5558c52e80741a4a6763vboxsyncVBOXPKG_TIMESTAMP=vboxguest`date '+%Y%m%d%H%M%S'`_r$VBOX_SVN_REV
c4c106ad74e0ad745ac49a2c4182c4f42ced7248vboxsync# create the package instance
35ee142c6ce998dd208090d20cdb5d7fe2fd7c69vboxsyncpkgmk -d $VBOX_SOL_PKG_DEV -p $VBOXPKG_TIMESTAMP -o -r .
1bfc7215a51c113dafd83953d96ab4897d2d3690vboxsync# translate into package datastream