VirtualBox

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

Last change on this file since 34575 was 33656, checked in by vboxsync, 14 years ago

*: rebrand Sun (L)GPL disclaimers

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
File size: 4.1 KB
Line 
1#!/bin/sh
2#
3# VirtualBox Solaris Guest Additions package creation script.
4#
5# Copyright (C) 2008-2010 Oracle Corporation
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# The contents of this file may alternatively be used under the terms
16# of the Common Development and Distribution License Version 1.0
17# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
18# VirtualBox OSE distribution, in which case the provisions of the
19# CDDL are applicable instead of those of the GPL.
20#
21# You may elect to license modified versions of this file under the
22# terms and conditions of either the GPL or the CDDL or both.
23#
24
25#
26# Usage:
27# makespackage.sh $(PATH_TARGET)/install packagename svnrev
28
29if test -z "$3"; then
30 echo "Usage: $0 installdir packagename svnrev"
31 exit 1
32fi
33
34VBOX_BASEPKG_DIR=$1
35VBOX_INSTALLED_DIR="$VBOX_BASEPKG_DIR"/opt/VirtualBoxAdditions
36VBOX_PKGFILENAME=$2
37VBOX_SVN_REV=$3
38
39VBOX_PKGNAME=SUNWvboxguest
40VBOX_AWK=/usr/bin/awk
41VBOX_GGREP=/usr/sfw/bin/ggrep
42VBOX_AWK=/usr/bin/awk
43
44# check for GNU grep we use which might not ship with all Solaris
45if test ! -f "$VBOX_GGREP" && test ! -h "$VBOX_GGREP"; then
46 echo "## GNU grep not found in $VBOX_GGREP."
47 exit 1
48fi
49
50# bail out on non-zero exit status
51set -e
52
53# Fixup filelist using awk, the parameters must be in awk syntax
54# params: filename condition action
55filelist_fixup()
56{
57 "$VBOX_AWK" 'NF == 6 && '"$2"' { '"$3"' } { print }' "$1" > "tmp-$1"
58 mv -f "tmp-$1" "$1"
59}
60
61
62# Create relative hardlinks
63cd "$VBOX_INSTALLED_DIR"
64ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxService
65ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxClient
66ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxControl
67
68# prepare file list
69cd "$VBOX_BASEPKG_DIR"
70echo 'i pkginfo=./vboxguest.pkginfo' > prototype
71echo 'i postinstall=./postinstall.sh' >> prototype
72echo 'i preremove=./preremove.sh' >> prototype
73echo 'i space=./vboxguest.space' >> prototype
74echo 'i depend=./vboxguest.depend' >> prototype
75if test -f "./vboxguest.copyright"; then
76 echo 'i copyright=./vboxguest.copyright' >> prototype
77fi
78
79# Exclude directory entries to not cause conflicts (owner,group) with existing directories in the system
80find . ! -type d | $VBOX_GGREP -v -E 'prototype|makepackage.sh|vboxguest.pkginfo|postinstall.sh|preremove.sh|vboxguest.space|vboxguest.depend|vboxguest.copyright' | pkgproto >> prototype
81
82# Include opt/VirtualBoxAdditions and subdirectories as we want uninstall to clean up directory structure as well
83find . -type d | $VBOX_GGREP -E 'opt/VirtualBoxAdditions' | pkgproto >> prototype
84
85# Include /etc/fs/vboxfs (as we need to create the subdirectory)
86find . -type d | $VBOX_GGREP -E 'etc/fs/vboxfs' | pkgproto >> prototype
87
88
89# don't grok for the class files
90filelist_fixup prototype '$2 == "none"' '$5 = "root"; $6 = "bin"'
91
92# VBoxService requires suid
93filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/VBoxService"' '$4 = "4755"'
94filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxService"' '$4 = "4755"'
95
96# vboxguest
97filelist_fixup prototype '$3 == "usr/kernel/drv/vboxguest"' '$6="sys"'
98filelist_fixup prototype '$3 == "usr/kernel/drv/amd64/vboxguest"' '$6="sys"'
99
100echo " --- start of prototype ---"
101cat prototype
102echo " --- end of prototype --- "
103
104# explicitly set timestamp to shutup warning
105VBOXPKG_TIMESTAMP=vboxguest`date '+%Y%m%d%H%M%S'`_r$VBOX_SVN_REV
106
107# create the package instance
108pkgmk -p $VBOXPKG_TIMESTAMP -o -r .
109
110# translate into package datastream
111pkgtrans -s -o /var/spool/pkg `pwd`/$VBOX_PKGFILENAME "$VBOX_PKGNAME"
112
113rm -rf "/var/spool/pkg/$VBOX_PKGNAME"
114exit $?
115
Note: See TracBrowser for help on using the repository browser.

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