VirtualBox

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

Last change on this file since 56294 was 44528, checked in by vboxsync, 12 years ago

header (C) fixes

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
File size: 5.5 KB
Line 
1#!/bin/sh
2#
3# VirtualBox Solaris Guest Additions package creation script.
4#
5# Copyright (C) 2008-2012 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
33ostype=`uname -s`
34if test "$ostype" != "Linux" && test "$ostype" != "SunOS" ; then
35 echo "Linux/Solaris not detected."
36 exit 1
37fi
38
39VBOX_BASEPKG_DIR=$1
40VBOX_INSTALLED_DIR="$VBOX_BASEPKG_DIR"/opt/VirtualBoxAdditions
41VBOX_PKGFILENAME=$2
42VBOX_SVN_REV=$3
43
44VBOX_PKGNAME=SUNWvboxguest
45VBOX_AWK=/usr/bin/awk
46case "$ostype" in
47"SunOS")
48 VBOX_GGREP=/usr/sfw/bin/ggrep
49 VBOX_SOL_PKG_DEV=/var/spool/pkg
50 ;;
51*)
52 VBOX_GGREP=`which grep`
53 VBOX_SOL_PKG_DEV=$4
54 ;;
55esac
56VBOX_AWK=/usr/bin/awk
57
58# check for GNU grep we use which might not ship with all Solaris
59if test ! -f "$VBOX_GGREP" && test ! -h "$VBOX_GGREP"; then
60 echo "## GNU grep not found in $VBOX_GGREP."
61 exit 1
62fi
63
64# bail out on non-zero exit status
65set -e
66
67# Fixup filelist using awk, the parameters must be in awk syntax
68# params: filename condition action
69filelist_fixup()
70{
71 "$VBOX_AWK" 'NF == 6 && '"$2"' { '"$3"' } { print }' "$1" > "tmp-$1"
72 mv -f "tmp-$1" "$1"
73}
74
75dirlist_fixup()
76{
77 "$VBOX_AWK" 'NF == 6 && $1 == "d" && '"$2"' { '"$3"' } { print }' "$1" > "tmp-$1"
78 mv -f "tmp-$1" "$1"
79}
80
81# Create relative hardlinks
82cd "$VBOX_INSTALLED_DIR"
83ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxService
84ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxClient
85ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxControl
86ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/vboxmslnk
87
88# prepare file list
89cd "$VBOX_BASEPKG_DIR"
90echo 'i pkginfo=./vboxguest.pkginfo' > prototype
91echo 'i postinstall=./postinstall.sh' >> prototype
92echo 'i preremove=./preremove.sh' >> prototype
93echo 'i space=./vboxguest.space' >> prototype
94echo 'i depend=./vboxguest.depend' >> prototype
95if test -f "./vboxguest.copyright"; then
96 echo 'i copyright=./vboxguest.copyright' >> prototype
97fi
98
99# Exclude directory entries to not cause conflicts (owner,group) with existing directories in the system
100find . ! -type d | $VBOX_GGREP -v -E 'prototype|makepackage.sh|vboxguest.pkginfo|postinstall.sh|preremove.sh|vboxguest.space|vboxguest.depend|vboxguest.copyright' | pkgproto >> prototype
101
102# Include opt/VirtualBoxAdditions and subdirectories as we want uninstall to clean up directory structure as well
103find . -type d | $VBOX_GGREP -E 'opt/VirtualBoxAdditions|var/svc/manifest/application/virtualbox' | pkgproto >> prototype
104
105# Include /etc/fs/vboxfs (as we need to create the subdirectory)
106find . -type d | $VBOX_GGREP -E 'etc/fs/vboxfs' | pkgproto >> prototype
107
108
109# don't grok for the class files
110filelist_fixup prototype '$2 == "none"' '$5 = "root"; $6 = "bin"'
111
112# VBoxService requires suid
113filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/VBoxService"' '$4 = "4755"'
114filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxService"' '$4 = "4755"'
115
116# Manifest class action scripts
117filelist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox/vboxservice.xml"' '$2 = "manifest";$6 = "sys"'
118filelist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox/vboxmslnk.xml"' '$2 = "manifest";$6 = "sys"'
119
120# vboxguest
121filelist_fixup prototype '$3 == "usr/kernel/drv/vboxguest"' '$6="sys"'
122filelist_fixup prototype '$3 == "usr/kernel/drv/amd64/vboxguest"' '$6="sys"'
123
124# vboxms
125filelist_fixup prototype '$3 == "usr/kernel/drv/vboxms"' '$6="sys"'
126filelist_fixup prototype '$3 == "usr/kernel/drv/amd64/vboxms"' '$6="sys"'
127
128# Use 'root' as group so as to match attributes with the previous installation and prevent a conflict. Otherwise pkgadd bails out thinking
129# we're violating directory attributes of another (non existing) package
130dirlist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox"' '$6 = "root"'
131
132echo " --- start of prototype ---"
133cat prototype
134echo " --- end of prototype --- "
135
136# explicitly set timestamp to shutup warning
137VBOXPKG_TIMESTAMP=vboxguest`date '+%Y%m%d%H%M%S'`_r$VBOX_SVN_REV
138
139# create the package instance
140pkgmk -d $VBOX_SOL_PKG_DEV -p $VBOXPKG_TIMESTAMP -o -r .
141
142# translate into package datastream
143pkgtrans -s -o "$VBOX_SOL_PKG_DEV" `pwd`/$VBOX_PKGFILENAME "$VBOX_PKGNAME"
144
145rm -rf "$VBOX_SOL_PKG_DEV/$VBOX_PKGNAME"
146exit $?
147
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