diff --git a/ct/cloudflare-ddns.sh b/ct/cloudflare-ddns.sh index 838365d..9c6f604 100644 --- a/ct/cloudflare-ddns.sh +++ b/ct/cloudflare-ddns.sh @@ -27,7 +27,7 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - msg_error "We don't provide an update function because the service ${APP} use every time the latest version." + msg_error "There is no update function for ${APP}." exit } @@ -35,11 +35,3 @@ start build_container description msg_ok "Completed Successfully!\n" -echo -e "${APP} setup has been successfully initialized!\n" -echo -e "If you want to update the service go to the container and run the command:\n" -echo -e "sudo nano /etc/systemd/system/cloudflare-ddns.service\n" -echo -e "Update the token or the other environment variables and save the file.\n" -echo -e "Then run the command:\n" -echo -e "sudo systemctl daemon-reload\n" -echo -e "And finally restart the service with:\n" -echo -e "sudo systemctl restart cloudflare-ddns.service" \ No newline at end of file diff --git a/install/cloudflare-ddns-install.sh b/install/cloudflare-ddns-install.sh index b4ea27f..daf4de0 100644 --- a/install/cloudflare-ddns-install.sh +++ b/install/cloudflare-ddns-install.sh @@ -14,54 +14,50 @@ network_check update_os msg_info "Installing dependencies" -$STD apt-get update $STD apt-get install -y curl systemd +msg_ok "Installed dependencies" msg_info "Installing Go" GO_VERSION=$(curl -s https://go.dev/VERSION?m=text | grep -m1 '^go') GO_TARBALL="${GO_VERSION}.linux-amd64.tar.gz" GO_URL="https://go.dev/dl/${GO_TARBALL}" INSTALL_DIR="/usr/bin" -echo "📦 Download Go ${GO_VERSION} from ${GO_URL}..." - rm -rf "${INSTALL_DIR}/go" - curl -LO "$GO_URL" tar -C "$INSTALL_DIR" -xzf "$GO_TARBALL" -rm "$GO_TARBALL" - echo 'export PATH=$PATH:/usr/bin/go/bin' >> ~/.bashrc source ~/.bashrc -go version - -msg_ok "Dependencies installed" +msg_ok "Installed Go" msg_info "Configure Application" - var_cf_api_token="default" -var_cf_api_token=$(whiptail --title "CLOUDFLARE TOKEN" --backtitle "Type the Cloudflare Api Token:" --inputbox "token" 10 60 3>&1 1>&2 2>&3) -msg_ok "Cloudflare Api Token: '${var_cf_api_token}'" +read -rp "Enter the Cloudflare API token: " var_cf_api_token var_cf_domains="default" -var_cf_domains=$(whiptail --title "CLOUDFLARE DOMAINS" --backtitle "Type the domains separated with a comma (example.org,www.example.org)" --inputbox "*.example.com" 10 60 3>&1 1>&2 2>&3) -msg_ok "Cloudflare Domains: '${var_cf_domains}'" +read -rp "Enter the domains separated with a comma (*.example.org,www.example.org) " var_cf_domains var_cf_proxied="false" -if whiptail --yesno "Proxied?" 8 45; then - var_cf_proxied="true" -fi +while true; do + read -rp "Proxied? (y/n): " answer + case "$answer" in + [Yy]* ) var_cf_proxied="true"; break;; + [Nn]* ) var_cf_proxied="false"; break;; + * ) echo "Please answer y or n.";; + esac +done var_cf_ip6_provider="none" -if whiptail --yesno "IPv6 Provider?" 8 45; then - var_cf_ip6_provider="cloudflare" -else - var_cf_ip6_provider="none" -fi +while true; do + read -rp "Enable IPv6 support? (y/n): " answer + case "$answer" in + [Yy]* ) var_cf_ip6_provider="auto"; break;; + [Nn]* ) var_cf_ip6_provider="none"; break;; + * ) echo "Please answer y or n.";; + esac +done +msg_ok "Configured Application" -msg_ok "Application Configured" - -msg_info "Setting up systemd service" +msg_info "Setting up service" mkdir -p /root/go -chown -R root:root /root/go cat </etc/systemd/system/cloudflare-ddns.service [Unit] Description=Cloudflare DDNS Service (Go run) @@ -84,8 +80,7 @@ EOF msg_ok "Systemd service configured" msg_info "Enabling and starting service" -systemctl daemon-reload -systemctl enable --now cloudflare-ddns.service +systemctl enable -q --now cloudflare-ddns.service msg_ok "Cloudflare DDNS service started" motd_ssh @@ -94,6 +89,5 @@ customize msg_info "Cleaning up" $STD apt-get -y autoremove $STD apt-get -y autoclean +rm -f "$GO_TARBALL" msg_ok "Cleaned" - -msg_ok "Completed Successfully! Cloudflare DDNS is running in the background.\n"