VirtualBox

Changeset 87035 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 3, 2020 1:47:23 PM (4 years ago)
Author:
vboxsync
Message:

Installer/solaris: Big cleanup of SysV packging, and first cut (so far the result will not be usable, permissions and so on need fixing) of IPS packaging. bugref:5999

Location:
trunk/src/VBox/Installer/solaris
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/solaris/Makefile.kmk

    r85654 r87035  
    4848# Base package
    4949PKGINFO_ARCH      = $(shell uname -p)
    50 PKGINFO_REVSTAMP  = $(date %Y.%m.%d.%H.%M)
     50PKGINFO_DATE      = $(date %Y.%m.%d.%H.%M.%S)
     51PKGINFO_REVSTAMP  = $(PKGINFO_DATE).$(VBOX_SVN_REV)
     52PKGINFO_PSTAMP    = vbox_$(subst .,,$(PKGINFO_DATE))_r$(VBOX_SVN_REV)
    5153PKG_FILENAME     := VirtualBox-$(VBOX_VERSION_STRING)-SunOS-$(KBUILD_TARGET_ARCH)-r$(VBOX_SVN_REV)
    5254
     
    6062PACKING          += \
    6163        $(PATH_STAGE_BIN)/$(PKG_FILENAME).tar.gz \
     64        $(if $(VBOX_WITH_SOLARIS_IPS_PACKAGE),$(PATH_STAGE_BIN)/$(PKG_FILENAME).p5p,) \
    6265        $(PATH_STAGE_BIN)/VirtualBoxDebug.tar.bz2
    6366OTHER_CLEAN      += \
    6467        $(VBOX_PATH_SI_SCRATCH)/$(PKG_FILENAME).pkg \
    6568        $(PATH_STAGE_BIN)/$(PKG_FILENAME).tar.gz \
    66         $(PATH_STAGE_BIN)/VirtualBoxDebug.tar.bz2
     69        $(PATH_STAGE_BIN)/$(PKG_FILENAME).p5p \
     70        $(PATH_STAGE_BIN)/VirtualBoxDebug.tar.bz2 \
     71        $(VBOX_PATH_SI_SCRATCH)/dist-copy.ts
    6772
    6873#
     
    527532
    528533#
    529 # Creates the System V style installer package.
    530 #
    531 solaris-package:: $(VBOX_PATH_SI_SCRATCH)/$(PKG_FILENAME).pkg
    532 $(VBOX_PATH_SI_SCRATCH)/$(PKG_FILENAME).pkg: \
     534# Copy all files needed for packaging into the final directory structure
     535#
     536$(VBOX_PATH_SI_SCRATCH)/dist-copy.ts: \
    533537                $(VBOX_VERSION_STAMP) \
    534538                \
     
    537541                $(VBOX_PATH_SOL_INST_SRC)/virtualbox.applications.in \
    538542                $(VBOX_PATH_SOL_INST_SRC)/vbox.pkginfo \
     543                $(VBOX_PATH_SOL_INST_SRC)/vbox-ips.mog \
    539544                \
    540545                $(if-expr defined(VBOX_WITH_ADDITIONS_PACKING),$(PATH_STAGE_BIN)/additions/VBoxGuestAdditions.iso,) \
     
    663668                -e "s/@VBOX_VENDOR@/$(VBOX_VENDOR)/g" \
    664669                -e "s/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g" \
    665                 -e "s/@VBOX_SVN_REV@/$(VBOX_SVN_REV)/g" \
    666670                -e "s/@VBOX_VERSION_REVSTAMP@/$(PKGINFO_REVSTAMP)/g" \
    667671                -e "s/@UNAME_P@/$(PKGINFO_ARCH)/g" \
     672                -e "s/@VBOX_PSTAMP@/$(PKGINFO_PSTAMP)/g" \
    668673                --output $(VBOX_PATH_SI_SCRATCH_PKG)/vbox.pkginfo \
    669674                $(VBOX_PATH_SOL_INST_SRC)/vbox.pkginfo
    670         $(INSTALL) -m 0644 $(VBOX_PATH_SOL_INST_SRC)/vbox.pkgresponse   $(VBOX_PATH_SI_SCRATCH_PKG)/autoresponse
    671 
    672 # Done copying file, create the package!
     675        $(SED)  -e "s/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g" \
     676                -e "s/@VBOX_VENDOR@/$(VBOX_VENDOR)/g" \
     677                -e "s/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g" \
     678                -e "s/@VBOX_SVN_REV@/$(VBOX_SVN_REV)/g" \
     679                -e "s/@UNAME_P@/$(PKGINFO_ARCH)/g" \
     680                --output $(VBOX_PATH_SI_SCRATCH_PKG)/vbox-ips.mog \
     681                $(VBOX_PATH_SOL_INST_SRC)/vbox-ips.mog
     682        $(APPEND) -t $@ "done"
     683
     684#
     685# Creates the System V style installer package.
     686#
     687solaris-package:: $(VBOX_PATH_SI_SCRATCH)/$(PKG_FILENAME).pkg
     688$(VBOX_PATH_SI_SCRATCH)/$(PKG_FILENAME).pkg: \
     689                $(VBOX_PATH_SI_SCRATCH)/dist-copy.ts \
     690                $(VBOX_SI_DEP_ON_MAKEFILE) \
     691                | $$(dir $$@)
    673692        $(call MSG_L1,Creating install package: $(PKG_FILENAME).pkg)
    674         $(REDIRECT) -C $(VBOX_PATH_SOL_INST_SRC) -- $(VBOX_PATH_SI_SCRATCH_PKG)/makepackage.sh \
     693        $(VBOX_PATH_SI_SCRATCH_PKG)/makepackage.sh \
    675694                $(if-expr defined(VBOX_WITH_HARDENING),--hardened,) \
    676695                $(VBOX_PATH_SI_SCRATCH_PKG) \
     
    679698                $(VBOX_SVN_REV)
    680699        $(MV) -- "$(VBOX_PATH_SI_SCRATCH_PKG)/$(PKG_FILENAME).pkg" "$@"
    681         $(RM) -Rf -- "$(VBOX_PATH_SI_SCRATCH_PKG)/"
    682 
    683 
    684 #
    685 # Creates the tar file containing license, readme and autoresponse file in addition to the system V package.
     700
     701#
     702# Creates the tar file containing license, readme and autoresponse file in addition to the System V package.
    686703#
    687704solaris-package-tar-gz:: $(PATH_STAGE_BIN)/$(PKG_FILENAME).tar.gz
     
    712729        $(call MSG_L1,Packaging $@ is completed.)
    713730
     731#
     732# Creates the IPS style installer package.
     733#
     734solaris-package-ips:: $(PATH_STAGE_BIN)/$(PKG_FILENAME).p5p
     735$(PATH_STAGE_BIN)/$(PKG_FILENAME).p5p: \
     736                $(VBOX_PATH_SI_SCRATCH)/dist-copy.ts \
     737                $(VBOX_SI_DEP_ON_MAKEFILE) \
     738                | $$(dir $$@)
     739        $(call MSG_L1,Creating install package: $(PKG_FILENAME).p5p)
     740        $(VBOX_PATH_SI_SCRATCH_PKG)/makepackage.sh \
     741                --ips \
     742                $(if-expr defined(VBOX_WITH_HARDENING),--hardened,) \
     743                $(VBOX_PATH_SI_SCRATCH_PKG) \
     744                $(PKG_FILENAME) \
     745                $(KBUILD_TARGET_ARCH) \
     746                $(VBOX_SVN_REV)
     747
    714748
    715749## List of file list variable names relevant for debug info.
  • trunk/src/VBox/Installer/solaris/makepackage.sh

    r82968 r87035  
    1919#
    2020# Usage:
    21 #       makepackage.sh [--hardened] $(PATH_TARGET)/install packagename {$(KBUILD_TARGET_ARCH)|neutral} $(VBOX_SVN_REV) [VBIPackageName]
     21#       makepackage.sh [--hardened] [--ips] $(PATH_TARGET)/install packagename {$(KBUILD_TARGET_ARCH)|neutral} $(VBOX_SVN_REV)
    2222
    2323
    2424# Parse options.
    2525HARDENED=""
    26 while test $# -ge 1;
     26IPS_PACKAGE=""
     27PACKAGE_SPEC="prototype"
     28while [ $# -ge 1 ];
    2729do
    2830    case "$1" in
    2931        --hardened)
    3032            HARDENED=1
     33            ;;
     34        --ips)
     35            IPS_PACKAGE=1
     36            PACKAGE_SPEC="virtualbox.p5m"
    3137            ;;
    3238    *)
     
    3844
    3945if [ -z "$4" ]; then
    40     echo "Usage: $0 installdir packagename x86|amd64 svnrev [VBIPackage]"
     46    echo "Usage: $0 installdir packagename x86|amd64 svnrev"
    4147    echo "-- packagename must not have any extension (e.g. VirtualBox-SunOS-amd64-r28899)"
    4248    exit 1
    4349fi
    4450
    45 PKG_BASE_DIR=$1
    46 VBOX_INSTALLED_DIR=$1/opt/VirtualBox
    47 VBOX_PKGFILE=$2.pkg
    48 VBOX_ARCHIVE=$2.tar.gz
     51PKG_BASE_DIR="$1"
     52PACKAGE_SPEC="$PKG_BASE_DIR/$PACKAGE_SPEC"
     53VBOX_INSTALLED_DIR=/opt/VirtualBox
     54if [ -n "$IPS_PACKAGE" ]; then
     55    VBOX_PKGFILE="$2".p5p
     56else
     57    VBOX_PKGFILE="$2".pkg
     58fi
    4959# VBOX_PKG_ARCH is currently unused.
    50 VBOX_PKG_ARCH=$3
    51 VBOX_SVN_REV=$4
    52 
    53 VBOX_PKGNAME=SUNWvbox
    54 VBOX_GGREP=/usr/sfw/bin/ggrep
    55 VBOX_AWK=/usr/bin/awk
    56 #VBOX_GTAR=/usr/sfw/bin/gtar
     60VBOX_PKG_ARCH="$3"
     61VBOX_SVN_REV="$4"
     62
     63if [ -n "$IPS_PACKAGE" ] ; then
     64    VBOX_PKGNAME=system/virtualbox
     65else
     66    VBOX_PKGNAME=SUNWvbox
     67fi
     68# need GNU grep because Solaris egrep does not support word matching
     69VBOX_GGREP=/usr/gnu/bin/grep
     70# need dynamic regex support which isn't available in S11 /usr/bin/awk
     71VBOX_AWK=/usr/xpg4/bin/awk
    5772
    5873# check for GNU grep we use which might not ship with all Solaris
    59 if test ! -f "$VBOX_GGREP" && test ! -h "$VBOX_GGREP"; then
     74if [ ! -f "$VBOX_GGREP" ] && [ ! -h "$VBOX_GGREP" ]; then
    6075    echo "## GNU grep not found in $VBOX_GGREP."
    6176    exit 1
    6277fi
    6378
    64 # check for GNU tar we use which might not ship with all Solaris
    65 #if test ! -f "$VBOX_GTAR" && test ! -h "$VBOX_GTAR"; then
    66 #    echo "## GNU tar not found in $VBOX_GTAR."
    67 #    exit 1
    68 #fi
    69 
    7079# bail out on non-zero exit status
    7180set -e
    7281
     82if [ -n "$IPS_PACKAGE" ]; then
     83
     84package_spec_create()
     85{
     86    > "$PACKAGE_SPEC"
     87}
     88
     89package_spec_append_info()
     90{
     91    : # provided by vbox-ips.mog
     92}
     93
     94package_spec_append_content()
     95{
     96    pkgsend generate "$1" | pkgfmt >> "$PACKAGE_SPEC"
     97}
     98
     99package_spec_append_hardlink()
     100{
     101    if [ -f "$3$4/amd64/$2" -o -f "$3$4/i386/$2" ]; then
     102        echo "hardlink path=$4/$2 target=$1" >> "$PACKAGE_SPEC"
     103    fi
     104}
     105
     106package_spec_fixup_content()
     107{
     108    :
     109}
     110
     111package_create()
     112{
     113    pkgmogrify -DVBOX_PKGNAME="$VBOX_PKGNAME" "$PACKAGE_SPEC" vbox-ips.mog | pkgfmt > "$PACKAGE_SPEC.1"
     114
     115    pkgdepend generate -m -d "$1" "$PACKAGE_SPEC.1" | pkgfmt > "$PACKAGE_SPEC.2"
     116
     117    pkgdepend resolve -m -v "$PACKAGE_SPEC.2"
     118
     119    pkglint "$PACKAGE_SPEC.2.res"
     120
     121    rm -rf "$1/vbox-repo"
     122    pkgrepo create "$1/vbox-repo"
     123    pkgrepo -s "$1/vbox-repo" set publisher/prefix=virtualbox
     124
     125    # Create package in local file repository
     126    pkgsend -s "$1/vbox-repo" publish -d "$1" "$PACKAGE_SPEC.2.res"
     127
     128    pkgrepo -s "$1/vbox-repo" info
     129    pkgrepo -s "$1/vbox-repo" list
     130
     131    # Convert into package archive
     132    pkgrecv -s "$1/vbox-repo" -a -d "$2" -m latest "$3"
     133    #rm -rf "$1/vbox-repo"
     134}
     135
     136else
     137
     138package_spec_create()
     139{
     140    > "$PACKAGE_SPEC"
     141}
     142
     143package_spec_append_info()
     144{
     145    echo 'i pkginfo=vbox.pkginfo' >> "$PACKAGE_SPEC"
     146    echo 'i checkinstall=checkinstall.sh' >> "$PACKAGE_SPEC"
     147    echo 'i postinstall=postinstall.sh' >> "$PACKAGE_SPEC"
     148    echo 'i preremove=preremove.sh' >> "$PACKAGE_SPEC"
     149    echo 'i space=vbox.space' >> "$PACKAGE_SPEC"
     150}
     151
     152# Our package is a non-relocatable package.
     153#
     154# pkgadd will take care of "relocating" them when they are used for remote installations using
     155# $PKG_INSTALL_ROOT and not $BASEDIR. Seems this little subtlety led to it's own page:
     156# https://docs.oracle.com/cd/E19253-01/820-4042/package-2/index.html
     157
     158package_spec_append_content()
     159{
     160    cd "$1"
     161    # Exclude directories to not cause install-time conflicts with existing system directories
     162    find . ! -type d | "$VBOX_GGREP" -v -wE 'prototype|makepackage\.sh|vbox\.pkginfo|postinstall\.sh|checkinstall\.sh|preremove\.sh|vbox\.space|virtualbox\.p5m.*' | LC_COLLATE=C sort | pkgproto >> "$PACKAGE_SPEC"
     163    cd -
     164    "$VBOX_AWK" 'NF == 3 && $1 == "s" && $2 == "none" { $3="/"$3 } { print }' "$PACKAGE_SPEC" > "$PACKAGE_SPEC.tmp"
     165    mv -f "$PACKAGE_SPEC.tmp" "$PACKAGE_SPEC"
     166    "$VBOX_AWK" 'NF == 6 && ($1 == "f" || $1 == "l") && ($2 == "none" || $2 == "manifest") { $3="/"$3 } { print }' "$PACKAGE_SPEC" > "$PACKAGE_SPEC.tmp"
     167    mv -f "$PACKAGE_SPEC.tmp" "$PACKAGE_SPEC"
     168
     169    cd "$1"
     170    # Include opt/VirtualBox and subdirectories as we want uninstall to clean up directory structure.
     171    # Include var/svc for manifest class action script does not create them.
     172    find . -type d | "$VBOX_GGREP" -E 'opt/VirtualBox|var/svc/manifest/application/virtualbox' | LC_COLLATE=C sort | pkgproto >> "$PACKAGE_SPEC"
     173    cd -
     174    "$VBOX_AWK" 'NF == 6 && $1 == "d" && $2 == "none" { $3="/"$3 } { print }' "$PACKAGE_SPEC" > "$PACKAGE_SPEC.tmp"
     175    mv -f "$PACKAGE_SPEC.tmp" "$PACKAGE_SPEC"
     176}
     177
     178package_spec_append_hardlink()
     179{
     180    if [ -f "$3$4/amd64/$2" -o -f "$3$4/i386/$2" ]; then
     181        echo "l none $4/$2=$1" >> "$PACKAGE_SPEC"
     182    fi
     183}
     184
    73185# Fixup filelist using awk, the parameters must be in awk syntax
    74186# params: filename condition action
    75 filelist_fixup()
    76 {
    77   "$VBOX_AWK" 'NF == 6 && '"$2"' { '"$3"' } { print }' "$1" > "tmp-$1"
    78   mv -f "tmp-$1" "$1"
    79 }
    80 
    81 dirlist_fixup()
    82 {
    83   "$VBOX_AWK" 'NF == 6 && $1 == "d" && '"$2"' { '"$3"' } { print }' "$1" > "tmp-$1"
    84   mv -f "tmp-$1" "$1"
    85 }
    86 
    87 hardlink_fixup()
    88 {
    89   "$VBOX_AWK" 'NF == 3 && $1=="l" && '"$2"' { '"$3"' } { print }' "$1" > "tmp-$1"
    90   mv -f "tmp-$1" "$1"
    91 }
    92 
    93 symlink_fixup()
    94 {
    95   "$VBOX_AWK" 'NF == 3 && $1=="s" && '"$2"' { '"$3"' } { print }' "$1" > "tmp-$1"
    96   mv -f "tmp-$1" "$1"
    97 }
    98 
    99 create_hardlink()
    100 {
    101     if test -f "$VBOX_INSTALLED_DIR/amd64/$1" || test -f "$VBOX_INSTALLED_DIR/i386/$1"; then
    102         ln -f ./VBoxISAExec "$VBOX_INSTALLED_DIR/$1"
     187package_spec_fixup_filelist()
     188{
     189    "$VBOX_AWK" 'NF == 6 && '"$1"' { '"$2"' } { print }' "$PACKAGE_SPEC" > "$PACKAGE_SPEC.tmp"
     190    mv -f "$PACKAGE_SPEC.tmp" "$PACKAGE_SPEC"
     191}
     192
     193package_spec_fixup_dirlist()
     194{
     195    "$VBOX_AWK" 'NF == 6 && $1 == "d" && '"$1"' { '"$2"' } { print }' "$PACKAGE_SPEC" > "$PACKAGE_SPEC.tmp"
     196    mv -f "$PACKAGE_SPEC.tmp" "$PACKAGE_SPEC"
     197}
     198
     199package_spec_fixup_content()
     200{
     201    # fix up file permissions (owner/group)
     202    # don't grok for class-specific files (like sed, if any)
     203    package_spec_fixup_filelist '$2 == "none"'                                                                  '$5 = "root"; $6 = "bin"'
     204
     205    # HostDriver vboxdrv
     206    package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/vboxdrv"'                                    '$6 = "sys"'
     207    package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/amd64/vboxdrv"'                              '$6 = "sys"'
     208
     209    # NetFilter vboxflt
     210    package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/vboxflt"'                                    '$6 = "sys"'
     211    package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/amd64/vboxflt"'                              '$6 = "sys"'
     212
     213    # NetFilter vboxbow
     214    package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/vboxbow"'                                    '$6 = "sys"'
     215    package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/amd64/vboxbow"'                              '$6 = "sys"'
     216
     217    # NetAdapter vboxnet
     218    package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/vboxnet"'                                    '$6 = "sys"'
     219    package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/amd64/vboxnet"'                              '$6 = "sys"'
     220
     221    # USBMonitor vboxusbmon
     222    package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/vboxusbmon"'                                 '$6 = "sys"'
     223    package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/amd64/vboxusbmon"'                           '$6 = "sys"'
     224
     225    # USB Client vboxusb
     226    package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/vboxusb"'                                    '$6 = "sys"'
     227    package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/amd64/vboxusb"'                              '$6 = "sys"'
     228
     229    # Manifest class action scripts
     230    package_spec_fixup_filelist '$3 == "/var/svc/manifest/application/virtualbox/virtualbox-webservice.xml"'    '$2 = "manifest";$6 = "sys"'
     231    package_spec_fixup_filelist '$3 == "/var/svc/manifest/application/virtualbox/virtualbox-balloonctrl.xml"'   '$2 = "manifest";$6 = "sys"'
     232    package_spec_fixup_filelist '$3 == "/var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml"'    '$2 = "manifest";$6 = "sys"'
     233
     234    # Use 'root' as group so as to match attributes with the previous installation and prevent a conflict. Otherwise pkgadd bails out thinking
     235    # we're violating directory attributes of another (non existing) package
     236    package_spec_fixup_dirlist '$3 == "/var/svc/manifest/application/virtualbox"'                               '$6 = "root"'
     237
     238    # Hardening requires some executables to be marked setuid.
     239    if [ -n "$HARDENED" ]; then
     240        package_spec_fixup_filelist '(   $3 == "/opt/VirtualBox/amd64/VirtualBoxVM" \
     241                                      || $3 == "/opt/VirtualBox/amd64/VBoxHeadless" \
     242                                      || $3 == "/opt/VirtualBox/amd64/VBoxSDL" \
     243                                      || $3 == "/opt/VirtualBox/i386/VirtualBox" \
     244                                      || $3 == "/opt/VirtualBox/i386/VBoxHeadless" \
     245                                      || $3 == "/opt/VirtualBox/i386/VBoxSDL" )'                                '$4 = "4755"'
    103246    fi
    104 }
    105 
    106 # Prepare file list
    107 cd "$PKG_BASE_DIR"
    108 echo 'i pkginfo=./vbox.pkginfo' > prototype
    109 echo 'i checkinstall=./checkinstall.sh' >> prototype
    110 echo 'i postinstall=./postinstall.sh' >> prototype
    111 echo 'i preremove=./preremove.sh' >> prototype
    112 echo 'i space=./vbox.space' >> prototype
    113 if test -f "./vbox.copyright"; then
    114     echo 'i copyright=./vbox.copyright' >> prototype
    115 fi
    116 
    117 # Create relative hardlinks for executables to either the 32-bit or 64-bit subfolders
    118 cd "$VBOX_INSTALLED_DIR"
    119 create_hardlink VBoxManage
    120 create_hardlink VBoxSDL
    121 create_hardlink VBoxAutostart
    122 create_hardlink vboxwebsrv
    123 create_hardlink VBoxZoneAccess
    124 create_hardlink VBoxSVC
    125 create_hardlink VBoxBugReport
    126 create_hardlink VBoxBalloonCtrl
    127 create_hardlink VBoxTestOGL
    128 create_hardlink VirtualBox
    129 create_hardlink VirtualBoxVM
    130 create_hardlink vbox-img
    131 create_hardlink VBoxHeadless
    132 
    133 # Exclude directories to not cause install-time conflicts with existing system directories
    134 cd "$PKG_BASE_DIR"
    135 find . ! -type d | $VBOX_GGREP -v -wE 'prototype|makepackage.sh|vbox.pkginfo|postinstall.sh|checkinstall.sh|preremove.sh|ReadMe.txt|vbox.space|vbox.depend|vbox.copyright|VirtualBoxKern' | pkgproto >> prototype
    136 
    137 # Include opt/VirtualBox and subdirectories as we want uninstall to clean up directory structure.
    138 # Include var/svc for manifest class action script does not create them.
    139 find . -type d | $VBOX_GGREP -E 'opt/VirtualBox|var/svc/manifest/application/virtualbox' | pkgproto >> prototype
    140 
    141 # fix up file permissions (owner/group)
    142 # don't grok for class-specific files (like sed, if any)
    143 filelist_fixup prototype '$2 == "none"'                                                                '$5 = "root"; $6 = "bin"'
    144 
    145 # don't include autoresponse and LICENSE from the base folder into / of
    146 # the package, it goes into .tar.gz and another one already exists
    147 # in /opt/VirtualBox
    148 sed '/f none autoresponse/d' prototype > prototype2
    149 mv -f prototype2 prototype
    150 sed '/f none LICENSE/d' prototype > prototype2
    151 mv -f prototype2 prototype
    152 
    153 # HostDriver vboxdrv
    154 filelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/vboxdrv"'                                   '$6 = "sys"'
    155 filelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/amd64/vboxdrv"'                             '$6 = "sys"'
    156 
    157 # NetFilter vboxflt
    158 filelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/vboxflt"'                                   '$6 = "sys"'
    159 filelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/amd64/vboxflt"'                             '$6 = "sys"'
    160 
    161 # NetFilter vboxbow
    162 filelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/vboxbow"'                                   '$6 = "sys"'
    163 filelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/amd64/vboxbow"'                             '$6 = "sys"'
    164 
    165 # NetAdapter vboxnet
    166 filelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/vboxnet"'                                   '$6 = "sys"'
    167 filelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/amd64/vboxnet"'                             '$6 = "sys"'
    168 
    169 # USBMonitor vboxusbmon
    170 filelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/vboxusbmon"'                                '$6 = "sys"'
    171 filelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/amd64/vboxusbmon"'                          '$6 = "sys"'
    172 
    173 # USB Client vboxusb
    174 filelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/vboxusb"'                                   '$6 = "sys"'
    175 filelist_fixup prototype '$3 == "platform/i86pc/kernel/drv/amd64/vboxusb"'                             '$6 = "sys"'
    176 
    177 # Manifest class action scripts
    178 filelist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox/virtualbox-webservice.xml"'    '$2 = "manifest";$6 = "sys"'
    179 filelist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox/virtualbox-balloonctrl.xml"'   '$2 = "manifest";$6 = "sys"'
    180 filelist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml"'    '$2 = "manifest";$6 = "sys"'
    181 
    182 # Use 'root' as group so as to match attributes with the previous installation and prevent a conflict. Otherwise pkgadd bails out thinking
    183 # we're violating directory attributes of another (non existing) package
    184 dirlist_fixup prototype  '$3 == "var/svc/manifest/application/virtualbox"'                              '$6 = "root"'
    185 
    186 # Hardening requires some executables to be marked setuid.
    187 if test -n "$HARDENED"; then
    188     $VBOX_AWK 'NF == 6 \
    189         && (    $3 == "opt/VirtualBox/amd64/VirtualBoxVM" \
    190             ||  $3 == "opt/VirtualBox/amd64/VBoxHeadless" \
    191             ||  $3 == "opt/VirtualBox/amd64/VBoxSDL" \
    192             ||  $3 == "opt/VirtualBox/i386/VirtualBox" \
    193             ||  $3 == "opt/VirtualBox/i386/VBoxHeadless" \
    194             ||  $3 == "opt/VirtualBox/i386/VBoxSDL" \
    195             ) \
    196        { $4 = "4755" } { print }' prototype > prototype2
    197     mv -f prototype2 prototype
    198 fi
    199 
    200 # Other executables that need setuid root (hardened or otherwise)
    201 $VBOX_AWK 'NF == 6 \
    202     && (    $3 == "opt/VirtualBox/amd64/VBoxNetAdpCtl" \
    203         ||  $3 == "opt/VirtualBox/i386/VBoxNetAdpCtl" \
    204         ||  $3 == "opt/VirtualBox/amd64/VBoxNetDHCP" \
    205         ||  $3 == "opt/VirtualBox/i386/VBoxNetDHCP" \
    206         ||  $3 == "opt/VirtualBox/amd64/VBoxNetNAT" \
    207         ||  $3 == "opt/VirtualBox/i386/VBoxNetNAT" \
    208         ) \
    209    { $4 = "4755" } { print }' prototype > prototype2
    210 mv -f prototype2 prototype
    211 
    212 # Our package is a non-relocatable package. pkgadd will take care of "relocating" them when they are used for
    213 # remote installations using $PKG_INSTALL_ROOT and not $BASEDIR. Seems this little subtlety led to it's own page:
    214 # http://docs.sun.com/app/docs/doc/820-4042/package-2?a=view
    215 filelist_fixup prototype  '$2 == "none"'                              '$3="/"$3'
    216 filelist_fixup prototype  '$2 == "manifest"'                          '$3="/"$3'
    217 symlink_fixup  prototype  '$2 == "none"'                              '$3="/"$3'
    218 hardlink_fixup prototype  '$2 == "none"'                              '$3="/"$3'
    219 
    220 echo " --- start of prototype  ---"
    221 cat prototype
    222 echo " --- end of prototype --- "
    223 
    224 # Explicitly set timestamp to shutup warning
    225 VBOXPKG_TIMESTAMP=vbox`date '+%Y%m%d%H%M%S'`_r$VBOX_SVN_REV
    226 
    227 # Create the package instance
    228 pkgmk -p $VBOXPKG_TIMESTAMP -o -r .
    229 
    230 # Translate into package datastream
    231 pkgtrans -s -o /var/spool/pkg "`pwd`/$VBOX_PKGFILE" "$VBOX_PKGNAME"
    232 
    233 # $5 if exists would contain the path to the VBI package to include in the .tar.gz
    234 #if [ -f LICENSE ]; then
    235 #    VBOX_LICENSEFILE=LICENSE
    236 #fi
    237 #if test -f "$5"; then
    238 #    $VBOX_GTAR zcvf "$VBOX_ARCHIVE" $VBOX_LICENSEFILE "$VBOX_PKGFILE" "$5" autoresponse ReadMe.txt
    239 #else
    240 #    $VBOX_GTAR zcvf "$VBOX_ARCHIVE" $VBOX_LICENSEFILE "$VBOX_PKGFILE" autoresponse ReadMe.txt
    241 #fi
     247
     248    # Other executables that need setuid root (hardened or otherwise)
     249    package_spec_fixup_filelist '(   $3 == "/opt/VirtualBox/amd64/VBoxNetAdpCtl" \
     250                                  || $3 == "/opt/VirtualBox/i386/VBoxNetAdpCtl" \
     251                                  || $3 == "/opt/VirtualBox/amd64/VBoxNetDHCP" \
     252                                  || $3 == "/opt/VirtualBox/i386/VBoxNetDHCP" \
     253                                  || $3 == "/opt/VirtualBox/amd64/VBoxNetNAT" \
     254                                  || $3 == "/opt/VirtualBox/i386/VBoxNetNAT" )'                                 '$4 = "4755"'
     255
     256    echo " --- start of $PACKAGE_SPEC  ---"
     257    cat "$PACKAGE_SPEC"
     258    echo " --- end of $PACKAGE_SPEC --- "
     259}
     260
     261package_create()
     262{
     263    # Create the package instance
     264    pkgmk -o -f "$PACKAGE_SPEC" -r "$1"
     265
     266    # Translate into package datastream
     267    pkgtrans -s -o /var/spool/pkg "$1/$2" "$3"
     268
     269    rm -rf "/var/spool/pkg/$2"
     270}
     271
     272fi
     273
     274
     275# Prepare package spec
     276package_spec_create
     277
     278# Metadata
     279package_spec_append_info "$PKG_BASE_DIR"
     280
     281# File and direcory list
     282package_spec_append_content "$PKG_BASE_DIR"
     283
     284# Add hardlinks for executables to launch the 32-bit or 64-bit executable
     285for f in VBoxManage VBoxSDL VBoxAutostart vboxwebsrv VBoxZoneAccess VBoxSVC VBoxBugReport VBoxBalloonCtrl VBoxTestOGL VirtualBox VirtualBoxVM vbox-img VBoxHeadless; do
     286    package_spec_append_hardlink VBoxISAExec    $f  "$PKG_BASE_DIR" "$VBOX_INSTALLED_DIR"
     287done
     288
     289package_spec_fixup_content
     290
     291package_create "$PKG_BASE_DIR" "$VBOX_PKGFILE" "$VBOX_PKGNAME" "$VBOX_SVN_REV"
    242292
    243293echo "## Package file created successfully!"
    244 rm -rf "/var/spool/pkg/$VBOX_PKGNAME"
    245294
    246295exit $?
    247 
  • trunk/src/VBox/Installer/solaris/vbox.pkginfo

    r30667 r87035  
    33SUNW_PRODNAME="@VBOX_PRODUCT@"
    44ARCH="@UNAME_P@"
    5 VERSION="@VBOX_VERSION_STRING@,REV=@VBOX_VERSION_REVSTAMP@.@VBOX_SVN_REV@"
     5VERSION="@VBOX_VERSION_STRING@,REV=@VBOX_VERSION_REVSTAMP@"
    66SUNW_PRODVERS="@VBOX_VERSION_STRING@"
    77SUNW_PKGVERS=1.0
     
    1414CLASSES=none manifest
    1515DESC="A powerful PC virtualization solution"
    16 
     16PSTAMP="@VBOX_PSTAMP@"
Note: See TracChangeset for help on using the changeset viewer.

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