def Run(self, args): """Unloads a driver.""" pub_key = config_lib.CONFIG["Client.driver_signing_public_key"] if not args.driver.Verify(pub_key): raise OSError("Driver signature signing failure.") # Unload the driver and pass exceptions through client_utils_osx.UninstallDriver(args.driver_name)
def Run(self, args): """Initializes the driver.""" # This action might crash the box so we need to flush the transaction log. self.SyncTransactionLog() if not args.driver: raise IOError("No driver supplied.") pub_key = config_lib.CONFIG.Get("Client.driver_signing_public_key") if not args.driver.Verify(pub_key): raise OSError("Driver signature signing failure.") if args.force_reload: client_utils_osx.UninstallDriver(args.driver_name) # Wrap the tarball in a file like object for tarfile to handle it. driver_buf = StringIO.StringIO(args.driver.data) # Unpack it to a temporary directory. with utils.TempDirectory() as kext_tmp_dir: driver_archive = tarfile.open(fileobj=driver_buf, mode="r:gz") driver_archive.extractall(kext_tmp_dir) # Now load it. kext_path = self._FindKext(kext_tmp_dir) logging.debug("Loading kext {0}".format(kext_path)) client_utils_osx.InstallDriver(kext_path)