[pve-devel] [PATCH pve-kernel-meta v3 1/4] proxmox-boot: return empty if file does not exist in get_first_line

Stoiko Ivanov s.ivanov at proxmox.com
Fri Feb 11 16:15:41 CET 2022


makes using this helper shorter in most cases

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 proxmox-boot/functions | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/proxmox-boot/functions b/proxmox-boot/functions
index 4515a2d..27da363 100755
--- a/proxmox-boot/functions
+++ b/proxmox-boot/functions
@@ -104,6 +104,11 @@ loop_esp_list() {
 
 get_first_line() {
 	file="$1"
+	if [ ! -e  "$file" ]; then
+	    echo ""
+	    return
+	fi
+
 	while IFS= read -r line || [ -n "$line" ]; do
 		break
 	done < "${file}"
-- 
2.30.2






More information about the pve-devel mailing list