]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
kernel-install: add --verbose
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 7 Mar 2019 19:49:30 +0000 (20:49 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 11 Mar 2019 14:49:53 +0000 (15:49 +0100)
This makes it easier to see what is going on. Documentation for
--verbose and --help is added to the man page. Our plugins are updated
to also log a bit.

man/kernel-install.xml
src/kernel-install/50-depmod.install
src/kernel-install/90-loaderentry.install
src/kernel-install/kernel-install

index 50e1320105d07a71f323d78b3fe0183bb210c43b..db0a0b8256f135098d14ac9c60acfd908c9ceb2a 100644 (file)
@@ -6,7 +6,8 @@
   SPDX-License-Identifier: LGPL-2.1+
 -->
 
-<refentry id="kernel-install">
+<refentry id="kernel-install"
+          xmlns:xi="http://www.w3.org/2001/XInclude">
 
   <refentryinfo>
     <title>kernel-install</title>
@@ -27,6 +28,7 @@
     <cmdsynopsis>
       <command>kernel-install</command>
       <arg choice="plain">COMMAND</arg>
+      <arg choice="opt" rep="repeat">OPTIONS</arg>
       <arg choice="plain"><replaceable>KERNEL-VERSION</replaceable></arg>
       <arg choice="plain"><replaceable>KERNEL-IMAGE</replaceable></arg>
       <arg choice="opt" rep="repeat"><replaceable>INITRD-FILE</replaceable></arg>
 
   </refsect1>
 
+  <refsect1>
+    <title>Options</title>
+    <para>The following options are understood:</para>
+
+    <variablelist>
+      <varlistentry>
+        <term><option>-v</option></term>
+        <term><option>--verbose</option></term>
+        <listitem>
+          <para>Output additional information about operations being performed.</para>
+        </listitem>
+      </varlistentry>
+
+      <xi:include href="standard-options.xml" xpointer="help" />
+    </variablelist>
+  </refsect1>
+
+  <refsect1>
+    <title>Environment variables</title>
+    <para>If <option>--verbose</option> is used, <varname>$KERNEL_INSTALL_VERBOSE=1</varname> will be set for
+    the plugins. They may output additional logs in this case.</para>
+  </refsect1>
+
   <refsect1>
     <title>Exit status</title>
     <para>If every executable returns 0 or 77, 0 is returned, and a non-zero failure code otherwise.</para>
index f3eaf2ba2fe64e2363408937fea903b89ef8ee7f..7421e93c19b1af14466f3f047e9bee8deadf1015 100644 (file)
@@ -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}}
         ;;
     *)
index 75dd5a1b7dcc9c7799fe650c68f48d7518488598..c6b4ac14dac841c46d48544af9428ae6315ba23c 100644 (file)
@@ -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"
index b85c7c557e24f8f3a066f095eef276b3c19f0439..147908cf81f145d541afc78f6c54898e2a2d78c2 100644 (file)
@@ -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+=$?))
         ;;