alwaysai
Version:
The alwaysAI command-line interface (CLI)
41 lines • 1.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getL4TVersion = void 0;
const logger_1 = require("./logger");
const stringify_error_1 = require("./stringify-error");
async function getL4TVersion(props) {
const { spawner } = props;
let l4tInfo = '';
try {
// These steps are the equivalent of running:
// `dpkg -l | grep 'nvidia-l4t-core' | awk '{print $3}'`
const packages = await spawner.run({
exe: 'dpkg',
args: ['-l']
});
const packageArr = packages.split('\n');
for (const p of packageArr) {
// l4tInfo is in the form:
// `ii nvidia-l4t-core 35.2.1-20230124153320 arm64 NVIDIA Core Package`
if (p.includes('nvidia-l4t-core')) {
const details = p.split(/\s+/);
l4tInfo = details[2];
}
}
}
catch (err) {
logger_1.logger.error((0, stringify_error_1.stringifyError)(err));
}
logger_1.logger.debug(l4tInfo);
const re = RegExp('([0-9]+.[0-9]+(.[0-9]+)?).*', 'g');
const found = re.exec(l4tInfo.trim());
logger_1.logger.debug(found);
let l4tVersion = null;
if (found && found.length >= 2) {
// Group 1 contains the L4T version string
l4tVersion = found[1];
}
return l4tVersion;
}
exports.getL4TVersion = getL4TVersion;
//# sourceMappingURL=l4t-version.js.map