VirtualBox

Ignore:
Timestamp:
Dec 23, 2021 1:22:16 PM (3 years ago)
Author:
vboxsync
Message:

ValidationKit/vboxinstaller.py: Add option to not install the kernel drivers (only implemented on darwin so far), bugref:9044 bugref:10138

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testdriver/vboxinstaller.py

    r92886 r93068  
    7373        self._fUnpackedBuildFiles = False;
    7474        self._fAutoInstallPuelExtPack = True;
     75        self._fKernelDrivers          = True;
    7576
    7677    #
     
    9192        reporter.log('      Indicates that the PUEL extension pack should not be installed if found.');
    9293        reporter.log('      The default is to install it if found in the vbox-build.');
     94        reporter.log('  --no-kernel-drivers');
     95        reporter.log('      Indicates that the kernel drivers should not be installed on platforms where this is supported.');
     96        reporter.log('      The default is to install them.');
    9397        reporter.log('  --');
    9498        reporter.log('      Indicates the end of our parameters and the start of the sub');
     
    115119        elif asArgs[iArg] == '--puel-extpack':
    116120            self._fAutoInstallPuelExtPack = True;
     121        elif asArgs[iArg] == '--no-kernel-drivers':
     122            self._fKernelDrivers = False;
     123        elif asArgs[iArg] == '--kernel-drivers':
     124            self._fKernelDrivers = True;
    117125        else:
    118126            return TestDriverBase.parseOption(self, asArgs, iArg);
     
    661669        return self._executeSync(['hdiutil', 'attach', '-readonly', '-mount', 'required', '-mountpoint', sMountPath, sDmg, ]);
    662670
     671    def _generateWithoutKextsChoicesXmlOnDarwin(self):
     672        """
     673        Generates the choices XML when kernel drivers are disabled.
     674        None is returned on failure.
     675        """
     676        sPath = os.path.join(self.sScratchPath, 'DarwinChoices.xml');
     677        oFile = utils.openNoInherit(sPath, 'wt');
     678        oFile.write('<?xml version="1.0" encoding="UTF-8"?>\n'
     679                    '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n'
     680                    '<plist version="1.0">\n'
     681                    '<array>\n'
     682                    '    <dict>\n'
     683                    '        <key>attributeSetting</key>\n'
     684                    '        <integer>0</integer>\n'
     685                    '        <key>choiceAttribute</key>\n'
     686                    '        <string>selected</string>\n'
     687                    '        <key>choiceIdentifier</key>\n'
     688                    '        <string>choiceVBoxKEXTs</string>\n'
     689                    '    </dict>\n'
     690                    '</array>\n'
     691                    '</plist>\n');
     692        oFile.close();
     693        return sPath;
     694
    663695    def _installVBoxOnDarwin(self):
    664696        """ Installs VBox on Mac OS X."""
     
    679711            # Install the package.
    680712            sPkg = os.path.join(self._darwinDmgPath(), 'VirtualBox.pkg');
    681             fRc, _ = self._sudoExecuteSync(['installer', '-verbose', '-dumplog', '-pkg', sPkg, '-target', '/']);
     713            if self._fKernelDrivers:
     714                fRc, _ = self._sudoExecuteSync(['installer', '-verbose', '-dumplog', '-pkg', sPkg, '-target', '/']);
     715            else:
     716                sChoicesXml = self._generateWithoutKextsChoicesXmlOnDarwin();
     717                if sChoicesXml is not None:
     718                    fRc, _ = self._sudoExecuteSync(['installer', '-verbose', '-dumplog', '-pkg', sPkg, \
     719                                                    '-applyChoiceChangesXML', sChoicesXml, '-target', '/']);
     720                else:
     721                    fRc = False;
    682722
    683723        # Unmount the DMG and we're done.
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