kdump-load: Add usage/help messages to this script
The kdump-load script is the only one that has more than a single functionality, potentially being invoked in different ways. With that in mind, just add a small usage/help for users' information (thanks Emil for the suggestion). While at it, changed the additional commands to be more friendly and require exactly one command to be passed - changes summary: s/initrd/create-initrd s/clear/clear-initrd s//load Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
This commit is contained in:
@ -7,7 +7,7 @@
|
|||||||
#
|
#
|
||||||
# Configuration settings for kdump/pstore. After _any_ change in this
|
# Configuration settings for kdump/pstore. After _any_ change in this
|
||||||
# file, it's required to re-create the kdump minimal initramfs by running:
|
# file, it's required to re-create the kdump minimal initramfs by running:
|
||||||
# /usr/lib/kdump/kdump-load.sh initrd
|
# /usr/lib/kdump/kdump-load.sh create-initrd
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Pstore-RAM settings
|
# Pstore-RAM settings
|
||||||
|
|||||||
@ -10,7 +10,7 @@ Description=pstore/kdump loader boot-time service
|
|||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
StandardOutput=journal
|
StandardOutput=journal
|
||||||
ExecStartPre=/usr/lib/kdump/kdump-load.sh
|
ExecStartPre=/usr/lib/kdump/kdump-load.sh load
|
||||||
ExecStart=/usr/lib/kdump/save-dumps.sh
|
ExecStart=/usr/lib/kdump/save-dumps.sh
|
||||||
RemainAfterExit=yes
|
RemainAfterExit=yes
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -uo pipefail
|
set -o pipefail # Didn't set -u on purpose, since users could pass empty $1
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: LGPL-2.1+
|
# SPDX-License-Identifier: LGPL-2.1+
|
||||||
#
|
#
|
||||||
|
|||||||
@ -71,21 +71,60 @@ cleanup_unused_initrd() {
|
|||||||
rm -f "${INSTALLED_KERNELS}"
|
rm -f "${INSTALLED_KERNELS}"
|
||||||
}
|
}
|
||||||
|
|
||||||
load_kdump_config
|
# Now this routine performs a full deletion of all kdump initrd files.
|
||||||
|
clear_all_initrds() {
|
||||||
|
rm -f "${MOUNT_FOLDER}"/kdump-initrd-*
|
||||||
|
}
|
||||||
|
|
||||||
# In case the kdump main folder doesn't exist, create it
|
# Function to display basic help about how to use this tool.
|
||||||
# here, as soon as possible.
|
usage() {
|
||||||
mkdir -p "${MOUNT_FOLDER}"
|
cat <<EOF
|
||||||
|
${0##*/} <COMMAND>
|
||||||
|
Kdump/Pstore loader.
|
||||||
|
|
||||||
if [ "$1" = "initrd" ]; then
|
Options:
|
||||||
|
load
|
||||||
|
Load pstore/kdump according to the configuration file.
|
||||||
|
|
||||||
|
create-initrd
|
||||||
|
Create the minimal kdump initrd for the running kernel.
|
||||||
|
|
||||||
|
clear-initrd
|
||||||
|
Delete all kdump minimal initrd images.
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
preamble() {
|
||||||
|
load_kdump_config
|
||||||
|
|
||||||
|
# In case the kdump main folder doesn't exist, create it
|
||||||
|
# here, as soon as possible.
|
||||||
|
mkdir -p "${MOUNT_FOLDER}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Entry point of the script.
|
||||||
|
case $1 in
|
||||||
|
clear-initrd)
|
||||||
|
preamble
|
||||||
|
clear_all_initrds
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
create-initrd)
|
||||||
|
preamble
|
||||||
create_initrd
|
create_initrd
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
;;
|
||||||
|
load)
|
||||||
|
# just bail from the case statement, jumping to code below
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ "$1" = "clear" ]; then
|
# Here starts the main purpose of this script, the load operation.
|
||||||
rm -f "${MOUNT_FOLDER}"/kdump-initrd-*
|
preamble
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Pstore-RAM load; if it is configured via the config files and fails
|
# Pstore-RAM load; if it is configured via the config files and fails
|
||||||
# to configure pstore, we still try to load the kdump. We try to reserve
|
# to configure pstore, we still try to load the kdump. We try to reserve
|
||||||
|
|||||||
Reference in New Issue
Block a user