chore: remove dependency on external script
This commit is contained in:
parent
c4bedd9d28
commit
de8994f60f
@ -1,11 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
# Author: twingate-andrewb
|
# Author: MickLesk (CanbiZ), twingate-andrewb
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
# Source: https://www.twingate.com/docs/
|
# Source: https://www.twingate.com/docs/
|
||||||
|
|
||||||
# Import Functions und Setup
|
|
||||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||||
color
|
color
|
||||||
verb_ip6
|
verb_ip6
|
||||||
@ -14,52 +13,40 @@ setting_up_container
|
|||||||
network_check
|
network_check
|
||||||
update_os
|
update_os
|
||||||
|
|
||||||
|
install -d -m 0700 /etc/twingate
|
||||||
|
|
||||||
while true; do
|
while [[ -z "$access_token" ]]; do
|
||||||
read -rp "Please enter your access token: " access_token
|
read -rp "${TAB3}Please enter your access token: " access_token
|
||||||
if [[ -z "$access_token" ]]; then
|
done
|
||||||
msg_error "Access token cannot be empty. Please try again."
|
while [[ -z "$refresh_token" ]]; do
|
||||||
else
|
read -rp "${TAB3}Please enter your refresh token: " refresh_token
|
||||||
break
|
done
|
||||||
fi
|
while [[ -z "$network" ]]; do
|
||||||
|
read -rp "${TAB3}Please enter your network name: " network
|
||||||
done
|
done
|
||||||
|
|
||||||
while true; do
|
msg_info "Setup Twingate Repository"
|
||||||
read -rp "Please enter your refresh token: " refresh_token
|
curl -fsSL "https://packages.twingate.com/apt/gpg.key" | gpg --dearmor -o /usr/share/keyrings/twingate-connector-keyring.gpg
|
||||||
if [[ -z "$refresh_token" ]]; then
|
echo "deb [signed-by=/usr/share/keyrings/twingate-connector-keyring.gpg] https://packages.twingate.com/apt/ /" > /etc/apt/sources.list.d/twingate.list
|
||||||
msg_error "Refresh token cannot be empty. Please try again."
|
$STD apt-get update
|
||||||
else
|
msg_ok "Setup Twingate Repository"
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
while true; do
|
msg_info "Setup Twingate Connector"
|
||||||
read -rp "Please enter your network name: " network
|
$STD apt-get install -y twingate-connector
|
||||||
if [[ -z "$network" ]]; then
|
msg_ok "Setup Twingate Connector"
|
||||||
msg_error "Network cannot be empty. Please try again."
|
|
||||||
else
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
msg_info "Installing Twingate Connector..."
|
msg_info "Writing config"
|
||||||
export TWINGATE_ACCESS_TOKEN="${access_token}"
|
{
|
||||||
export TWINGATE_REFRESH_TOKEN="${refresh_token}"
|
echo "TWINGATE_NETWORK=${network}"
|
||||||
export TWINGATE_NETWORK="${network}"
|
echo "TWINGATE_ACCESS_TOKEN=${access_token}"
|
||||||
export TWINGATE_LABEL_DEPLOYED_BY="proxmox"
|
echo "TWINGATE_REFRESH_TOKEN=${refresh_token}"
|
||||||
curl -fsSL "https://binaries.twingate.com/connector/setup.sh" | bash >> /dev/null 2>&1
|
} > /etc/twingate/connector.conf
|
||||||
if [[ $? -ne 0 ]]; then
|
chmod 600 /etc/twingate/connector.conf
|
||||||
msg_error "Failed to set up Twingate Connector. Please double check your tokens and network name."
|
msg_ok "Config written"
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
msg_ok "Twingate Connector installed!"
|
|
||||||
|
|
||||||
msg_info "Starting Twingate Connector..."
|
msg_info "Starting Service"
|
||||||
# give the connector time to start
|
systemctl enable -q --now twingate-connector
|
||||||
sleep 5s
|
msg_ok "Service started"
|
||||||
msg_ok "Twingate Connector started!"
|
|
||||||
|
|
||||||
echo -e "${INFO}${YW} Twingate Connector status: $(systemctl status twingate-connector) ${CL}"
|
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
customize
|
customize
|
||||||
|
Loading…
x
Reference in New Issue
Block a user