]> git.proxmox.com Git - pve-kernel-meta.git/commitdiff
efiboot refresh: check --hook parameter
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 5 Aug 2019 11:25:13 +0000 (13:25 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 5 Aug 2019 11:26:08 +0000 (13:26 +0200)
against list of default hook scripts.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
bin/pve-efiboot-tool

index d9bb8299022a94a6bbc028cbafd44a0183676c23..97015f31998eb6d72b6aa5ced83bf81b8494d138 100755 (executable)
@@ -195,9 +195,16 @@ clean() {
 }
 
 refresh() {
-       hookscripts="$1"
-       if [ -z "$hookscripts" ]; then
-               hookscripts='pve-auto-removal zz-pve-efiboot'
+       hook=$1
+       hookscripts='pve-auto-removal zz-pve-efiboot'
+
+       if [ -n "$hook" ]; then
+           if echo "$hookscripts" | grep -sqE "(^|[[:space:]]+)$hook([[:space:]]+|$)"; then
+               hookscripts="$hook"
+           else
+               warn "E: '$hook' is not a valid hook script name.";
+               exit 1;
+           fi
        fi
 
        for script in $hookscripts; do