VirtualBox

Changeset 95297 in vbox


Ignore:
Timestamp:
Jun 15, 2022 10:35:29 PM (2 years ago)
Author:
vboxsync
Message:

removed system.run from macos installer #10234

Location:
trunk/src/VBox/Installer/darwin/VirtualBox_mpkg
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/darwin/VirtualBox_mpkg/distribution-driverless.dist

    r94866 r95297  
    1515<installer-gui-script minSpecVersion="1.0">
    1616    <title>VirtualBox_title</title>
    17     <options customize="allow" allow-external-scripts="yes" rootVolumeOnly="true" hostArchitectures="@VBOX_ARCH_LIST@"/>
     17    <options customize="allow" rootVolumeOnly="true" hostArchitectures="@VBOX_ARCH_LIST@"/>
    1818    <installation-check script="checkPrerequisite()"></installation-check>
    1919    <domains enable_anywhere="false" enable_currentUserHome="false" enable_localSystem="true"/>
     
    5555       try
    5656       {
    57            /* The following shell script uses tools which were added in 10.8
    58               (Mountain Lion) and later, in particular pgrep and pkill. */
    59            if (system.compareVersions(system.version['ProductVersion'], '10.8') >= 0)
     57           /* Embedded scripts are not available here. Instead, run command to check for running VMs or running VBOX instance */
     58           runAppArr = system.applications.all()
     59           for (let i = 0; i < runAppArr.length; i++)
    6060           {
    61                /* Embedded scripts are not available here. So, just do a
    62                   command line checking if any VBoxXPCOMIPCD has more than one
    63                   client, and if there are none, kill all the usual suspects to
    64                   get a clean slate. This is done because the VirtualBox event
    65                   handling had a bug which allowed no longer present passive
    66                   event listeners to block VBoxSVC processes from exiting until
    67                   the waiting time was elapsed. In the extreme case this was
    68                   infinitely long, blocking updates. */
    69                system.run('/bin/sh', '-c', 'pids=`/usr/bin/pgrep VBoxXPCOMIPCD` rc=0; [ -z "$pids" ] && rc=1; 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 /usr/bin/pkill -KILL \'^(VirtualBox)|(VBoxNetDHCP)|(VBoxNetNAT)|(VBoxHeadless)|(VBoxXPCOMIPCD)|(VBoxSVC)$\'; sleep 1; fi');
     61                if (runAppArr[i]["FileCreator"] == "VBOX" || runAppArr[i]["FileCreator"] == "VBVM")
     62                {
     63                    result = false;
     64                }
    7065           }
    71        } catch (e) { system.log(e); }
    72 
    73        try
    74        {
    75            /* Embedded scripts are not available here. So, just do a command
    76               line checking for running VMs instead. */
    77            rcScript = system.run('/bin/sh', '-c', '/bin/ps -e | /usr/bin/grep -E \'[V]irtualBox.*startvm|[V]BoxNetDHCP|[V]BoxNetNAT|[V]BoxHeadless|[V]BoxSVC\'');
    78            result = (rcScript != 0);
    79            system.log("system.run /bin/sh .. returned: " + rcScript + " result=" + result);
     66           system.log("system.applications check => result=" + result);
    8067       } catch (e) { system.log(e); result = false; }
    8168
    8269       if (!result)
    8370       {
    84            /* Temporary instrumentation for finding out with some probability
    85             * who keeps VBoxSVC busy (unix socket to VBoxXPCOMIPCD open). Needs
    86             * very little time (unlike a full lsof) and causes bearable amount
    87             * of messages to install.log so that it can stay in for a while. */
    88            try
    89            {
    90                system.run('/usr/sbin/lsof', '-l', '-U');
    91            } catch (e) { system.log(e); }
    9271
    9372           my.result.type = 'Fatal';
  • trunk/src/VBox/Installer/darwin/VirtualBox_mpkg/distribution.dist

    r94866 r95297  
    1515<installer-gui-script minSpecVersion="1.0">
    1616    <title>VirtualBox_title</title>
    17     <options customize="allow" allow-external-scripts="yes" rootVolumeOnly="true" hostArchitectures="@VBOX_ARCH_LIST@"/>
     17    <options customize="allow" rootVolumeOnly="true" hostArchitectures="@VBOX_ARCH_LIST@"/>
    1818    <installation-check script="checkPrerequisite()"></installation-check>
    1919    <domains enable_anywhere="false" enable_currentUserHome="false" enable_localSystem="true"/>
     
    5555       try
    5656       {
    57            /* The following shell script uses tools which were added in 10.8
    58               (Mountain Lion) and later, in particular pgrep and pkill. */
    59            if (system.compareVersions(system.version['ProductVersion'], '10.8') >= 0)
     57           /* Embedded scripts are not available here. Instead, run command to check for running VMs or running VBOX instance */
     58           runAppArr = system.applications.all()
     59           for (let i = 0; i < runAppArr.length; i++)
    6060           {
    61                /* Embedded scripts are not available here. So, just do a
    62                   command line checking if any VBoxXPCOMIPCD has more than one
    63                   client, and if there are none, kill all the usual suspects to
    64                   get a clean slate. This is done because the VirtualBox event
    65                   handling had a bug which allowed no longer present passive
    66                   event listeners to block VBoxSVC processes from exiting until
    67                   the waiting time was elapsed. In the extreme case this was
    68                   infinitely long, blocking updates. */
    69                system.run('/bin/sh', '-c', 'pids=`/usr/bin/pgrep VBoxXPCOMIPCD` rc=0; [ -z "$pids" ] && rc=1; 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 /usr/bin/pkill -KILL \'^(VirtualBox)|(VBoxNetDHCP)|(VBoxNetNAT)|(VBoxHeadless)|(VBoxXPCOMIPCD)|(VBoxSVC)$\'; sleep 1; fi');
     61                if (runAppArr[i]["FileCreator"] == "VBOX" || runAppArr[i]["FileCreator"] == "VBVM")
     62                {
     63                    result = false;
     64                }
    7065           }
    71        } catch (e) { system.log(e); }
    72 
    73        try
    74        {
    75            /* Embedded scripts are not available here. So, just do a command
    76               line checking for running VMs instead. */
    77            rcScript = system.run('/bin/sh', '-c', '/bin/ps -e | /usr/bin/grep -E \'[V]irtualBox.*startvm|[V]BoxNetDHCP|[V]BoxNetNAT|[V]BoxHeadless|[V]BoxSVC\'');
    78            result = (rcScript != 0);
    79            system.log("system.run /bin/sh .. returned: " + rcScript + " result=" + result);
     66           system.log("system.applications check => result=" + result);
    8067       } catch (e) { system.log(e); result = false; }
    8168
    8269       if (!result)
    8370       {
    84            /* Temporary instrumentation for finding out with some probability
    85             * who keeps VBoxSVC busy (unix socket to VBoxXPCOMIPCD open). Needs
    86             * very little time (unlike a full lsof) and causes bearable amount
    87             * of messages to install.log so that it can stay in for a while. */
    88            try
    89            {
    90                system.run('/usr/sbin/lsof', '-l', '-U');
    91            } catch (e) { system.log(e); }
    9271
    9372           my.result.type = 'Fatal';
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