VirtualBox

source: vbox/trunk/src/VBox/Installer/solaris/makepackage.sh@ 8123

Last change on this file since 8123 was 8123, checked in by vboxsync, 17 years ago

Solaris host installer: report errors and fail rather than create empty packages.

  • Property svn:eol-style set to LF
File size: 2.9 KB
Line 
1#!/bin/sh
2set -e
3# innotek VirtualBox
4# VirtualBox Solaris package creation script.
5#
6# Copyright (C) 2007-2008 innotek GmbH
7#
8# This file is part of VirtualBox Open Source Edition (OSE), as
9# available from http://www.virtualbox.org. This file is free software;
10# you can redistribute it and/or modify it under the terms of the GNU
11# General Public License (GPL) as published by the Free Software
12# Foundation, in version 2 as it comes in the "COPYING" file of the
13# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15#
16
17#
18# Usage:
19# makespackage.sh $(PATH_TARGET)/install packagename $(BUILD_TARGET_ARCH)
20
21if [ -z "$3" ]; then
22 echo "Usage: $0 installdir packagename x86|amd64"
23 exit 1
24fi
25
26MY_PKGNAME=SUNWvbox
27MY_GGREP=/usr/sfw/bin/ggrep
28MY_AWK=/usr/bin/awk
29MY_GTAR=/usr/sfw/bin/gtar
30
31# check for GNU grep we use which might not ship with all Solaris
32if test ! -f "$MY_GGREP" || test ! -h "$MY_GGREP"; then
33 echo "## GNU grep not found in $MY_GGREP."
34 exit 1
35fi
36
37# check for GNU tar we use which might not ship with all Solaris
38if test ! -f "$MY_GTAR" || test ! -h "$MY_GTAR"; then
39 echo "## GNU tar not found in $MY_GTAR."
40 exit 1
41fi
42
43
44# prepare file list
45cd "$1"
46echo 'i pkginfo=./vbox.pkginfo' > prototype
47echo 'i postinstall=./postinstall.sh' >> prototype
48echo 'i preremove=./preremove.sh' >> prototype
49echo 'i space=./vbox.space' >> prototype
50echo 'e sed /etc/devlink.tab ? ? ?' >> prototype
51find . -print | $MY_GGREP -v -E 'prototype|makepackage.sh|vbox.pkginfo|postinstall.sh|preremove.sh|ReadMe.txt|vbox.space' | pkgproto >> prototype
52
53# don't grok for the sed class files
54$MY_AWK 'NF == 6 && $2 == "none" { $5 = "root"; $6 = "bin" } { print }' prototype > prototype2
55$MY_AWK 'NF == 6 && $2 == "none" { $3 = "opt/VirtualBox/"$3"="$3 } { print }' prototype2 > prototype
56
57# install the kernel module to the right place.
58if test "$3" = "x86"; then
59 $MY_AWK 'NF == 6 && $3 == "opt/VirtualBox/vboxdrv=vboxdrv" { $3 = "platform/i86pc/kernel/drv/vboxdrv=vboxdrv" } { print }' prototype > prototype2
60else
61 $MY_AWK 'NF == 6 && $3 == "opt/VirtualBox/vboxdrv=vboxdrv" { $3 = "platform/i86pc/kernel/drv/amd64/vboxdrv=vboxdrv" } { print }' prototype > prototype2
62fi
63
64$MY_AWK 'NF == 6 && $3 == "opt/VirtualBox/vboxdrv.conf=vboxdrv.conf" { $3 = "platform/i86pc/kernel/drv/vboxdrv.conf=vboxdrv.conf" } { print }' prototype2 > prototype
65
66rm prototype2
67
68# explicitly set timestamp to shutup warning
69VBOXPKG_TIMESTAMP=vbox`date '+%Y%m%d%H%M%S'`
70
71# create the package instance
72pkgmk -p $VBOXPKG_TIMESTAMP -o -r .
73if test $? -ne 0; then
74 exit 1
75fi
76
77# translate into package datastream
78pkgtrans -s -o /var/spool/pkg `pwd`/$2 "$MY_PKGNAME"
79if test $? -ne 0; then
80 exit 1
81fi
82
83$MY_GTAR zcvf $2.tar.gz $2 autoresponse ReadMe.txt
84
85if test $? -eq 0; then
86 echo "## Packaging and transfer completed successfully!"
87fi
88rm -rf "/var/spool/pkg/$MY_PKGNAME"
89exit $?
90
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette