From 08032f165f77d3a1b2f4517de9f8c1bd9d290916 Mon Sep 17 00:00:00 2001 From: tteckster Date: Sun, 19 May 2024 18:06:50 -0400 Subject: [PATCH] Update add-tailscale-lxc.sh Code refactoring --- misc/add-tailscale-lxc.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/misc/add-tailscale-lxc.sh b/misc/add-tailscale-lxc.sh index e5bcfaec..13307333 100644 --- a/misc/add-tailscale-lxc.sh +++ b/misc/add-tailscale-lxc.sh @@ -59,8 +59,14 @@ lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file EOF header_info msg "Installing Tailscale..." -lxc-attach -n $CTID -- bash -c "$(curl -fsSL https://tailscale.com/install.sh)" &>/dev/null || exit -msg "Installed Tailscale" -sleep 2 -msg "\e[1;32m ✔ Completed Successfully!\e[0m" +pct exec "$CTID" -- bash -c ' +ID=$(grep "^ID=" /etc/os-release | cut -d"=" -f2) +VER=$(grep "^VERSION_CODENAME=" /etc/os-release | cut -d"=" -f2) +wget -qO- https://pkgs.tailscale.com/stable/$ID/$VER.noarmor.gpg >/usr/share/keyrings/tailscale-archive-keyring.gpg +echo "deb [signed-by=/usr/share/keyrings/tailscale-archive-keyring.gpg] https://pkgs.tailscale.com/stable/$ID $VER main" >/etc/apt/sources.list.d/tailscale.list +apt-get update &>/dev/null +apt-get install -y tailscale &>/dev/null +' || exit +msg "\e[1;32m ✔ Installed Tailscale\e[0m" + msg "\e[1;31m Reboot ${CTID} LXC to apply the changes, then run tailscale up in the LXC console\e[0m"