mirror of
https://github.com/tteck/Proxmox.git
synced 2024-12-26 23:11:56 +00:00
Update add-tailscale-lxc.sh
added a menu that enables you to choose the specific container where you want to install Tailscale.
This commit is contained in:
parent
b3777abadc
commit
186230591b
@ -17,9 +17,8 @@ EOF
|
||||
}
|
||||
clear
|
||||
header_info
|
||||
echo -e "\e[1;33mThis script will add Tailscale to an existing LXC Container ONLY\e[0m"
|
||||
while true; do
|
||||
read -p "Did you replace 106 with your LXC ID? Proceed(y/n)?" yn
|
||||
read -p "This will add Tailscale to an existing LXC Container ONLY. Proceed(y/n)?" yn
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*) exit ;;
|
||||
@ -48,7 +47,24 @@ function msg() {
|
||||
echo -e "$TEXT"
|
||||
}
|
||||
|
||||
CTID=$1
|
||||
NODE=$(hostname)
|
||||
while read -r line; do
|
||||
TAG=$(echo "$line" | awk '{print $1}')
|
||||
ITEM=$(echo "$line" | awk '{print substr($0,36)}')
|
||||
OFFSET=2
|
||||
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
|
||||
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
|
||||
fi
|
||||
CTID_MENU+=("$TAG" "$ITEM " "OFF")
|
||||
done < <(pct list | awk 'NR>1')
|
||||
|
||||
while [ -z "${CTID:+x}" ]; do
|
||||
CTID=$(whiptail --title "Containers on $NODE" --radiolist \
|
||||
"\nSelect a container to add Tailscale to:\n" \
|
||||
16 $(($MSG_MAX_LENGTH + 23)) 6 \
|
||||
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
||||
done
|
||||
|
||||
CTID_CONFIG_PATH=/etc/pve/lxc/${CTID}.conf
|
||||
cat <<EOF >>$CTID_CONFIG_PATH
|
||||
lxc.cgroup2.devices.allow: c 10:200 rwm
|
||||
|
Loading…
Reference in New Issue
Block a user