Bug#794409: os-prober: generic detection using /etc/os-release (for Void Linux and NixOS)
Package: os-prober
Version: 1.65
Severity: normal
Tags: patch
Dear Maintainer,
os-prober correctly detects Fedora 22, however it doesn't detect Void Linux or
NixOS (they are reported as unknown Linux distribution).
Actual os-prober 1.65 output:
/dev/mapper/os-fedora_root:Fedora release 22 (Twenty Two):Fedora:linux
/dev/mapper/os-void_root:unknown Linux distribution:Linux:linux
Expected output:
/dev/mapper/os-fedora_root:Fedora release 22 (Twenty Two):Fedora:linux
/dev/mapper/os-nixos_root:NixOS 14.12.801.221101a (Caterpillar):NixOS:linux
/dev/mapper/os-void_root:Void Linux:Void:linux
Both of these have an /etc/os-release file, and using the patch below allows
update-grub2 to generate the expected names.
--- a/usr/lib/os-probes/mounted/90linux-distro 2014-09-29 00:04:17.000000000
+0300
+++ b/usr/lib/os-probes/mounted/90linux-distro 2015-08-02 21:51:46.911231870
+0300
@@ -17,7 +17,7 @@
# symlinks we need to also check in $dir/usr/lib* for distributions that
# moved /lib* to /usr and only left symlinks behind.
# TODO: look for ld-linux.so on arches that have it
-if (ls "$dir"/lib*/ld*.so* || ls "$dir"/usr/lib*/ld*.so*) >/dev/null
2>/dev/null; then
+if (ls "$dir/etc/os-release" || ls "$dir"/lib*/ld*.so* || ls
"$dir"/usr/lib*/ld*.so*) >/dev/null 2>/dev/null; then
if [ -e "$dir/etc/debian_version" ]; then
short="Debian"
long="$(printf "Debian GNU/Linux (%s)\n" "$(cat
"$dir/etc/debian_version")")"
@@ -125,6 +125,9 @@
elif [ -e "$dir/etc/meego-release" ]; then
short="MeeGo"
long="$(head -1 "$dir/etc/meego-release")"
+ elif [ -e "$dir/etc/os-release" ]; then
+ short=$(cat $dir/etc/os-release|grep ^NAME=|cut -f2 -d=|cut -f2
-d\")
+ long=$(cat $dir/etc/os-release|grep ^PRETTY_NAME=|cut -f2
-d=|cut -f2 -d\")
else
short="Linux"
long="unknown Linux distribution"
-- System Information:
Debian Release: 8.1
APT prefers stable
APT policy: (900, 'stable'), (500, 'stable-updates'), (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.1.0-trunk-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
Versions of packages os-prober depends on:
ii libc6 2.19-18
os-prober recommends no packages.
os-prober suggests no packages.
-- no debconf information
Reply to: