fix(deploy): keep existing manual TUN passthrough on reused CTs (#6)
create-ct.sh only recognised devN passthrough and added dev0 on top of a manual lxc.mount.entry for /dev/net/tun (left by earlier Tailscale setups), so the CT failed to start in the autodev hook (EEXIST). Detection now lives in ct-config.sh with a regression test.
This commit is contained in:
@@ -4,6 +4,8 @@ set -euo pipefail
|
||||
script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=deploy/proxmox/template-picker.sh
|
||||
source "$script_dir/template-picker.sh"
|
||||
# shellcheck source=deploy/proxmox/ct-config.sh
|
||||
source "$script_dir/ct-config.sh"
|
||||
ctid=${CTID:-501}
|
||||
[[ $ctid =~ ^[0-9]+$ ]] || { echo 'Invalid CTID' >&2; exit 1; }
|
||||
arch=$(dpkg --print-architecture)
|
||||
@@ -44,7 +46,7 @@ if [[ $features != *nesting=1* ]]; then
|
||||
needs_restart=1
|
||||
fi
|
||||
pct set "$ctid" --onboot 1
|
||||
if [[ $config != *'path=/dev/net/tun'* && $config != *'dev0: /dev/net/tun'* ]]; then
|
||||
if ! has_tun_passthrough <<< "$config"; then
|
||||
[[ $config != *'dev0:'* ]] || { echo 'dev0 already occupied; configure /dev/net/tun passthrough manually' >&2; exit 1; }
|
||||
pct set "$ctid" --dev0 /dev/net/tun
|
||||
needs_restart=1
|
||||
|
||||
Reference in New Issue
Block a user