VirtualBox

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

最後變更 在這個檔案從39235是 39235,由 vboxsync 提交於 13 年 前

Additions/solaris: Fix VBoxService loading using manifest class actions. Classify VBoxService under "applications" rather than "system".

  • 屬性 svn:eol-style 設為 LF
  • 屬性 svn:keywords 設為 Id
檔案大小: 4.8 KB
 
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.alldomusa.eu.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
61dirlist_fixup()
62{
63 "$VBOX_AWK" 'NF == 6 && $1 == "d" && '"$2"' { '"$3"' } { print }' "$1" > "tmp-$1"
64 mv -f "tmp-$1" "$1"
65}
66
67# Create relative hardlinks
68cd "$VBOX_INSTALLED_DIR"
69ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxService
70ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxClient
71ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxControl
72
73# prepare file list
74cd "$VBOX_BASEPKG_DIR"
75echo 'i pkginfo=./vboxguest.pkginfo' > prototype
76echo 'i postinstall=./postinstall.sh' >> prototype
77echo 'i preremove=./preremove.sh' >> prototype
78echo 'i space=./vboxguest.space' >> prototype
79echo 'i depend=./vboxguest.depend' >> prototype
80if test -f "./vboxguest.copyright"; then
81 echo 'i copyright=./vboxguest.copyright' >> prototype
82fi
83
84# Exclude directory entries to not cause conflicts (owner,group) with existing directories in the system
85find . ! -type d | $VBOX_GGREP -v -E 'prototype|makepackage.sh|vboxguest.pkginfo|postinstall.sh|preremove.sh|vboxguest.space|vboxguest.depend|vboxguest.copyright' | pkgproto >> prototype
86
87# Include opt/VirtualBoxAdditions and subdirectories as we want uninstall to clean up directory structure as well
88find . -type d | $VBOX_GGREP -E 'opt/VirtualBoxAdditions|var/svc/manifest/application/virtualbox' | pkgproto >> prototype
89
90# Include /etc/fs/vboxfs (as we need to create the subdirectory)
91find . -type d | $VBOX_GGREP -E 'etc/fs/vboxfs' | pkgproto >> prototype
92
93
94# don't grok for the class files
95filelist_fixup prototype '$2 == "none"' '$5 = "root"; $6 = "bin"'
96
97# VBoxService requires suid
98filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/VBoxService"' '$4 = "4755"'
99filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxService"' '$4 = "4755"'
100
101# Manifest class action scripts
102filelist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox/vboxservice.xml"' '$2 = "manifest";$6 = "sys"'
103
104# vboxguest
105filelist_fixup prototype '$3 == "usr/kernel/drv/vboxguest"' '$6="sys"'
106filelist_fixup prototype '$3 == "usr/kernel/drv/amd64/vboxguest"' '$6="sys"'
107
108# Use 'root' as group so as to match attributes with the previous installation and prevent a conflict. Otherwise pkgadd bails out thinking
109# we're violating directory attributes of another (non existing) package
110dirlist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox"' '$6 = "root"'
111
112echo " --- start of prototype ---"
113cat prototype
114echo " --- end of prototype --- "
115
116# explicitly set timestamp to shutup warning
117VBOXPKG_TIMESTAMP=vboxguest`date '+%Y%m%d%H%M%S'`_r$VBOX_SVN_REV
118
119# create the package instance
120pkgmk -p $VBOXPKG_TIMESTAMP -o -r .
121
122# translate into package datastream
123pkgtrans -s -o /var/spool/pkg `pwd`/$VBOX_PKGFILENAME "$VBOX_PKGNAME"
124
125rm -rf "/var/spool/pkg/$VBOX_PKGNAME"
126exit $?
127
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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