From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1nljuP-0008Q0-C8 for mharc-grub-devel@gnu.org; Tue, 03 May 2022 00:13:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nljuL-0008Po-5q for grub-devel@gnu.org; Tue, 03 May 2022 00:13:05 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:40769) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nljuJ-0003fX-Dg for grub-devel@gnu.org; Tue, 03 May 2022 00:13:04 -0400 Received: by mail-wm1-x335.google.com with SMTP id v64-20020a1cac43000000b0038cfd1b3a6dso606204wme.5 for ; Mon, 02 May 2022 21:13:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-disposition; bh=kTGJtRHfS4YTZUwAhRmZ1NpNXJobgudi/3VNqBqIXEM=; b=DFcEWLvfVQ5BF4AJtNGEuBiraVXrAb+/RgUGM1Ooby/+A/cBs1Ks1gkGnSwTpp2fGg HSe+pxF5CnRDN3K2fOrufEarchAL9mVFh+3+36N22x7TTBSOQwZ46o+Cnt0FqjVlp9D5 +ZLW1rwwsgBtqbIJB3swCuXgy8Y6uA27aoFSR9hhHsm33g7GomAiLZ0ZoP/I31TkYohD CANjucORTPIrQ4tsY/X8Y2+yzSAK6HSANtYYq8bbtdoDh5yc70Zs4cIiMe7wYDRrzlFy rEEYHLWop0BbHOmE0AJUhk1M6qpVGdhpobllfYBt/r8TKElxFcGSpwZoGr4WMy6/0Ofw 8VCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :mime-version:content-disposition; bh=kTGJtRHfS4YTZUwAhRmZ1NpNXJobgudi/3VNqBqIXEM=; b=HJ38fl7AZSFJSjDdquttAEx8HBJhb+1tZYBBFJyAxzfqtrQgrdo8VXVWwuSlwn3Qib gnaOAPcahQ3uR+3jzISzCIJFHbGJOlpoZcbCPUIxEiacXdqvWrn/BNdcI0mLXToCEewA 5+qWtRorDOiOD5KOPBgXXDxBkkaiXwp0gQSWyXlC/wWzuXp5vBGxS2JmeaF6Ki2+N2Yd dkgkyGP+/6Cnxs7hpMI9HAt+YjP0mq+t38USYrYhgPVkaIIuFic+A7u3xpyJ5jUawOCx 83syCdDitwjqgk97A9fzUI71Ezw0xRV61LmlgYuo53Z2XSwHroqwlqu1AeicOrBFgqlx 9nHQ== X-Gm-Message-State: AOAM533lK94ZDvO3ZQK+11SXgD0v2kTj7yb9lfvFB0N4PBAhxl/HY7or n2XReWrTMwU3rKa2hyI4fViSlx7u030= X-Google-Smtp-Source: ABdhPJz2glsU1wMndgPomR+31FGns6cqv9BTnTiMOdILdY7SxauUc3bRdekrx1XuZrHaqMuedBq9TA== X-Received: by 2002:a1c:f207:0:b0:38e:9aac:df41 with SMTP id s7-20020a1cf207000000b0038e9aacdf41mr1581622wmc.14.1651551181015; Mon, 02 May 2022 21:13:01 -0700 (PDT) Received: from dj3ntoo (88.sub-72-109-207.myvzw.com. [72.109.207.88]) by smtp.gmail.com with ESMTPSA id p14-20020adfaa0e000000b0020c5253d8f6sm8306944wrd.66.2022.05.02.21.12.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 21:13:00 -0700 (PDT) Date: Mon, 2 May 2022 23:12:56 -0500 From: Oskari Pirhonen To: grub-devel@gnu.org Subject: [PATCH v3] util/grub.d/linux: Improve initramfs detection Message-ID: Mail-Followup-To: grub-devel@gnu.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=xxc3ncoredxx@gmail.com; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2022 04:13:05 -0000 Add detection for initramfs of the form *.img.old. For example, Gentoo's sys-kernel/genkernel installs it as initramfs-*.img and moves any existing one to initramfs-*.img.old. Apply the same scheme to initrd-*.img and initrd-*.gz files for consistency. Signed-off-by: Oskari Pirhonen --- v2 -> v3: - include initrd-* files in the commit message - fix indentation to follow existing - leave initramfs-genkernel-* on their own line v1 -> v2: - don't reorder the checks - include 20_linux_xen.in util/grub.d/10_linux.in | 6 ++++-- util/grub.d/20_linux_xen.in | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in index ca068038e..b4a4d6900 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -215,8 +215,10 @@ while [ "x$list" != "x" ] ; do done initrd_real= - for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \ - "initrd-${version}" "initramfs-${version}.img" \ + for i in "initrd.img-${version}" "initrd-${version}.img" \ + "initrd-${alt_version}.img.old" "initrd-${version}.gz" \ + "initrd-${alt_version}.gz.old" "initrd-${version}" \ + "initramfs-${version}.img" "initramfs-${alt_version}.img.old" \ "initrd.img-${alt_version}" "initrd-${alt_version}.img" \ "initrd-${alt_version}" "initramfs-${alt_version}.img" \ "initramfs-genkernel-${version}" \ diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in index f45559ff8..51a983926 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -284,8 +284,10 @@ while [ "x${xen_list}" != "x" ] ; do linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" initrd_real= - for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \ - "initrd-${version}" "initramfs-${version}.img" \ + for i in "initrd.img-${version}" "initrd-${version}.img" \ + "initrd-${alt_version}.img.old" "initrd-${version}.gz" \ + "initrd-${alt_version}.gz.old" "initrd-${version}" \ + "initramfs-${version}.img" "initramfs-${alt_version}.img.old" \ "initrd.img-${alt_version}" "initrd-${alt_version}.img" \ "initrd-${alt_version}" "initramfs-${alt_version}.img" \ "initramfs-genkernel-${version}" \ -- 2.35.1