kernel-install: allow overriding the plugin list too

The use of IFS=<newline> is dropped. Let's just iterate over the list, using
any whitespace as separator.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2022-07-01 12:55:32 +02:00
parent 2bbf6c3590
commit 6755285ccb
2 changed files with 20 additions and 10 deletions

View file

@ -255,6 +255,11 @@
<filename>install.conf</filename>, <filename>entry-token</filename>, and other files will be
read from this directory.</para>
<para><varname>$KERNEL_INSTALL_PLUGINS</varname> can be set to override the list of plugins executed by
<command>kernel-install</command>. The argument is a whitespace-separated list of paths.
<literal>KERNEL_INSTALL_PLUGINS=:</literal> may be used to prevent any plugins from running.
</para>
<para><varname>$MACHINE_ID</varname> can be set for <command>kernel-install</command> to override
<varname>$KERNEL_INSTALL_MACHINE_ID</varname>, the machine ID.</para>

View file

@ -312,15 +312,20 @@ MAKE_ENTRY_DIR_ABS=$?
ret=0
PLUGINS="$(
dropindirs_sort ".install" \
"/etc/kernel/install.d" \
"/usr/lib/kernel/install.d"
)"
IFS="
"
if [ -z "$KERNEL_INSTALL_PLUGINS" ]; then
KERNEL_INSTALL_PLUGINS="$(
dropindirs_sort ".install" \
"/etc/kernel/install.d" \
"/usr/lib/kernel/install.d"
)"
fi
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && printf '%s\n' "Plugin files:" "$PLUGINS"
if [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ]; then
printf '%s\n' "Plugin files:"
for f in $KERNEL_INSTALL_PLUGINS; do
printf '%s\n' "$f"
done
fi
case "$COMMAND" in
add)
@ -346,7 +351,7 @@ case "$COMMAND" in
fi
fi
for f in $PLUGINS; do
for f in $KERNEL_INSTALL_PLUGINS; do
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "+$f add $KERNEL_VERSION $ENTRY_DIR_ABS" "$@"
"$f" add "$KERNEL_VERSION" "$ENTRY_DIR_ABS" "$@"
@ -357,7 +362,7 @@ case "$COMMAND" in
;;
remove)
for f in $PLUGINS; do
for f in $KERNEL_INSTALL_PLUGINS; do
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "+$f remove $KERNEL_VERSION $ENTRY_DIR_ABS"
"$f" remove "$KERNEL_VERSION" "$ENTRY_DIR_ABS"
err=$?