Feat: enable-wireguard-lxc

This commit is contained in:
kayos@tcp.direct 2022-11-07 01:56:45 -08:00
parent bb2ac9e3e6
commit 239ac6780f
Signed by: kayos
GPG Key ID: 4B841471B4BEE979

24
bin/enable-wireguard-lxc Executable file
View File

@ -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"