Update cloudflare-ddns-install.sh

This commit is contained in:
CanbiZ 2025-04-29 15:54:59 +02:00
parent 32402cbd80
commit d69bd1fa94

View File

@ -14,20 +14,20 @@ network_check
update_os update_os
msg_info "Installing dependencies" msg_info "Installing dependencies"
$STD apt-get install -y curl systemd install_go
msg_ok "Installed dependencies" msg_ok "Installed dependencies"
msg_info "Installing Go" # msg_info "Installing Go"
GO_VERSION=$(curl -s https://go.dev/VERSION?m=text | grep -m1 '^go') # GO_VERSION=$(curl -s https://go.dev/VERSION?m=text | grep -m1 '^go')
GO_TARBALL="${GO_VERSION}.linux-amd64.tar.gz" # GO_TARBALL="${GO_VERSION}.linux-amd64.tar.gz"
GO_URL="https://go.dev/dl/${GO_TARBALL}" # GO_URL="https://go.dev/dl/${GO_TARBALL}"
INSTALL_DIR="/usr/bin" # INSTALL_DIR="/usr/bin"
rm -rf "${INSTALL_DIR}/go" # rm -rf "${INSTALL_DIR}/go"
curl -LO "$GO_URL" # curl -LO "$GO_URL"
tar -C "$INSTALL_DIR" -xzf "$GO_TARBALL" # tar -C "$INSTALL_DIR" -xzf "$GO_TARBALL"
echo 'export PATH=$PATH:/usr/bin/go/bin' >> ~/.bashrc # echo 'export PATH=$PATH:/usr/bin/go/bin' >>~/.bashrc
source ~/.bashrc # source ~/.bashrc
msg_ok "Installed Go" # msg_ok "Installed Go"
msg_info "Configure Application" msg_info "Configure Application"
var_cf_api_token="default" var_cf_api_token="default"
@ -40,8 +40,14 @@ var_cf_proxied="false"
while true; do while true; do
read -rp "Proxied? (y/n): " answer read -rp "Proxied? (y/n): " answer
case "$answer" in case "$answer" in
[Yy]* ) var_cf_proxied="true"; break;; [Yy]*)
[Nn]* ) var_cf_proxied="false"; break;; var_cf_proxied="true"
break
;;
[Nn]*)
var_cf_proxied="false"
break
;;
*) echo "Please answer y or n." ;; *) echo "Please answer y or n." ;;
esac esac
done done
@ -49,8 +55,14 @@ var_cf_ip6_provider="none"
while true; do while true; do
read -rp "Enable IPv6 support? (y/n): " answer read -rp "Enable IPv6 support? (y/n): " answer
case "$answer" in case "$answer" in
[Yy]* ) var_cf_ip6_provider="auto"; break;; [Yy]*)
[Nn]* ) var_cf_ip6_provider="none"; break;; var_cf_ip6_provider="auto"
break
;;
[Nn]*)
var_cf_ip6_provider="none"
break
;;
*) echo "Please answer y or n." ;; *) echo "Please answer y or n." ;;
esac esac
done done
@ -77,11 +89,8 @@ RestartSec=300
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
msg_ok "Systemd service configured" systemctl enable -q --now cloudflare-ddns
msg_ok "Setup Service"
msg_info "Enabling and starting service"
systemctl enable -q --now cloudflare-ddns.service
msg_ok "Cloudflare DDNS service started"
motd_ssh motd_ssh
customize customize
@ -89,5 +98,5 @@ customize
msg_info "Cleaning up" msg_info "Cleaning up"
$STD apt-get -y autoremove $STD apt-get -y autoremove
$STD apt-get -y autoclean $STD apt-get -y autoclean
rm -f "$GO_TARBALL" #rm -f "$GO_TARBALL"
msg_ok "Cleaned" msg_ok "Cleaned"