1 | #!/bin/sh
|
---|
2 | # Sun xVM VirtualBox
|
---|
3 | # VirtualBox Solaris VBI Kernel Module package creation script.
|
---|
4 | #
|
---|
5 | # Copyright (C) 2007-2008 Sun Microsystems, Inc.
|
---|
6 | #
|
---|
7 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
8 | # available from http://www.virtualbox.org. This file is free software;
|
---|
9 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
10 | # General Public License (GPL) as published by the Free Software
|
---|
11 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
12 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
13 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
14 | #
|
---|
15 | # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
16 | # Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
17 | # additional information or have any questions.
|
---|
18 | #
|
---|
19 |
|
---|
20 | #
|
---|
21 | # Usage:
|
---|
22 | # makespackage.sh $(PATH_TARGET)/install packagename
|
---|
23 |
|
---|
24 | if [ -z "$2" ]; then
|
---|
25 | echo "Usage: $0 installdir packagename"
|
---|
26 | echo "-- packagename must not have any extension (e.g. VirtualBoxKern-SunOS-r28899)"
|
---|
27 | exit 1
|
---|
28 | fi
|
---|
29 |
|
---|
30 | VBOX_PKGFILE=$2.pkg
|
---|
31 | VBOX_ARCHIVE=$2.tar.gz
|
---|
32 | VBOX_PKGNAME=SUNWvboxkern
|
---|
33 |
|
---|
34 | VBOX_GGREP=/usr/sfw/bin/ggrep
|
---|
35 | VBOX_AWK=/usr/bin/awk
|
---|
36 | VBOX_GTAR=/usr/sfw/bin/gtar
|
---|
37 |
|
---|
38 | # check for GNU grep we use which might not ship with all Solaris
|
---|
39 | if test ! -f "$VBOX_GGREP" && test ! -h "$VBOX_GGREP"; then
|
---|
40 | echo "## GNU grep not found in $VBOX_GGREP."
|
---|
41 | exit 1
|
---|
42 | fi
|
---|
43 |
|
---|
44 | # check for GNU tar we use which might not ship with all Solaris
|
---|
45 | if test ! -f "$VBOX_GTAR" && test ! -h "$VBOX_GTAR"; then
|
---|
46 | echo "## GNU tar not found in $VBOX_GTAR."
|
---|
47 | exit 1
|
---|
48 | fi
|
---|
49 |
|
---|
50 | # bail out on non-zero exit status
|
---|
51 | set -e
|
---|
52 |
|
---|
53 | # prepare file list
|
---|
54 | cd "$1"
|
---|
55 | echo 'i pkginfo=./vboxkern.pkginfo' > prototype
|
---|
56 | if test -f "./vbox.copyright"; then
|
---|
57 | echo 'i copyright=./vbox.copyright' >> prototype
|
---|
58 | fi
|
---|
59 | find . -print | $VBOX_GGREP -v -E 'prototype|makepackage.sh|vboxkern.pkginfo|vbox.copyright' | pkgproto >> prototype
|
---|
60 |
|
---|
61 | $VBOX_AWK 'NF == 6 && $2 == "none" { $5 = "root"; $6 = "sys" } { print }' prototype > prototype2
|
---|
62 | $VBOX_AWK 'NF == 6 && $2 == "none" { $3 = "platform/i86pc/kernel/misc/"$3"="$3 } { print }' prototype2 > prototype
|
---|
63 |
|
---|
64 | rm prototype2
|
---|
65 |
|
---|
66 | # explicitly set timestamp to shutup warning
|
---|
67 | VBOXPKG_TIMESTAMP=vboxkern`date '+%Y%m%d%H%M%S'`
|
---|
68 |
|
---|
69 | # create the package instance
|
---|
70 | pkgmk -p $VBOXPKG_TIMESTAMP -o -r .
|
---|
71 |
|
---|
72 | # translate into package datastream
|
---|
73 | pkgtrans -s -o /var/spool/pkg "`pwd`/$VBOX_PKGFILE" "$VBOX_PKGNAME"
|
---|
74 |
|
---|
75 | echo "## Packaging and transfer completed successfully!"
|
---|
76 | rm -rf "/var/spool/pkg/$VBOX_PKGNAME"
|
---|
77 |
|
---|
78 | exit $?
|
---|
79 |
|
---|