Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Commit 4518e7f

Browse files
committed
Re-use existing config file on meshnet restart
1 parent c666405 commit 4518e7f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

docker/entrypoint.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ if [ -d "/etc/cni/net.d/" ] && [ -f "./meshnet.conf" ]; then
99
cp ./meshnet.conf /etc/cni/net.d/
1010
fi
1111

12-
echo "Mergin existing CNI configuration with meshnet"
13-
existing=$(ls -1 /etc/cni/net.d/ | egrep "flannel|weave|bridge|calico|contiv|cilium|cni" | head -n1)
14-
jq -s '.[1].delegate = (.[0].plugins[0])' /etc/cni/net.d/$existing /etc/cni/net.d/meshnet.conf | jq .[1] > /etc/cni/net.d/00-meshnet.conf
12+
if [ ! -f /etc/cni/net.d/00-meshnet.conf ]; then
13+
echo "Mergin existing CNI configuration with meshnet"
14+
existing=$(ls -1 /etc/cni/net.d/ | egrep "flannel|weave|bridge|calico|contiv|cilium|cni" | head -n1)
15+
jq -s '.[1].delegate = (.[0].plugins[0])' /etc/cni/net.d/$existing /etc/cni/net.d/meshnet.conf | jq .[1] > /etc/cni/net.d/00-meshnet.conf
16+
else
17+
echo "Re-using existing CNI config"
18+
fi
1519

1620
echo "Starting meshnetd daemon"
1721
/meshnetd

0 commit comments

Comments
 (0)