SHA256
1
0
forked from pool/os-prober
os-prober/os-prober-linux-distro-parse-os-release.patch
Andrei Borzenkov 1b693631e1 Accepting request 428945 from home:michael-chang:branches:Base:System
- Parse /etc/os-release for openSUSE Tumbleweed (bsc#997465)
  * os-prober-linux-distro-parse-os-release.patch

OBS-URL: https://build.opensuse.org/request/show/428945
OBS-URL: https://build.opensuse.org/package/show/Base:System/os-prober?expand=0&rev=67
2016-09-20 12:58:34 +00:00

15 lines
916 B
Diff

Index: os-prober-1.70/os-probes/mounted/common/90linux-distro
===================================================================
--- os-prober-1.70.orig/os-probes/mounted/common/90linux-distro
+++ os-prober-1.70/os-probes/mounted/common/90linux-distro
@@ -117,6 +117,9 @@ elif [ -e "$dir/etc/lfs-release" ]; then
elif [ -e "$dir/etc/meego-release" ]; then
short="MeeGo"
long="$(head -1 "$dir/etc/meego-release")"
+elif [ -e "$dir/etc/os-release" ]; then
+ short=$(sed -n "/^NAME=/{s@\"\(.*\)\"@\1@;t 1;s@'\(.*\)'@\1@;: 1;s@^[^=]\+=@@;p;b}" $dir/etc/os-release)
+ long="$short $(sed -n "/^VERSION=/{s@\"\(.*\)\"@\1@;t 1;s@'\(.*\)'@\1@;: 1;s@^[^=]\+=@@;p;b}" $dir/etc/os-release)"
# This test is inaccurate, but given separate / and /boot partitions and the
# fact that only some architectures have ld-linux.so, I can't see anything
# better. Make sure this test has a high number so that more accurate tests