makepackage.sh revision 4990206eb62ac670f067bd0a66a6ca41153dda0b
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd#!/bin/sh
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd## @file
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd#
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd# VirtualBox package creation script, Solaris hosts.
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd#
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd#
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# Copyright (C) 2007-2011 Oracle Corporation
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd#
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc# This file is part of VirtualBox Open Source Edition (OSE), as
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# available from http://www.virtualbox.org. This file is free software;
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# you can redistribute it and/or modify it under the terms of the GNU
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen# General Public License (GPL) as published by the Free Software
2e545ce2450a9953665f701bb05350f0d3f26275nd# Foundation, in version 2 as it comes in the "COPYING" file of the
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd#
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen#
3f08db06526d6901aa08c110b5bc7dde6bc39905nd# Usage:
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# makepackage.sh [--hardened] $(PATH_TARGET)/install packagename {$(KBUILD_TARGET_ARCH)|neutral} $(VBOX_SVN_REV) [VBIPackageName]
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
3f08db06526d6901aa08c110b5bc7dde6bc39905nd# Parse options.
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndHARDENED=""
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7ndwhile test $# -ge 1;
053bfa8a288528fafab2b7a032c15116bb5de711nddo
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd case "$1" in
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end --hardened)
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung HARDENED=1
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd ;;
4b575a6b6704b516f22d65a3ad35696d7b9ba372rpluem *)
4b575a6b6704b516f22d65a3ad35696d7b9ba372rpluem break
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd ;;
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd esac
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd shift
0853e1e2522c1ac17f697221758bcbd4781a7ff9nddone
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndif [ -z "$4" ]; then
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd echo "Usage: $0 installdir packagename x86|amd64 svnrev [VBIPackage]"
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd echo "-- packagename must not have any extension (e.g. VirtualBox-SunOS-amd64-r28899)"
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd exit 1
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfi
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndPKG_BASE_DIR=$1
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedoohVBOX_INSTALLED_DIR=$1/opt/VirtualBox
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndVBOX_PKGFILE=$2.pkg
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndVBOX_ARCHIVE=$2.tar.gz
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# VBOX_PKG_ARCH is currently unused.
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndVBOX_PKG_ARCH=$3
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndVBOX_SVN_REV=$4
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndVBOX_PKGNAME=SUNWvbox
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndVBOX_GGREP=/usr/sfw/bin/ggrep
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndVBOX_AWK=/usr/bin/awk
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd#VBOX_GTAR=/usr/sfw/bin/gtar
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# check for GNU grep we use which might not ship with all Solaris
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndif test ! -f "$VBOX_GGREP" && test ! -h "$VBOX_GGREP"; then
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd echo "## GNU grep not found in $VBOX_GGREP."
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd exit 1
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfi
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# check for GNU tar we use which might not ship with all Solaris
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd#if test ! -f "$VBOX_GTAR" && test ! -h "$VBOX_GTAR"; then
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# echo "## GNU tar not found in $VBOX_GTAR."
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# exit 1
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd#fi
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# bail out on non-zero exit status
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndset -e
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# Fixup filelist using awk, the parameters must be in awk syntax
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# params: filename condition action
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfilelist_fixup()
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd{
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd "$VBOX_AWK" 'NF == 6 && '"$2"' { '"$3"' } { print }' "$1" > "tmp-$1"
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd mv -f "tmp-$1" "$1"
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd}
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nddirlist_fixup()
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd{
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd "$VBOX_AWK" 'NF == 6 && $1 == "d" && '"$2"' { '"$3"' } { print }' "$1" > "tmp-$1"
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd mv -f "tmp-$1" "$1"
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd}
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndhardlink_fixup()
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd{
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd "$VBOX_AWK" 'NF == 3 && $1=="l" && '"$2"' { '"$3"' } { print }' "$1" > "tmp-$1"
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd mv -f "tmp-$1" "$1"
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd}
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndsymlink_fixup()
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd{
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd "$VBOX_AWK" 'NF == 3 && $1=="s" && '"$2"' { '"$3"' } { print }' "$1" > "tmp-$1"
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd mv -f "tmp-$1" "$1"
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd}
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# Prepare file list
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndcd "$PKG_BASE_DIR"
8e31885fc494b603e0650113dde9e29d1b1d2602maczniakecho 'i pkginfo=./vbox.pkginfo' > prototype
8e31885fc494b603e0650113dde9e29d1b1d2602maczniakecho 'i checkinstall=./checkinstall.sh' >> prototype
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndecho 'i postinstall=./postinstall.sh' >> prototype
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndecho 'i preremove=./preremove.sh' >> prototype
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndecho 'i space=./vbox.space' >> prototype
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndif test -f "./vbox.copyright"; then
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd echo 'i copyright=./vbox.copyright' >> prototype
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfi
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# Create relative hardlinks
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndcd "$VBOX_INSTALLED_DIR"
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxManage
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxSDL
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxBalloonCtrl
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/vboxwebsrv
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/webtest
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxZoneAccess
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndif test -f $VBOX_INSTALLED_DIR/amd64/VBoxTestOGL || test -f $VBOX_INSTALLED_DIR/i386/VBoxTestOGL; then
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxTestOGL
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfi
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndif test -f $VBOX_INSTALLED_DIR/amd64/VirtualBox || test -f $VBOX_INSTALLED_DIR/i386/VirtualBox; then
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VirtualBox
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfi
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndif test -f $VBOX_INSTALLED_DIR/amd64/VBoxBFE || test -f $VBOX_INSTALLED_DIR/i386/VBoxBFE; then
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxBFE
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfi
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndif test -f $VBOX_INSTALLED_DIR/amd64/VBoxHeadless || test -f $VBOX_INSTALLED_DIR/i386/VBoxHeadless; then
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxHeadless
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd ln -fs ./VBoxHeadless $VBOX_INSTALLED_DIR/VBoxVRDP
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfi
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# Exclude directories to not cause install-time conflicts with existing system directories
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndcd "$PKG_BASE_DIR"
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfind . ! -type d | $VBOX_GGREP -v -E 'prototype|makepackage.sh|vbox.pkginfo|postinstall.sh|checkinstall.sh|preremove.sh|ReadMe.txt|vbox.space|vbox.depend|vbox.copyright|VirtualBoxKern' | pkgproto >> prototype
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# Include opt/VirtualBox and subdirectories as we want uninstall to clean up directory structure.
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# Include var/svc for manifest class action script does not create them.
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfind . -type d | $VBOX_GGREP -E 'opt/VirtualBox|var/svc/manifest/application/virtualbox' | pkgproto >> prototype
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# fix up file permissions (owner/group)
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# don't grok for class-specific files (like sed, if any)
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfilelist_fixup prototype '$2 == "none"' '$5 = "root"; $6 = "bin"'
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# don't include autoresponse and LICENSE from the base folder into / of
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# the package, it goes into .tar.gz and another one already exists
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# in /opt/VirtualBox
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndsed '/f none autoresponse/d' prototype > prototype2
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndmv -f prototype2 prototype
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndsed '/f none LICENSE/d' prototype > prototype2
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndmv -f prototype2 prototype
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# HostDriver vboxdrv
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfilelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/vboxdrv"' '$6 = "sys"'
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfilelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/amd64/vboxdrv"' '$6 = "sys"'
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# NetFilter vboxflt
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfilelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/vboxflt"' '$6 = "sys"'
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfilelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/amd64/vboxflt"' '$6 = "sys"'
71fccc298df6a1540d408151a26aa22beed55d0bnd
71fccc298df6a1540d408151a26aa22beed55d0bnd# NetFilter vboxbow
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfilelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/vboxbow"' '$6 = "sys"'
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfilelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/amd64/vboxbow"' '$6 = "sys"'
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# NetAdapter vboxnet
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfilelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/vboxnet"' '$6 = "sys"'
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfilelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/amd64/vboxnet"' '$6 = "sys"'
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# USBMonitor vboxusbmon
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfilelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/vboxusbmon"' '$6 = "sys"'
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfilelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/amd64/vboxusbmon"' '$6 = "sys"'
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# USB Client vboxusb
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfilelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/vboxusb"' '$6 = "sys"'
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfilelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/amd64/vboxusb"' '$6 = "sys"'
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# Manifest class action scripts
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfilelist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox/virtualbox-webservice.xml"' '$2 = "manifest";$6 = "sys"'
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfilelist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox/virtualbox-balloonctrl.xml"' '$2 = "manifest";$6 = "sys"'
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfilelist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml"' '$2 = "manifest";$6 = "sys"'
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# Use 'root' as group so as to match attributes with the previous installation and prevent a conflict. Otherwise pkgadd bails out thinking
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# we're violating directory attributes of another (non existing) package
0853e1e2522c1ac17f697221758bcbd4781a7ff9nddirlist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox"' '$6 = "root"'
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# hardening requires some executables to be marked setuid.
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndif test -n "$HARDENED"; then
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd $VBOX_AWK 'NF == 6 \
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd && ( $3 == "opt/VirtualBox/amd64/VirtualBox" \
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd || $3 == "opt/VirtualBox/amd64/VirtualBox3" \
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd || $3 == "opt/VirtualBox/amd64/VBoxHeadless" \
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd || $3 == "opt/VirtualBox/amd64/VBoxSDL" \
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd || $3 == "opt/VirtualBox/amd64/VBoxBFE" \
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd || $3 == "opt/VirtualBox/i386/VirtualBox" \
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd || $3 == "opt/VirtualBox/i386/VirtualBox3" \
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd || $3 == "opt/VirtualBox/i386/VBoxHeadless" \
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd || $3 == "opt/VirtualBox/i386/VBoxSDL" \
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd || $3 == "opt/VirtualBox/i386/VBoxBFE" \
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd ) \
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd { $4 = "4755" } { print }' prototype > prototype2
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd mv -f prototype2 prototype
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfi
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# Other executables that need setuid root (hardened or otherwise)
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd$VBOX_AWK 'NF == 6 \
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd && ( $3 == "opt/VirtualBox/amd64/VBoxNetAdpCtl" \
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd || $3 == "opt/VirtualBox/i386/VBoxNetAdpCtl" \
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd || $3 == "opt/VirtualBox/amd64/VBoxNetDHCP" \
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd || $3 == "opt/VirtualBox/i386/VBoxNetDHCP" \
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd ) \
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd { $4 = "4755" } { print }' prototype > prototype2
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndmv -f prototype2 prototype
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# Our package is a non-relocatable package. pkgadd will take care of "relocating" them when they are used for
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# remote installations using $PKG_INSTALL_ROOT and not $BASEDIR. Seems this little subtlety led to it's own page:
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# http://docs.sun.com/app/docs/doc/820-4042/package-2?a=view
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfilelist_fixup prototype '$2 == "none"' '$3="/"$3'
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndfilelist_fixup prototype '$2 == "manifest"' '$3="/"$3'
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndsymlink_fixup prototype '$2 == "none"' '$3="/"$3'
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndhardlink_fixup prototype '$2 == "none"' '$3="/"$3'
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndecho " --- start of prototype ---"
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndcat prototype
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndecho " --- end of prototype --- "
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# Explicitly set timestamp to shutup warning
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndVBOXPKG_TIMESTAMP=vbox`date '+%Y%m%d%H%M%S'`_r$VBOX_SVN_REV
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# Create the package instance
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndpkgmk -p $VBOXPKG_TIMESTAMP -o -r .
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# Translate into package datastream
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndpkgtrans -s -o /var/spool/pkg "`pwd`/$VBOX_PKGFILE" "$VBOX_PKGNAME"
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# $5 if exist would contain the path to the VBI package to include in the .tar.gz
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd#if [ -f LICENSE ]; then
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# VBOX_LICENSEFILE=LICENSE
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd#fi
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd#if test -f "$5"; then
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# $VBOX_GTAR zcvf "$VBOX_ARCHIVE" $VBOX_LICENSEFILE "$VBOX_PKGFILE" "$5" autoresponse ReadMe.txt
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd#else
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd# $VBOX_GTAR zcvf "$VBOX_ARCHIVE" $VBOX_LICENSEFILE "$VBOX_PKGFILE" autoresponse ReadMe.txt
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd#fi
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndecho "## Package file created successfully!"
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndrm -rf "/var/spool/pkg/$VBOX_PKGNAME"
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndexit $?
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd