From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1aCiyz-0008IA-8Y for mharc-grub-devel@gnu.org; Sat, 26 Dec 2015 02:09:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35568) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aCiyw-0008Gz-6L for grub-devel@gnu.org; Sat, 26 Dec 2015 02:09:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aCiyt-00052Y-0j for grub-devel@gnu.org; Sat, 26 Dec 2015 02:09:38 -0500 Received: from mail-lf0-x22c.google.com ([2a00:1450:4010:c07::22c]:36815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aCiys-00052U-OW for grub-devel@gnu.org; Sat, 26 Dec 2015 02:09:34 -0500 Received: by mail-lf0-x22c.google.com with SMTP id z124so173901769lfa.3 for ; Fri, 25 Dec 2015 23:09:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=qlJvC+6niwLetmHBKi2UIP+LxdXK3vUSlUytFI7LjmE=; b=lEe49BsAoHPmEUyvxvhmc/WYiFArLKxvpU8yUgVe/Llk8yat3GP+Fob1VExmjJ/aYT bUvT9Wsy90xUmb4pyb3MsCTF7saURlSWozxkf26DaVGEt5+EJD0QeB41BeI/7ZUVohtk 4MLrkUP8BOlbsKk13oHsI0hNi+dkJ/LcAhDkY7lSjlREhHDzbJqMt8N374B7Tomqw+pA wo2lmeDZmnpKcsDGwpYfRcpQ/EJjMtq3FLi30JJHNanERn3JfmSr/0mSNH/nJAwgFkWJ ZaBd7gaQEx2yeln4ztdN1aZefe7JqTP/cLltEIrXq+2NSpIWvur7uyqcveMfPHTo2RvT eGkw== X-Received: by 10.25.149.20 with SMTP id x20mr16873194lfd.1.1451113773923; Fri, 25 Dec 2015 23:09:33 -0800 (PST) Received: from localhost.localdomain (ppp91-76-25-247.pppoe.mtu-net.ru. [91.76.25.247]) by smtp.gmail.com with ESMTPSA id h72sm910682lfe.33.2015.12.25.23.09.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 Dec 2015 23:09:32 -0800 (PST) From: Andrey Borzenkov To: grub-devel@gnu.org Subject: [PATCH] 30_os-prober: derive --class from os-prober generated label Date: Sat, 26 Dec 2015 10:09:28 +0300 Message-Id: <1451113768-16100-1-git-send-email-arvidjaar@gmail.com> X-Mailer: git-send-email 1.9.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::22c X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Dec 2015 07:09:39 -0000 Currently only Windows gets distinguished icons, everything else is displayed using the same generic one. Add additional --class based on os-prober returned label, which usually is expected to match primary distribution name. Also use it for Windows as well - chainloader prober nay actually return different strings (Windows, MS-DOS, Windows9xME). --- util/grub.d/30_os-prober.in | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index 5fc4f0c..5604ce2 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -135,6 +135,9 @@ for OS in ${OSPROBED} ; do LONGNAME="${LABEL}" fi + # os-prober returns text string followed by optional counter + CLASS="--class $(echo "${LABEL}" | LC_ALL=C sed 's,[[:digit:]]*$,,' | cut -d' ' -f1 | tr 'A-Z' 'a-z' | LC_ALL=C sed 's,[^[:alnum:]_],_,g')" + gettext_printf "Found %s on %s\n" "${LONGNAME}" "${DEVICE}" >&2 case ${BOOT} in @@ -142,7 +145,7 @@ for OS in ${OSPROBED} ; do onstr="$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF -menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' { +menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' { EOF save_default_entry | grub_add_tab prepare_grub_to_access_device ${DEVICE} | grub_add_tab @@ -174,7 +177,7 @@ EOF DEVICE=${DEVICE%@*} onstr="$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF -menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --class os \$menuentry_id_option 'osprober-efi-$(grub_get_device_id "${DEVICE}")' { +menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-efi-$(grub_get_device_id "${DEVICE}")' { EOF save_default_entry | sed -e "s/^/\t/" prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/" @@ -230,7 +233,7 @@ EOF if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then cat << EOF -menuentry '$(echo "$OS $onstr" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' { +menuentry '$(echo "$OS $onstr" | grub_quote)' $CLASS --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' { EOF save_default_entry | grub_add_tab printf '%s\n' "${prepare_boot_cache}" -- tg: (a9399f2..) u/os-prober-class (depends on: master)