mirror of https://github.com/tteck/Proxmox.git
				
				
				
			Update add-tailscale-lxc.sh
This commit is contained in:
		
							parent
							
								
									02c2188ca4
								
							
						
					
					
						commit
						9fc2363af7
					
				| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
#!/usr/bin/env bash
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
echo -e "\e[1;33m This script will add Tailscale to an existing LXC Container ONLY\e[0m"
 | 
					echo -e "\e[1;33mThis script will add Tailscale to an existing LXC Container ONLY\e[0m"
 | 
				
			||||||
while true; do
 | 
					while true; do
 | 
				
			||||||
    read -p "Did you replace 106 with your LXC ID? Proceed(y/n)?" yn
 | 
					    read -p "Did you replace 106 with your LXC ID? Proceed(y/n)?" yn
 | 
				
			||||||
    case $yn in
 | 
					    case $yn in
 | 
				
			||||||
| 
						 | 
					@ -16,26 +16,19 @@ set -o pipefail
 | 
				
			||||||
shopt -s expand_aliases
 | 
					shopt -s expand_aliases
 | 
				
			||||||
alias die='EXIT=$? LINE=$LINENO error_exit'
 | 
					alias die='EXIT=$? LINE=$LINENO error_exit'
 | 
				
			||||||
trap die ERR
 | 
					trap die ERR
 | 
				
			||||||
trap cleanup EXIT
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
function error_exit() {
 | 
					function error_exit() {
 | 
				
			||||||
  trap - ERR
 | 
					  trap - ERR
 | 
				
			||||||
  local DEFAULT='Unknown failure occured.'
 | 
					  local reason="Unknown failure occured."
 | 
				
			||||||
  local REASON="\e[97m${1:-$DEFAULT}\e[39m"
 | 
					  local msg="${1:-$reason}"
 | 
				
			||||||
  local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE"
 | 
					  local flag="\e[1;31m‼ ERROR\e[0m $EXIT@$LINE"
 | 
				
			||||||
  msg "$FLAG $REASON"
 | 
					  echo -e "$flag $msg" 1>&2
 | 
				
			||||||
  exit $EXIT
 | 
					  exit $EXIT
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
function msg() {
 | 
					function msg() {
 | 
				
			||||||
  local TEXT="$1"
 | 
					  local TEXT="$1"
 | 
				
			||||||
  echo -e "$TEXT"
 | 
					  echo -e "$TEXT"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
function cleanup() {
 | 
					 | 
				
			||||||
  popd >/dev/null
 | 
					 | 
				
			||||||
  rm -rf $TEMP_DIR
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
TEMP_DIR=$(mktemp -d)
 | 
					 | 
				
			||||||
pushd $TEMP_DIR >/dev/null
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
CTID=$1
 | 
					CTID=$1
 | 
				
			||||||
CTID_CONFIG_PATH=/etc/pve/lxc/${CTID}.conf
 | 
					CTID_CONFIG_PATH=/etc/pve/lxc/${CTID}.conf
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue