diff --git a/man/kernel-install.xml b/man/kernel-install.xml index 50e1320105d..db0a0b8256f 100644 --- a/man/kernel-install.xml +++ b/man/kernel-install.xml @@ -6,7 +6,8 @@ SPDX-License-Identifier: LGPL-2.1+ --> - + kernel-install @@ -27,6 +28,7 @@ kernel-install COMMAND + OPTIONS KERNEL-VERSION KERNEL-IMAGE INITRD-FILE @@ -127,6 +129,29 @@ + + Options + The following options are understood: + + + + + + + Output additional information about operations being performed. + + + + + + + + + Environment variables + If is used, $KERNEL_INSTALL_VERBOSE=1 will be set for + the plugins. They may output additional logs in this case. + + Exit status If every executable returns 0 or 77, 0 is returned, and a non-zero failure code otherwise. diff --git a/src/kernel-install/50-depmod.install b/src/kernel-install/50-depmod.install index f3eaf2ba2fe..7421e93c19b 100644 --- a/src/kernel-install/50-depmod.install +++ b/src/kernel-install/50-depmod.install @@ -13,9 +13,13 @@ INITRD_OPTIONS_START="5" case "$COMMAND" in add) [[ -d "/lib/modules/${KERNEL_VERSION}/kernel" ]] || exit 0 + [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \ + echo "Running depmod -a ${KERNEL_VERSION}" exec depmod -a "${KERNEL_VERSION}" ;; remove) + [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \ + echo "Removing /lib/modules/${KERNEL_VERSION}/modules.dep and associated files" exec rm -f /lib/modules/"${KERNEL_VERSION}"/modules.{alias{,.bin},builtin.bin,dep{,.bin},devname,softdep,symbols{,.bin}} ;; *) diff --git a/src/kernel-install/90-loaderentry.install b/src/kernel-install/90-loaderentry.install index 75dd5a1b7dc..c6b4ac14dac 100644 --- a/src/kernel-install/90-loaderentry.install +++ b/src/kernel-install/90-loaderentry.install @@ -88,6 +88,8 @@ INITRD_OPTIONS=( "${@:${INITRD_OPTIONS_START}}" ) for initrd in "${INITRD_OPTIONS[@]}"; do if [[ -f "${initrd}" ]]; then initrd_basename="$(basename ${initrd})" + [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \ + echo "Installing $BOOT_DIR_ABS/${initrd_basename}" cp "${initrd}" "$BOOT_DIR_ABS/${initrd_basename}" && chown root:root "$BOOT_DIR_ABS/${initrd_basename}" && chmod 0644 "$BOOT_DIR_ABS/${initrd_basename}" || { @@ -106,6 +108,8 @@ mkdir -p "${LOADER_ENTRY%/*}" || { exit 1 } +[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \ + echo "Creating $LOADER_ENTRY" { echo "title $PRETTY_NAME" echo "version $KERNEL_VERSION" diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install index b85c7c557e2..147908cf81f 100644 --- a/src/kernel-install/kernel-install +++ b/src/kernel-install/kernel-install @@ -5,7 +5,6 @@ # # This file is part of systemd. # -# # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or @@ -63,6 +62,13 @@ for i in "$@"; do fi done +KERNEL_INSTALL_VERBOSE=0 +if [ "$1" == "--verbose" -o "$1" == "-v" ]; then + shift + KERNEL_INSTALL_VERBOSE=1 +fi +export KERNEL_INSTALL_VERBOSE + if [[ "${0##*/}" == 'installkernel' ]]; then COMMAND='add' # make install doesn't pass any parameter wrt initrd handling @@ -126,6 +132,8 @@ case $COMMAND in for f in "${PLUGINS[@]}"; do if [[ -x $f ]]; then + [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \ + echo "+$f add $KERNEL_VERSION $BOOT_DIR_ABS $KERNEL_IMAGE ${INITRD_OPTIONS[@]}" "$f" add "$KERNEL_VERSION" "$BOOT_DIR_ABS" "$KERNEL_IMAGE" "${INITRD_OPTIONS[@]}" x=$? if [[ $x == $SKIP_REMAINING ]]; then @@ -148,6 +156,8 @@ case $COMMAND in remove) for f in "${PLUGINS[@]}"; do if [[ -x $f ]]; then + [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \ + echo "+$f remove $KERNEL_VERSION $BOOT_DIR_ABS" "$f" remove "$KERNEL_VERSION" "$BOOT_DIR_ABS" x=$? if [[ $x == $SKIP_REMAINING ]]; then @@ -158,6 +168,9 @@ case $COMMAND in fi done + [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \ + echo "Removing $BOOT_DIR_ABS" + rm -rf "$BOOT_DIR_ABS" ((ret+=$?)) ;;