summaryrefslogtreecommitdiff
path: root/src/VBox/Installer/darwin/VirtualBox_mpkg/distribution.dist
blob: 576ae2f5446143963c5e306347826c5164319942 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?xml version="1.0" encoding="UTF-8"?>
<!--
#
# Copyright (C) 2008-2014 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# you can redistribute it and/or modify it under the terms of the GNU
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
-->
<installer-gui-script minSpecVersion="1.0">
    <title>VirtualBox_title</title>
    <options customize="allow" allow-external-scripts="yes" rootVolumeOnly="true" hostArchitectures="i386"/>
    <installation-check script="checkPrerequisite()"></installation-check>
    <domains enable_anywhere="false" enable_currentUserHome="false" enable_localSystem="true"/>
    <script>
    /* js:pkmk:start */
    function checkPrerequisite()
    {
       try
       {
           test = system.sysctl('hw.machine');
           system.log("Hardware architecture detected: " + test);
           result = (test == 'i386' || test == 'x86_64');
       } catch (e) { system.log(e); result = false; }

       if (!result)
       {
           my.result.type = 'Fatal';
           my.result.title = system.localizedString('UNSUPPORTED_HW_MACHINE_TLE');
           my.result.message = system.localizedString('UNSUPPORTED_HW_MACHINE_MSG');
           return result;
       }

       try
       {
           test = system.version['ProductVersion'];
           system.log("OS version detected: " + test);
           result = (system.compareVersions(test, '10.6') >= 0);
       } catch (e) { system.log(e); result = false; }

       if (!result)
       {
           my.result.type = 'Fatal';
           my.result.title = system.localizedString('UNSUPPORTED_OS_TLE');
           my.result.message = system.localizedString('UNSUPPORTED_OS_MSG');
           return result;
       }

       try
       {
           /* The following shell script uses tools which were added in 10.8
              (Mountain Lion) and later, in particular pgrep and pkill. */
           if (system.compareVersions(system.version['ProductVersion'], '10.8') >= 0)
           {
               /* Embedded scripts are not available here. So, just do a
                  command line checking if any VBoxXPCOMIPCD has more than one
                  client, and if there are none, kill all the usual suspects to
                  get a clean slate. This is done because the VirtualBox event
                  handling had a bug which allowed no longer present passive
                  event listeners to block VBoxSVC processes from exiting until
                  the waiting time was elapsed. In the extreme case this was
                  infinitely long, blocking updates. */
               system.run('/bin/sh', '-c', 'pids=`/usr/bin/pgrep VBoxXPCOMIPCD` rc=0; [ -n "$pid" ] || for i in $pids; do c=`/usr/sbin/lsof -p $i | /usr/bin/grep -E \'^[^ ]+ +[^ ]+ +[^ ]+ +[^ ]+ +unix\' | wc -l`; [ $c -le 2 ] || rc=1; done; if [ $rc -eq 0 ]; then pkill -KILL \'^(VirtualBox)|(VBoxNetDHCP)|(VBoxNetNAT)|(VBoxHeadless)|(VBoxXPCOMIPCD)|(VBoxSVC)$\'; sleep 1; fi');
           }
       } catch (e) { system.log(e); }

       try
       {
           /* Embedded scripts are not available here. So, just do a command
              line checking for running VMs instead. */
           rcScript = system.run('/bin/sh', '-c', '/bin/ps -e | /usr/bin/grep -E \'V[i]rtualBox.*startvm|VBoxNetDHCP|VBoxNetNAT|VBoxHeadless|VBoxSVC\'');
           result = (rcScript != 0);
           system.log("system.run /bin/sh .. returned: " + rcScript + " result=" + result);
       } catch (e) { system.log(e); result = false; }

       if (!result)
       {
           my.result.type = 'Fatal';
           my.result.title = system.localizedString('RUNNING_VMS_TLE');
           my.result.message = system.localizedString('RUNNING_VMS_MSG');
           return result;
       }

       system.log("result:" + result);
       return result;
    }
    /* js:pkmk:end */
    </script>
    <background file="background.tif" alignment="topleft" scaling="none"/>
    <welcome file="Welcome.rtf" mime-type="text/rtf" uti="public.rtf"/>
    <choices-outline>
        <line choice="choiceVBoxKEXTs"></line>
        <line choice="choiceVBox"></line>
        <line choice="choiceVBoxCLI"></line>
    </choices-outline>
    <choice id="choiceVBoxKEXTs"   title="choiceVBoxKEXTs_title"   description="choiceVBoxKEXTs_msg"   start_selected="true" start_enabled="false" start_visible="true">
        <pkg-ref id="org.virtualbox.pkg.vboxkexts"></pkg-ref>
    </choice>
    <choice id="choiceVBox"        title="choiceVBox_title"        description="choiceVBox_msg"        start_selected="true" start_enabled="false" start_visible="true">
        <pkg-ref id="org.virtualbox.pkg.virtualbox"></pkg-ref>
    </choice>
    <choice id="choiceVBoxCLI"     title="choiceVBoxCLI_title"     description="choiceVBoxCLI_msg"     start_selected="true" start_enabled="true" start_visible="true">
        <pkg-ref id="org.virtualbox.pkg.virtualboxcli"></pkg-ref>
    </choice>
    <pkg-ref id="org.virtualbox.pkg.vboxkexts" auth="Root">file:./Contents/Packages/VBoxKEXTs.pkg</pkg-ref>
    <pkg-ref id="org.virtualbox.pkg.virtualbox" auth="Root">file:./Contents/Packages/VirtualBox.pkg</pkg-ref>
    <pkg-ref id="org.virtualbox.pkg.virtualboxcli" auth="Root">file:./Contents/Packages/VirtualBoxCLI.pkg</pkg-ref>
</installer-gui-script>