fix: suggestions from PR
This commit is contained in:
		
							parent
							
								
									5bad3969b4
								
							
						
					
					
						commit
						33c2469174
					
				| @ -27,7 +27,7 @@ function update_script() { | |||||||
|         msg_error "No ${APP} Installation Found!" |         msg_error "No ${APP} Installation Found!" | ||||||
|         exit |         exit | ||||||
|     fi |     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 |     exit | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -35,11 +35,3 @@ start | |||||||
| build_container | build_container | ||||||
| description | description | ||||||
| msg_ok "Completed Successfully!\n" | 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" |  | ||||||
| @ -14,54 +14,50 @@ network_check | |||||||
| update_os | update_os | ||||||
| 
 | 
 | ||||||
| msg_info "Installing dependencies" | msg_info "Installing dependencies" | ||||||
| $STD apt-get update |  | ||||||
| $STD apt-get install -y curl systemd | $STD apt-get install -y curl systemd | ||||||
|  | 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" | ||||||
| echo "📦 Download Go ${GO_VERSION} from ${GO_URL}..." |  | ||||||
| 
 |  | ||||||
| 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" | ||||||
| rm "$GO_TARBALL" |  | ||||||
| 
 |  | ||||||
| echo 'export PATH=$PATH:/usr/bin/go/bin' >> ~/.bashrc | echo 'export PATH=$PATH:/usr/bin/go/bin' >> ~/.bashrc | ||||||
| source ~/.bashrc | source ~/.bashrc | ||||||
| go version | msg_ok "Installed Go" | ||||||
| 
 |  | ||||||
| msg_ok "Dependencies installed" |  | ||||||
| 
 | 
 | ||||||
| msg_info "Configure Application" | msg_info "Configure Application" | ||||||
| 
 |  | ||||||
| var_cf_api_token="default" | 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) | read -rp "Enter the Cloudflare API token: " var_cf_api_token | ||||||
| msg_ok "Cloudflare Api Token: '${var_cf_api_token}'" |  | ||||||
| 
 | 
 | ||||||
| var_cf_domains="default" | 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) | read -rp "Enter the domains separated with a comma (*.example.org,www.example.org) " var_cf_domains | ||||||
| msg_ok "Cloudflare Domains: '${var_cf_domains}'" |  | ||||||
| 
 | 
 | ||||||
| var_cf_proxied="false" | var_cf_proxied="false" | ||||||
| if whiptail --yesno "Proxied?" 8 45; then | while true; do | ||||||
|     var_cf_proxied="true" |     read -rp "Proxied? (y/n): " answer | ||||||
| fi |     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" | var_cf_ip6_provider="none" | ||||||
| if whiptail --yesno "IPv6 Provider?" 8 45; then | while true; do | ||||||
|     var_cf_ip6_provider="cloudflare" |     read -rp "Enable IPv6 support? (y/n): " answer | ||||||
| else  |     case "$answer" in | ||||||
|     var_cf_ip6_provider="none" |         [Yy]* ) var_cf_ip6_provider="auto"; break;; | ||||||
| fi |         [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 service" | ||||||
| 
 |  | ||||||
| msg_info "Setting up systemd service" |  | ||||||
| mkdir -p /root/go | mkdir -p /root/go | ||||||
| chown -R root:root /root/go |  | ||||||
| cat <<EOF >/etc/systemd/system/cloudflare-ddns.service | cat <<EOF >/etc/systemd/system/cloudflare-ddns.service | ||||||
| [Unit] | [Unit] | ||||||
| Description=Cloudflare DDNS Service (Go run) | Description=Cloudflare DDNS Service (Go run) | ||||||
| @ -84,8 +80,7 @@ EOF | |||||||
| msg_ok "Systemd service configured" | msg_ok "Systemd service configured" | ||||||
| 
 | 
 | ||||||
| msg_info "Enabling and starting service" | msg_info "Enabling and starting service" | ||||||
| systemctl daemon-reload | systemctl enable -q --now cloudflare-ddns.service | ||||||
| systemctl enable --now cloudflare-ddns.service |  | ||||||
| msg_ok "Cloudflare DDNS service started" | msg_ok "Cloudflare DDNS service started" | ||||||
| 
 | 
 | ||||||
| motd_ssh | motd_ssh | ||||||
| @ -94,6 +89,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" | ||||||
| msg_ok "Cleaned" | msg_ok "Cleaned" | ||||||
| 
 |  | ||||||
| msg_ok "Completed Successfully! Cloudflare DDNS is running in the background.\n" |  | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Edoardo Pavan
						Edoardo Pavan