John Crispin <j...@phrozen.org> [2017-11-08 08:01:53]: Hi,
> wondering if it would be nicer to add this to the already existing if > clause. I find code more readable if I check for all necessary preconditions at the start of the function and then do the main logic afterwards, if all precondition are met, so I would rather write it as following: preinit_ip_deconfig() { local netdev vid [ -z "$pi_ifname" ] && return grep -q "nfsroot" /proc/cmdline && return grep -q "$pi_ifname" /proc/net/dev || return vid=${pi_ifname#*\.} netdev=${pi_ifname%\.*} ip -4 address flush dev $pi_ifname ip link set dev $netdev down if [ "$vid" = "$netdev" ]; then ip link delete $pi_ifname fi } > and please add a comment in the code stating that deconf should be > skipped when booting from a nfs rootfs Would this be more explicit? rootfs_needs_network() { grep -q "nfsroot" /proc/cmdline } preinit_ip_deconfig() { ... [ -z "$pi_ifname" ] && return rootfs_needs_network && return grep -q "$pi_ifname" /proc/net/dev || return ... } -- ynezz _______________________________________________ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev