VirtualBox

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

Last change on this file was 98103, checked in by vboxsync, 17 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
File size: 5.8 KB
Line 
1#!/bin/sh
2# $Id: makepackage.sh 98103 2023-01-17 14:15:46Z vboxsync $
3## @file
4# VirtualBox Solaris Guest Additions package creation script.
5#
6
7#
8# Copyright (C) 2008-2023 Oracle and/or its affiliates.
9#
10# This file is part of VirtualBox base platform packages, as
11# available from https://www.virtualbox.org.
12#
13# This program is free software; you can redistribute it and/or
14# modify it under the terms of the GNU General Public License
15# as published by the Free Software Foundation, in version 3 of the
16# License.
17#
18# This program is distributed in the hope that it will be useful, but
19# WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21# General Public License for more details.
22#
23# You should have received a copy of the GNU General Public License
24# along with this program; if not, see <https://www.gnu.org/licenses>.
25#
26# The contents of this file may alternatively be used under the terms
27# of the Common Development and Distribution License Version 1.0
28# (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
29# in the VirtualBox distribution, in which case the provisions of the
30# CDDL are applicable instead of those of the GPL.
31#
32# You may elect to license modified versions of this file under the
33# terms and conditions of either the GPL or the CDDL or both.
34#
35# SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
36#
37
38#
39# Usage:
40# makespackage.sh $(PATH_TARGET)/install packagename svnrev
41
42if test -z "$3"; then
43 echo "Usage: $0 installdir packagename svnrev"
44 exit 1
45fi
46ostype=`uname -s`
47if test "$ostype" != "Linux" && test "$ostype" != "SunOS" ; then
48 echo "Linux/Solaris not detected."
49 exit 1
50fi
51
52VBOX_BASEPKG_DIR=$1
53VBOX_INSTALLED_DIR="$VBOX_BASEPKG_DIR"/opt/VirtualBoxAdditions
54VBOX_PKGFILENAME=$2
55VBOX_SVN_REV=$3
56
57VBOX_PKGNAME=SUNWvboxguest
58VBOX_AWK=/usr/bin/awk
59case "$ostype" in
60"SunOS")
61 VBOX_GGREP=/usr/sfw/bin/ggrep
62 VBOX_SOL_PKG_DEV=/var/spool/pkg
63 ;;
64*)
65 VBOX_GGREP=`which grep`
66 VBOX_SOL_PKG_DEV=$4
67 ;;
68esac
69VBOX_AWK=/usr/bin/awk
70
71# check for GNU grep we use which might not ship with all Solaris
72if test ! -f "$VBOX_GGREP" && test ! -h "$VBOX_GGREP"; then
73 echo "## GNU grep not found in $VBOX_GGREP."
74 exit 1
75fi
76
77# bail out on non-zero exit status
78set -e
79
80# Fixup filelist using awk, the parameters must be in awk syntax
81# params: filename condition action
82filelist_fixup()
83{
84 "$VBOX_AWK" 'NF == 6 && '"$2"' { '"$3"' } { print }' "$1" > "tmp-$1"
85 mv -f "tmp-$1" "$1"
86}
87
88dirlist_fixup()
89{
90 "$VBOX_AWK" 'NF == 6 && $1 == "d" && '"$2"' { '"$3"' } { print }' "$1" > "tmp-$1"
91 mv -f "tmp-$1" "$1"
92}
93
94# Create relative hardlinks
95cd "$VBOX_INSTALLED_DIR"
96ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxService
97ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxClient
98ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxControl
99ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/vboxmslnk
100
101# prepare file list
102cd "$VBOX_BASEPKG_DIR"
103echo 'i pkginfo=./vboxguest.pkginfo' > prototype
104echo 'i postinstall=./postinstall.sh' >> prototype
105echo 'i preremove=./preremove.sh' >> prototype
106echo 'i space=./vboxguest.space' >> prototype
107echo 'i depend=./vboxguest.depend' >> prototype
108if test -f "./vboxguest.copyright"; then
109 echo 'i copyright=./vboxguest.copyright' >> prototype
110fi
111
112# Exclude directory entries to not cause conflicts (owner,group) with existing directories in the system
113find . ! -type d | $VBOX_GGREP -v -E 'prototype|makepackage.sh|vboxguest.pkginfo|postinstall.sh|preremove.sh|vboxguest.space|vboxguest.depend|vboxguest.copyright' | pkgproto >> prototype
114
115# Include opt/VirtualBoxAdditions and subdirectories as we want uninstall to clean up directory structure as well
116find . -type d | $VBOX_GGREP -E 'opt/VirtualBoxAdditions|var/svc/manifest/application/virtualbox' | pkgproto >> prototype
117
118# Include /etc/fs/vboxfs (as we need to create the subdirectory)
119find . -type d | $VBOX_GGREP -E 'etc/fs/vboxfs' | pkgproto >> prototype
120
121
122# don't grok for the class files
123filelist_fixup prototype '$2 == "none"' '$5 = "root"; $6 = "bin"'
124
125# VBoxService requires suid
126filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/VBoxService"' '$4 = "4755"'
127filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxService"' '$4 = "4755"'
128
129# Manifest class action scripts
130filelist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox/vboxservice.xml"' '$2 = "manifest";$6 = "sys"'
131filelist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox/vboxmslnk.xml"' '$2 = "manifest";$6 = "sys"'
132
133# vboxguest
134filelist_fixup prototype '$3 == "usr/kernel/drv/vboxguest"' '$6="sys"'
135filelist_fixup prototype '$3 == "usr/kernel/drv/amd64/vboxguest"' '$6="sys"'
136
137# vboxms
138filelist_fixup prototype '$3 == "usr/kernel/drv/vboxms"' '$6="sys"'
139filelist_fixup prototype '$3 == "usr/kernel/drv/amd64/vboxms"' '$6="sys"'
140
141# Use 'root' as group so as to match attributes with the previous installation and prevent a conflict. Otherwise pkgadd bails out thinking
142# we're violating directory attributes of another (non existing) package
143dirlist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox"' '$6 = "root"'
144
145echo " --- start of prototype ---"
146cat prototype
147echo " --- end of prototype --- "
148
149# explicitly set timestamp to shutup warning
150VBOXPKG_TIMESTAMP=vboxguest`date '+%Y%m%d%H%M%S'`_r$VBOX_SVN_REV
151
152# create the package instance
153pkgmk -d $VBOX_SOL_PKG_DEV -p $VBOXPKG_TIMESTAMP -o -r .
154
155# translate into package datastream
156pkgtrans -s -o "$VBOX_SOL_PKG_DEV" `pwd`/$VBOX_PKGFILENAME "$VBOX_PKGNAME"
157
158rm -rf "$VBOX_SOL_PKG_DEV/$VBOX_PKGNAME"
159exit $?
160
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use