UNPKG

alwaysai

Version:

The alwaysAI command-line interface (CLI)

71 lines 2.78 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.hailo = void 0; const alwayscli_1 = require("@alwaysai/alwayscli"); const docker_1 = require("../components/docker"); const user_1 = require("../components/user"); const environment_1 = require("../environment"); const util_1 = require("../util"); const docker_cmd_1 = require("../util/docker/docker-cmd"); const installPcieDriver = (0, alwayscli_1.CliLeaf)({ name: 'install-pcie-driver', description: 'Install the Hailo PCIe drivers', async action(_) { if (environment_1.ALWAYSAI_OS_PLATFORM !== 'linux') { throw new alwayscli_1.CliTerseError('Hailo is supported only on Linux systems.'); } await (0, user_1.checkUserIsLoggedInComponent)({ yes: false }); await (0, docker_1.checkForDockerComponent)(); const spawner = (0, util_1.JsSpawner)(); const hailoDockerfile = 'alwaysai/edgeiq-qa:hailo-amd64-latest'; await (0, docker_cmd_1.runDockerContainerForeground)({ targetHostSpawner: spawner, cmd: { dockerImageId: hailoDockerfile, remove: true, pullImage: true, volumes: [ '/lib/modules:/lib/modules', '/lib/firmware:/lib/firmware', '/lib/udev:/lib/udev', '/usr/src:/usr/src', '/dev:/dev' ], exe: '/bin/bash', exeArgs: ['-c', './install.sh --pcie-driver-only'] } }); } }); const uninstallPcieDriver = (0, alwayscli_1.CliLeaf)({ name: 'uninstall-pcie-driver', description: 'Uninstall the Hailo PCIe drivers', async action(_) { await (0, docker_1.checkForDockerComponent)(); const spawner = (0, util_1.JsSpawner)(); const hailoDockerfile = 'alwaysai/edgeiq-qa:hailo-amd64-latest'; await (0, docker_cmd_1.runDockerContainerForeground)({ targetHostSpawner: spawner, cmd: { dockerImageId: hailoDockerfile, remove: true, pullImage: true, volumes: [ '/lib/modules:/lib/modules', '/lib/firmware:/lib/firmware', '/lib/udev:/lib/udev', '/usr/src:/usr/src', '/dev:/dev' ], exe: '/bin/bash', exeArgs: ['-c', './uninstall.sh'] } }); } }); exports.hailo = (0, alwayscli_1.CliBranch)({ name: 'hailo', description: `Install or uninstall the Hailo PCIe drivers.`, subcommands: [installPcieDriver, uninstallPcieDriver] }); //# sourceMappingURL=hailo.js.map