diff --git a/bin/enable-wireguard-lxc b/bin/enable-wireguard-lxc new file mode 100755 index 0000000..7adf062 --- /dev/null +++ b/bin/enable-wireguard-lxc @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -e + +_targetFile="/etc/pve/lxc/$1.conf" + +if ! [[ -e "$_targetFile" ]]; then + echo -n "pct container ID $1 not found" + exit 1 +fi + +echo 'lxc.cgroup2.devices.allow: c 10:200 rwm' >> "$_targetFile" && +echo 'lxc.mount.entry: /dev/net dev/net none bind,create=dir' >> "$_targetFile" && + +echo "done with configuration changes!" + +read -p "restart container to apply changes?" -n 1 -r; echo +if [[ $REPLY =~ ^[Yy]$ ]] + +then + pct stop "$1" + pct start "$1" +fi + +echo "fin"