kernel-install: several follow-ups for --entry-type= (#38160)

Follow-ups for b6d4997683 (#37897).
This commit is contained in:
Yu Watanabe
2025-07-11 20:07:19 +09:00
committed by GitHub
3 changed files with 26 additions and 8 deletions

View File

@@ -321,6 +321,23 @@
</listitem>
</varlistentry>
<varlistentry>
<term><option>--entry-type=type1|type2|all</option></term>
<listitem>
<para>
Controls the type of entries handled by the command. This is typically useful when multiple types
of boot entries with the same kernel version are installed, and only one should be removed. When
<literal>type1</literal> or <literal>type2</literal> is specified, each plugin is invoked with
<varname>$KERNEL_INSTALL_BOOT_ENTRY_TYPE</varname> environment variable with the specified
value. When <literal>all</literal> is specified, the environment variable will not be set.
Defaults to <literal>all</literal>.
</para>
<xi:include href="version-info.xml" xpointer="v258"/>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--entry-token=</option></term>

View File

@@ -33,11 +33,12 @@ case "$COMMAND" in
exec depmod -a "$KERNEL_VERSION"
;;
remove)
[ "$KERNEL_INSTALL_BOOT_ENTRY_TYPE" = "type2" ] || \
[ "$KERNEL_INSTALL_BOOT_ENTRY_TYPE" = "type1" ] && \
[ -d "/lib/modules/$KERNEL_VERSION/kernel" ] && \
echo "Multiple entry types exist, not removing modules.dep or associated files." && \
if [ -n "$KERNEL_INSTALL_BOOT_ENTRY_TYPE" ] && [ -d "/lib/modules/$KERNEL_VERSION/kernel" ]; then
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
echo "Multiple entry types may exist, not removing modules.dep or associated files."
exit 0
fi
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
echo "Removing /lib/modules/${KERNEL_VERSION}/modules.dep and associated files"
exec rm -f \

View File

@@ -1496,17 +1496,17 @@ static int help(void) {
" --boot-path=PATH Path to the $BOOT partition\n"
" --make-entry-directory=yes|no|auto\n"
" Create $BOOT/ENTRY-TOKEN/ directory\n"
" --entry-type=type1|type2|all\n"
" Operate only on the specified bootloader\n"
" entry type\n"
" --entry-token=machine-id|os-id|os-image-id|auto|literal:…\n"
" Entry token to use for this installation\n"
" Entry token to be used for this installation\n"
" --no-pager Do not pipe inspect output into a pager\n"
" --json=pretty|short|off Generate JSON output\n"
" --no-legend Do not show the headers and footers\n"
" --root=PATH Operate on an alternate filesystem root\n"
" --image=PATH Operate on disk image as filesystem root\n"
" --image-policy=POLICY Specify disk image dissection policy\n"
" --entry-type=type1|type2|all\n"
" Operate only on the specified bootloader\n"
" entry type\n"
"\n"
"This program may also be invoked as 'installkernel':\n"
" installkernel [OPTIONS...] VERSION VMLINUZ [MAP] [INSTALLATION-DIR]\n"