-
Notifications
You must be signed in to change notification settings - Fork 330
Open
Description
This code in platform.js does not work on Raspberry Pi OS versions above Buster:
// Check lsb_release for the name of a Linux distribution
const proc = child_process.spawnSync('lsb_release', ['-i', '-s']);
if (proc.status === 0) {
const lsb_release = proc.stdout.toString().trim();
switch (lsb_release) {
case 'Arch':
return 'linux-arch';
case 'Debian':
return 'linux-debian';
case 'Raspbian':
return 'linux-raspbian';
case 'Ubuntu':
return 'linux-ubuntu';
default:
return 'linux-unknown';
}
} else {
return 'linux-unknown';
}
}
as it results in, for example:
lsb_release -i -r
No LSB modules are available.
Distributor ID: Debian
Release: 12
My hack to fix this has been to do an earlier check if raspi-config exists first:
const raspi = child_process.spawnSync('which', ['raspi-config']);
if (raspi.status === 0) {
const raspi_string = raspi.stdout.toString().trim();
if(raspi_string.indexOf('raspi-config') != -1){
return 'linux-raspbian';
}
}
// Check lsb_release for the name of a Linux distribution
const proc = child_process.spawnSync('lsb_release', ['-i', '-s']);
if (proc.status === 0) {
const lsb_release = proc.stdout.toString().trim();
switch (lsb_release) {
case 'Arch':
return 'linux-arch';
case 'Debian':
return 'linux-debian';
case 'Raspbian':
return 'linux-raspbian';
case 'Ubuntu':
return 'linux-ubuntu';
default:
return 'linux-unknown';
}
} else {
return 'linux-unknown';
}
}
But there might be a more elegant solution. For example, this is one way to find the Raspberry Pi OS version:
cat /etc/os-release
Metadata
Metadata
Assignees
Labels
No labels