From 1f75fb6b6b15bdefda72dfbf1a2b43c19c776bd2 Mon Sep 17 00:00:00 2001 From: Cao Mingjun Date: Mon, 9 Dec 2024 16:22:15 +0800 Subject: [PATCH] add legacy tun support for docker swarm --- entrypoint.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index bda66bb..9c3cbce 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -5,8 +5,15 @@ set -e # check if /dev/net/tun is available if [ ! -e /dev/net/tun ]; then - echo "CRITIC: /dev/net/tun not pass, check https://github.com/cmj2002/warp-docker/blob/main/docs/tun-not-permitted.md for more information" - exit 1 + if [ -n "$LEGACY_TUN_SUPPORT" ]; then + echo "WARN: LEGACY_TUN_SUPPORT enabled, creating /dev/net/tun..." + sudo mkdir -p /dev/net + sudo mknod /dev/net/tun c 10 200 + sudo chmod 600 /dev/net/tun + else + echo "CRITIC: /dev/net/tun not pass, check https://github.com/cmj2002/warp-docker/blob/main/docs/tun-not-permitted.md for more information" + exit 1 + fi fi # start dbus