On Mon, Apr 25, 2022 at 02:12:04PM +0200, Philipp Rudo wrote:
Hi Coiby,
one more thing
On Sat, 2 Apr 2022 11:23:54 +0800
Coiby Xu <coxu(a)redhat.com> wrote:
> Signed-off-by: Coiby Xu <coxu(a)redhat.com>
> ---
> dracut-module-setup.sh | 18 +++---------------
> 1 file changed, 3 insertions(+), 15 deletions(-)
>
> diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
> index 64f9141..4e64872 100755
> --- a/dracut-module-setup.sh
> +++ b/dracut-module-setup.sh
> @@ -429,23 +429,10 @@ kdump_setup_bond() {
>
> kdump_setup_team() {
> local _netdev=$1
> - local _dev _mac _slaves _kdumpdev
> + local _dev
> for _dev in $(teamnl "$_netdev" ports | awk -F':' '{print
$2}'); do
as you are basically rewriting this function you could also switch from
a for-loop to the preferred while-read-loop [1]. Same for
kdump_setup_{bridge,bond}.
Correctly me if I'm wrong, but according to [1], while-read-loop is for
read lines than words and the for-loop in kdump_setup_{bridge,bond,team}
is supposed to read words. Interestingly, shellcheck doesn't complain
the for-loop here and also in _bridge. It only complains _bond. So in
v1, I simply disable shellcheck for _bond.
Thanks
Philipp
[1]
https://github.com/koalaman/shellcheck/wiki/SC2013
> - _mac=$(kdump_get_perm_addr "$_dev")
> - _kdumpdev=$(kdump_setup_ifname "$_dev")
> - echo -n " ifname=$_kdumpdev:$_mac" >>
"${initdir}/etc/cmdline.d/44team.conf"
> - _slaves+="$_kdumpdev,"
> + kdump_copy_nmconnection_file "$_dev"
> done
> - echo " team=$_netdev:${_slaves%,}" >>
"${initdir}/etc/cmdline.d/44team.conf"
> - #Buggy version teamdctl outputs to stderr!
> - #Try to use the latest version of teamd.
> - if ! teamdctl "$_netdev" config dump >
"${initdir}/tmp/$$-$_netdev.conf"; then
> - derror "teamdctl failed."
> - exit 1
> - fi
> - inst_dir /etc/teamd
> - inst_simple "${initdir}/tmp/$$-$_netdev.conf"
"/etc/teamd/$_netdev.conf"
> - rm -f "${initdir}/tmp/$$-$_netdev.conf"
> }
>
> kdump_setup_vlan() {
> @@ -463,6 +450,7 @@ kdump_setup_vlan() {
> kdump_copy_nmconnection_file "$_parent_netif"
> elif kdump_is_team "$_parent_netif"; then
> (kdump_setup_team "$_parent_netif") || exit 1
> + kdump_copy_nmconnection_file "$_parent_netif"
> else
> echo -n "except:interface-name:$_parent_netif," >>
"/tmp/$$-netif_allowlist"
> fi
--
Best regards,
Coiby