makepackage.sh revision 9b5e4e8f5c00e8cd2289a73d173c96e551c79397
#
# VirtualBox Solaris Guest Additions package creation script.
#
# Copyright (C) 2008-2010 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
# The contents of this file may alternatively be used under the terms
# of the Common Development and Distribution License Version 1.0
# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
# VirtualBox OSE distribution, in which case the provisions of the
# CDDL are applicable instead of those of the GPL.
#
# You may elect to license modified versions of this file under the
# terms and conditions of either the GPL or the CDDL or both.
#
#
# Usage:
# makespackage.sh $(PATH_TARGET)/install packagename svnrev
if test -z "$3"; then
echo "Usage: $0 installdir packagename svnrev"
exit 1
fi
VBOX_SVN_REV=$3
# check for GNU grep we use which might not ship with all Solaris
if test ! -f "$VBOX_GGREP" && test ! -h "$VBOX_GGREP"; then
echo "## GNU grep not found in $VBOX_GGREP."
exit 1
fi
# bail out on non-zero exit status
set -e
# Fixup filelist using awk, the parameters must be in awk syntax
# params: filename condition action
{
mv -f "tmp-$1" "$1"
}
{
mv -f "tmp-$1" "$1"
}
# Create relative hardlinks
cd "$VBOX_INSTALLED_DIR"
# prepare file list
cd "$VBOX_BASEPKG_DIR"
echo 'i pkginfo=./vboxguest.pkginfo' > prototype
echo 'i postinstall=./postinstall.sh' >> prototype
echo 'i preremove=./preremove.sh' >> prototype
echo 'i space=./vboxguest.space' >> prototype
echo 'i depend=./vboxguest.depend' >> prototype
if test -f "./vboxguest.copyright"; then
echo 'i copyright=./vboxguest.copyright' >> prototype
fi
# Exclude directory entries to not cause conflicts (owner,group) with existing directories in the system
find . ! -type d | $VBOX_GGREP -v -E 'prototype|makepackage.sh|vboxguest.pkginfo|postinstall.sh|preremove.sh|vboxguest.space|vboxguest.depend|vboxguest.copyright' | pkgproto >> prototype
# Include opt/VirtualBoxAdditions and subdirectories as we want uninstall to clean up directory structure as well
find . -type d | $VBOX_GGREP -E 'opt/VirtualBoxAdditions|var/svc/manifest/application/virtualbox' | pkgproto >> prototype
# don't grok for the class files
# VBoxService requires suid
# Manifest class action scripts
filelist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox/vboxservice.xml"' '$2 = "manifest";$6 = "sys"'
# vboxguest
# Use 'root' as group so as to match attributes with the previous installation and prevent a conflict. Otherwise pkgadd bails out thinking
# we're violating directory attributes of another (non existing) package
echo " --- start of prototype ---"
echo " --- end of prototype --- "
# explicitly set timestamp to shutup warning
# create the package instance
pkgmk -p $VBOXPKG_TIMESTAMP -o -r .
# translate into package datastream
exit $?