From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-kernel-meta 2/5] proxmox-boot: add get_first_line_from_file helper and use it
Date: Mon, 31 Jan 2022 18:59:15 +0100 [thread overview]
Message-ID: <20220131175918.2099575-3-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20220131175918.2099575-1-s.ivanov@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
proxmox-boot/functions | 8 ++++++++
proxmox-boot/zz-proxmox-boot | 4 +---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/proxmox-boot/functions b/proxmox-boot/functions
index 6e19c20..4515a2d 100755
--- a/proxmox-boot/functions
+++ b/proxmox-boot/functions
@@ -101,3 +101,11 @@ loop_esp_list() {
"$@"
done
}
+
+get_first_line() {
+ file="$1"
+ while IFS= read -r line || [ -n "$line" ]; do
+ break
+ done < "${file}"
+ echo "$line"
+}
diff --git a/proxmox-boot/zz-proxmox-boot b/proxmox-boot/zz-proxmox-boot
index 90d4aa9..db73166 100755
--- a/proxmox-boot/zz-proxmox-boot
+++ b/proxmox-boot/zz-proxmox-boot
@@ -46,9 +46,7 @@ update_esps() {
fi
if [ -f /etc/kernel/cmdline ]; then
# we can have cmdline files with multiple or no new line at all, handle both!
- while IFS= read -r CMDLINE || [ -n "$CMDLINE" ]; do
- break
- done < /etc/kernel/cmdline
+ CMDLINE=$(get_first_line /etc/kernel/cmdline)
echo ${CMDLINE} | grep -q 'root=' || \
{ warn "No root= parameter in /etc/kernel/cmdline found!"; exit 1; }
else
--
2.30.2
next prev parent reply other threads:[~2022-01-31 17:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-31 17:59 [pve-devel] [PATCH pve-kernel-meta 0/5] proxmox-boot: add kernel pinning functionality (#3761) Stoiko Ivanov
2022-01-31 17:59 ` [pve-devel] [PATCH pve-kernel-meta 1/5] proxmox-boot: drop unused potential_esps function Stoiko Ivanov
2022-02-04 16:47 ` [pve-devel] applied: " Thomas Lamprecht
2022-01-31 17:59 ` Stoiko Ivanov [this message]
2022-02-04 16:47 ` [pve-devel] applied: [PATCH pve-kernel-meta 2/5] proxmox-boot: add get_first_line_from_file helper and use it Thomas Lamprecht
2022-01-31 17:59 ` [pve-devel] [PATCH pve-kernel-meta 3/5] proxmox-boot: fix #3671 add pin/unpin for kernel-version Stoiko Ivanov
[not found] ` <<20220131175918.2099575-4-s.ivanov@proxmox.com>
2022-02-01 11:35 ` Fabian Grünbichler
2022-01-31 17:59 ` [pve-devel] [PATCH pve-kernel-meta 4/5] proxmox-boot: add kernel next-boot command Stoiko Ivanov
2022-02-01 9:56 ` Aaron Lauterer
[not found] ` <<20220131175918.2099575-5-s.ivanov@proxmox.com>
2022-02-01 11:34 ` Fabian Grünbichler
2022-01-31 17:59 ` [pve-devel] [PATCH pve-kernel-meta 5/5] proxmox-boot: add pin/unpin functionality for non-p-b-t systems Stoiko Ivanov
2022-02-01 9:58 ` [pve-devel] [PATCH pve-kernel-meta 0/5] proxmox-boot: add kernel pinning functionality (#3761) Aaron Lauterer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220131175918.2099575-3-s.ivanov@proxmox.com \
--to=s.ivanov@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox