dracut-module-setup.sh: remove surrounding $() for subshell

upstream: fedora
resolves: bz2003832
conflict: none

commit 3b0157197b
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Sep 8 15:15:44 2021 +0800

    dracut-module-setup.sh: remove surrounding $() for subshell

    Some functions are executed in subshell to avoid variable environment
    pollution. But the surrounding $() is not needed, and it may lead to
    executing output which is unexpected here.

    See: https://github.com/koalaman/shellcheck/wiki/SC2091

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Suggested-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
This commit is contained in:
Tao Liu 2021-11-03 15:48:37 +08:00
parent 9abf44a082
commit 6d930905d5

View File

@ -358,7 +358,7 @@ kdump_setup_bridge() {
_dev=${_dev##*/}
_kdumpdev=$_dev
if kdump_is_bond "$_dev"; then
$(kdump_setup_bond "$_dev" "$(get_nmcli_connection_show_cmd_by_ifname "$_dev")")
(kdump_setup_bond "$_dev" "$(get_nmcli_connection_show_cmd_by_ifname "$_dev")")
if [[ $? != 0 ]]; then
exit 1
fi
@ -441,7 +441,7 @@ kdump_setup_vlan() {
derror "Vlan over bridge is not supported!"
exit 1
elif kdump_is_bond "$_phydev"; then
$(kdump_setup_bond "$_phydev" "$(get_nmcli_connection_show_cmd_by_ifname "$_phydev")")
(kdump_setup_bond "$_phydev" "$(get_nmcli_connection_show_cmd_by_ifname "$_phydev")")
if [[ $? != 0 ]]; then
exit 1
fi
@ -557,7 +557,7 @@ kdump_install_net() {
_znet_netdev=$(find_online_znet_device)
if [[ -n "$_znet_netdev" ]]; then
_nm_show_cmd_znet=$(get_nmcli_connection_show_cmd_by_ifname "$_znet_netdev")
$(kdump_setup_znet "$_znet_netdev" "$_nm_show_cmd_znet")
(kdump_setup_znet "$_znet_netdev" "$_nm_show_cmd_znet")
if [[ $? != 0 ]]; then
derror "Failed to set up znet"
exit 1
@ -588,7 +588,7 @@ kdump_install_net() {
if kdump_is_bridge "$_netdev"; then
kdump_setup_bridge "$_netdev"
elif kdump_is_bond "$_netdev"; then
$(kdump_setup_bond "$_netdev" "$_nm_show_cmd")
(kdump_setup_bond "$_netdev" "$_nm_show_cmd")
if [[ $? != 0 ]]; then
exit 1
fi