From 8e6cc2f3f6b2b8606dc3c521737bfe0677c56014 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Fri, 18 Oct 2024 18:23:05 +0200 Subject: [PATCH] nixos/networking: fix shellcheck findings with enableStrictShellChecks enabled Signed-off-by: Sefa Eyeoglu --- nixos/modules/tasks/network-interfaces-scripted.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nixos/modules/tasks/network-interfaces-scripted.nix b/nixos/modules/tasks/network-interfaces-scripted.nix index 83c0dc27885e3..646dfa7e9533c 100644 --- a/nixos/modules/tasks/network-interfaces-scripted.nix +++ b/nixos/modules/tasks/network-interfaces-scripted.nix @@ -192,7 +192,7 @@ let script = '' state="/run/nixos/network/addresses/${i.name}" - mkdir -p $(dirname "$state") + mkdir -p "$(dirname "$state")" ip link set dev "${i.name}" up @@ -206,14 +206,14 @@ let if out=$(ip addr replace "${cidr}" dev "${i.name}" 2>&1); then echo "done" else - echo "'ip addr replace "${cidr}" dev "${i.name}"' failed: $out" + echo "'ip addr replace \"${cidr}\" dev \"${i.name}\"' failed: $out" exit 1 fi '' )} state="/run/nixos/network/routes/${i.name}" - mkdir -p $(dirname "$state") + mkdir -p "$(dirname "$state")" ${flip concatMapStrings (i.ipv4.routes ++ i.ipv6.routes) (route: let @@ -228,7 +228,7 @@ let if out=$(ip route add ${type} "${cidr}" ${options} ${via} dev "${i.name}" proto static 2>&1); then echo "done" elif ! echo "$out" | grep "File exists" >/dev/null 2>&1; then - echo "'ip route add ${type} "${cidr}" ${options} ${via} dev "${i.name}"' failed: $out" + echo "'ip route add ${type} \"${cidr}\" ${options} ${via} dev \"${i.name}\"' failed: $out" exit 1 fi '' @@ -237,7 +237,7 @@ let preStop = '' state="/run/nixos/network/routes/${i.name}" if [ -e "$state" ]; then - while read cidr; do + while read -r cidr; do echo -n "deleting route $cidr... " ip route del "$cidr" dev "${i.name}" >/dev/null 2>&1 && echo "done" || echo "failed" done < "$state" @@ -246,7 +246,7 @@ let state="/run/nixos/network/addresses/${i.name}" if [ -e "$state" ]; then - while read cidr; do + while read -r cidr; do echo -n "deleting address $cidr... " ip addr del "$cidr" dev "${i.name}" >/dev/null 2>&1 && echo "done" || echo "failed" done < "$state"