[pve-devel] [PATCH proxmox-kernel-helper] boot tool: fix grep misinterpretation of arguments starting with a hyphen
Hannes Laimer
h.laimer at proxmox.com
Fri Jun 23 08:13:52 CEST 2023
`proxmox-boot-tool kernel remove --help`, or any version agrument
that started with a '-', lead to the grep usage message being written
into /etc/kernel/proxmox-boot-manual-kernels. The problem was `grep`
interpreted the kernel version agrument as an option since it starts
with '-'.
---
src/bin/proxmox-boot-tool | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/bin/proxmox-boot-tool b/src/bin/proxmox-boot-tool
index 913b0f6..302974b 100755
--- a/src/bin/proxmox-boot-tool
+++ b/src/bin/proxmox-boot-tool
@@ -27,7 +27,7 @@ _remove_entry_from_list_file() {
fi
if [ -e "$file" ]; then
- grep -vFx "$entry" "$file" > "$file.new" || true
+ grep -vFx -- "$entry" "$file" > "$file.new" || true
mv "$file.new" "$file"
else
echo "'$file' does not exist.."
@@ -279,7 +279,7 @@ remove_kernel() {
exit 1
fi
- if grep -sqFx "$ver" "$MANUAL_KERNEL_LIST"; then
+ if grep -sqFx -- "$ver" "$MANUAL_KERNEL_LIST"; then
_remove_entry_from_list_file "$MANUAL_KERNEL_LIST" "$ver"
echo "Removed kernel '$ver' from manual kernel list. Use the 'refresh' command to update the ESPs."
else
--
2.39.2
More information about the pve-devel
mailing list