rego-tunnel: share APP_DATA_DIR via /hostshare + fix compose.json env
Some checks failed
Test / test (push) Has been cancelled

This commit is contained in:
2025-12-29 01:27:12 +00:00
parent 6c790f84aa
commit 0020c539ea
5 changed files with 23 additions and 35 deletions

View File

@@ -31,22 +31,24 @@ if [ -z "${WAN_IF}" ]; then
WAN_IF="eth1"
fi
# Create bridge if not exists
# Ensure bridge exists
if ! ip link show "$BRIDGE_NAME" &>/dev/null; then
ip link add "$BRIDGE_NAME" type bridge
ip addr add "$BRIDGE_CIDR" dev "$BRIDGE_NAME"
ip link set "$BRIDGE_NAME" up
echo "Bridge $BRIDGE_NAME created with IP $BRIDGE_CIDR"
fi
# Create TAP device if not exists
# Ensure bridge has address and is up
ip addr show dev "$BRIDGE_NAME" | grep -qF "$BRIDGE_CIDR" || ip addr add "$BRIDGE_CIDR" dev "$BRIDGE_NAME" 2>/dev/null || true
ip link set "$BRIDGE_NAME" up
# Ensure TAP exists
if ! ip link show "$TAP_NAME" &>/dev/null; then
ip tuntap add "$TAP_NAME" mode tap
ip link set "$TAP_NAME" master "$BRIDGE_NAME"
ip link set "$TAP_NAME" up
echo "TAP device $TAP_NAME created and attached to $BRIDGE_NAME"
fi
# Ensure TAP is attached and up
ip link set "$TAP_NAME" master "$BRIDGE_NAME" 2>/dev/null || true
ip link set "$TAP_NAME" up
# Enable IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward

View File

@@ -61,12 +61,12 @@ if [ "$AUTO_MOUNT_9P" = "1" ]; then
if [ -n "$ROOT_PART" ]; then
# already mounted from loop above
mkdir -p "$VMROOT_MNT/shared" "$VMROOT_MNT/mnt/TSCLIENT"
mkdir -p "$VMROOT_MNT/shared" "$VMROOT_MNT/hostshare"
FSTAB="$VMROOT_MNT/etc/fstab"
# Add entries only if missing
grep -qE "^[[:space:]]*${SHARED_TAG}[[:space:]]+" "$FSTAB" || echo "${SHARED_TAG} /shared 9p trans=virtio,version=9p2000.L,msize=262144,_netdev,nofail,x-systemd.automount 0 0" >> "$FSTAB"
grep -qE "^[[:space:]]*${TSCLIENT_TAG}[[:space:]]+" "$FSTAB" || echo "${TSCLIENT_TAG} /mnt/TSCLIENT 9p trans=virtio,version=9p2000.L,msize=262144,_netdev,nofail,x-systemd.automount 0 0" >> "$FSTAB"
grep -qE "^[[:space:]]*${TSCLIENT_TAG}[[:space:]]+" "$FSTAB" || echo "${TSCLIENT_TAG} /hostshare 9p trans=virtio,version=9p2000.L,msize=262144,_netdev,nofail,x-systemd.automount 0 0" >> "$FSTAB"
umount "$VMROOT_MNT" >/dev/null 2>&1 || true
else