From: Harald Hoyer Date: Fri, 26 Mar 2021 09:29:14 +0000 (+0100) Subject: fix(network-manager): shellcheck for modules.d/35network-manager X-Git-Tag: 054~258 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25f684134431999ef920d0615d97d23989b9cc89;p=thirdparty%2Fdracut.git fix(network-manager): shellcheck for modules.d/35network-manager --- diff --git a/modules.d/35network-manager/.shchkdir b/modules.d/35network-manager/.shchkdir new file mode 100644 index 000000000..e69de29bb diff --git a/modules.d/35network-manager/module-setup.sh b/modules.d/35network-manager/module-setup.sh index 03d9c9b54..204e5cd80 100755 --- a/modules.d/35network-manager/module-setup.sh +++ b/modules.d/35network-manager/module-setup.sh @@ -2,8 +2,6 @@ # called by dracut check() { - local _program - require_binaries sed grep || return 1 # do not add this module by default diff --git a/modules.d/35network-manager/nm-config.sh b/modules.d/35network-manager/nm-config.sh index 63f40ed2c..fb8ddcc52 100755 --- a/modules.d/35network-manager/nm-config.sh +++ b/modules.d/35network-manager/nm-config.sh @@ -7,6 +7,7 @@ if [ -n "$netroot" ] || [ -e /tmp/net.ifaces ]; then fi if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then + # shellcheck disable=SC2174 mkdir -m 0755 -p /run/NetworkManager/conf.d ( echo '[logging]' diff --git a/modules.d/35network-manager/nm-lib.sh b/modules.d/35network-manager/nm-lib.sh index fbbb1d0e0..48e45799c 100644 --- a/modules.d/35network-manager/nm-lib.sh +++ b/modules.d/35network-manager/nm-lib.sh @@ -4,6 +4,7 @@ type getcmdline > /dev/null 2>&1 || . /lib/dracut-lib.sh nm_generate_connections() { rm -f /run/NetworkManager/system-connections/* + # shellcheck disable=SC2046 /usr/libexec/nm-initrd-generator -- $(getcmdline) if getargbool 0 rd.neednet; then @@ -12,7 +13,7 @@ nm_generate_connections() { /etc/NetworkManager/system-connections/* \ /etc/sysconfig/network-scripts/ifcfg-*; do [ -f "$i" ] || continue - echo '[ -f /tmp/nm.done ]' > $hookdir/initqueue/finished/nm.sh + echo '[ -f /tmp/nm.done ]' > "$hookdir"/initqueue/finished/nm.sh break done fi diff --git a/modules.d/35network-manager/nm-run.sh b/modules.d/35network-manager/nm-run.sh index 46265a259..d48028df4 100755 --- a/modules.d/35network-manager/nm-run.sh +++ b/modules.d/35network-manager/nm-run.sh @@ -21,12 +21,12 @@ if [ -s /run/NetworkManager/initrd/hostname ]; then fi for _i in /sys/class/net/*; do - state=/run/NetworkManager/devices/$(cat $_i/ifindex) - grep -q connection-uuid= $state 2> /dev/null || continue + state=/run/NetworkManager/devices/$(cat "$_i"/ifindex) + grep -q connection-uuid= "$state" 2> /dev/null || continue ifname=${_i##*/} - sed -n 's/root-path/new_root_path/p;s/next-server/new_next_server/p' < $state > /tmp/dhclient.$ifname.dhcpopts - source_hook initqueue/online $ifname - /sbin/netroot $ifname + sed -n 's/root-path/new_root_path/p;s/next-server/new_next_server/p' < "$state" > /tmp/dhclient."$ifname".dhcpopts + source_hook initqueue/online "$ifname" + /sbin/netroot "$ifname" done -> /tmp/nm.done +: > /tmp/nm.done