dracut-kdump.sh: reformat with shfmt

upstream: fedora
resolves: bz2003832
conflict: none

commit 7c76611abb
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Sep 15 23:10:07 2021 +0800

    dracut-kdump.sh: reformat with shfmt

    This is done with `shfmt -w -s dracut-kdump.sh`. There is no behaviour
    change.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
This commit is contained in:
Tao Liu 2021-11-03 19:11:53 +08:00
parent eb6eafaf18
commit 5e60aafcaf
1 changed files with 385 additions and 383 deletions

View File

@ -67,7 +67,7 @@ get_kdump_confs()
fence_kdump_nodes) fence_kdump_nodes)
FENCE_KDUMP_NODES="$config_val" FENCE_KDUMP_NODES="$config_val"
;; ;;
failure_action|default) failure_action | default)
case $config_val in case $config_val in
shell) shell)
FAILURE_ACTION="kdump_emergency_shell" FAILURE_ACTION="kdump_emergency_shell"
@ -136,7 +136,7 @@ dump_fs()
# Remove -F in makedumpfile case. We don't want a flat format dump here. # Remove -F in makedumpfile case. We don't want a flat format dump here.
case $CORE_COLLECTOR in case $CORE_COLLECTOR in
*makedumpfile* ) *makedumpfile*)
CORE_COLLECTOR=$(echo "$CORE_COLLECTOR" | sed -e "s/-F//g") CORE_COLLECTOR=$(echo "$CORE_COLLECTOR" | sed -e "s/-F//g")
;; ;;
esac esac
@ -147,7 +147,7 @@ dump_fs()
# Only remount to read-write mode if the dump target is mounted read-only. # Only remount to read-write mode if the dump target is mounted read-only.
_dump_mnt_op=$(get_mount_info OPTIONS target "$1" -f) _dump_mnt_op=$(get_mount_info OPTIONS target "$1" -f)
case $_dump_mnt_op in case $_dump_mnt_op in
ro* ) ro*)
dinfo "Remounting the dump target in rw mode." dinfo "Remounting the dump target in rw mode."
mount -o remount,rw "$1" || return 1 mount -o remount,rw "$1" || return 1
;; ;;
@ -182,7 +182,8 @@ dump_fs()
# $1: dmesg collector # $1: dmesg collector
# $2: dump path # $2: dump path
save_vmcore_dmesg_fs() { save_vmcore_dmesg_fs()
{
dinfo "saving vmcore-dmesg.txt to $2" dinfo "saving vmcore-dmesg.txt to $2"
if $1 /proc/vmcore > "$2/vmcore-dmesg-incomplete.txt"; then if $1 /proc/vmcore > "$2/vmcore-dmesg-incomplete.txt"; then
mv "$2/vmcore-dmesg-incomplete.txt" "$2/vmcore-dmesg.txt" mv "$2/vmcore-dmesg-incomplete.txt" "$2/vmcore-dmesg.txt"
@ -202,7 +203,8 @@ save_vmcore_dmesg_fs() {
} }
# $1: dump path # $1: dump path
save_opalcore_fs() { save_opalcore_fs()
{
if [ ! -f $OPALCORE ]; then if [ ! -f $OPALCORE ]; then
# Check if we are on an old kernel that uses a different path # Check if we are on an old kernel that uses a different path
if [ -f /sys/firmware/opal/core ]; then if [ -f /sys/firmware/opal/core ]; then
@ -260,12 +262,12 @@ kdump_emergency_shell()
. /lib/dracut-lib.sh . /lib/dracut-lib.sh
if [ -f /dracut-state.sh ]; then if [ -f /dracut-state.sh ]; then
. /dracut-state.sh 2>/dev/null . /dracut-state.sh 2> /dev/null
fi fi
source_conf /etc/conf.d source_conf /etc/conf.d
type plymouth >/dev/null 2>&1 && plymouth quit type plymouth > /dev/null 2>&1 && plymouth quit
source_hook "emergency" source_hook "emergency"
while read -r _tty rest; do while read -r _tty rest; do
@ -432,7 +434,8 @@ dump_ssh()
# $2: ssh opts # $2: ssh opts
# $3: ssh address in <user>@<host> format # $3: ssh address in <user>@<host> format
# $4: scp address, similar with ssh address but IPv6 addresses are quoted # $4: scp address, similar with ssh address but IPv6 addresses are quoted
save_opalcore_ssh() { save_opalcore_ssh()
{
if [ ! -f $OPALCORE ]; then if [ ! -f $OPALCORE ]; then
# Check if we are on an old kernel that uses a different path # Check if we are on an old kernel that uses a different path
if [ -f /sys/firmware/opal/core ]; then if [ -f /sys/firmware/opal/core ]; then
@ -458,7 +461,8 @@ save_opalcore_ssh() {
# $2: dump path # $2: dump path
# $3: ssh opts # $3: ssh opts
# $4: ssh address in <user>@<host> format # $4: ssh address in <user>@<host> format
save_vmcore_dmesg_ssh() { save_vmcore_dmesg_ssh()
{
dinfo "saving vmcore-dmesg.txt to $4:$2" dinfo "saving vmcore-dmesg.txt to $4:$2"
if $1 /proc/vmcore | ssh $3 "$4" "umask 0077 && dd of='$2/vmcore-dmesg-incomplete.txt'"; then if $1 /proc/vmcore | ssh $3 "$4" "umask 0077 && dd of='$2/vmcore-dmesg-incomplete.txt'"; then
ssh -q $3 "$4" mv "$2/vmcore-dmesg-incomplete.txt" "$2/vmcore-dmesg.txt" ssh -q $3 "$4" mv "$2/vmcore-dmesg-incomplete.txt" "$2/vmcore-dmesg.txt"
@ -470,8 +474,7 @@ save_vmcore_dmesg_ssh() {
get_host_ip() get_host_ip()
{ {
if is_nfs_dump_target || is_ssh_dump_target if is_nfs_dump_target || is_ssh_dump_target; then
then
kdumpnic=$(getarg kdumpnic=) kdumpnic=$(getarg kdumpnic=)
if [ -z "$kdumpnic" ]; then if [ -z "$kdumpnic" ]; then
derror "failed to get kdumpnic!" derror "failed to get kdumpnic!"
@ -502,8 +505,7 @@ read_kdump_confs()
get_kdump_confs get_kdump_confs
# rescan for add code for dump target # rescan for add code for dump target
while read -r config_opt config_val; while read -r config_opt config_val; do
do
# remove inline comments after the end of a directive. # remove inline comments after the end of a directive.
case "$config_opt" in case "$config_opt" in
dracut_args) dracut_args)
@ -513,7 +515,7 @@ read_kdump_confs()
DUMP_INSTRUCTION="dump_fs $config_val" DUMP_INSTRUCTION="dump_fs $config_val"
fi fi
;; ;;
ext[234]|xfs|btrfs|minix|nfs) ext[234] | xfs | btrfs | minix | nfs)
config_val=$(get_mntpoint_from_target "$config_val") config_val=$(get_mntpoint_from_target "$config_val")
DUMP_INSTRUCTION="dump_fs $config_val" DUMP_INSTRUCTION="dump_fs $config_val"
;; ;;