From 06cf087233a43f56fd32f1d50ae4af805ed64edd Mon Sep 17 00:00:00 2001 From: MijazzChan <46097771+MijazzChan@users.noreply.github.com> Date: Sat, 5 Feb 2022 20:31:41 +0800 Subject: [PATCH] v1.0-hotfix (#2) * [Bug] Script Path Fix `cloudflare-ddns` needs to be imported using absolute path, fixed. * [Doc] Documentation Update README - Usage Section. --- README.md | 74 +++++++++++++++++++++++++++++++++++++++++++++++++------ cfddns.sh | 3 ++- 2 files changed, 69 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 4832158..af26a9a 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,50 @@ # Cloudflare DDNS Script for EdgeOS -It's originally designed for my Ubiquiti ER-X router to support dynamic domain update on Cloudflare. +Designed for my Ubiquiti ER-X router to support dynamic domain update (ddns) on Cloudflare. -`cron` or `ppp-up` the script to achieve ddns. +## Usage -## Scripts Usage +### 1 - Download -+ Alter specific section of `cfddns.sh`. +> Suppose you have already ssh into your EdgeOS based router, in my case, Ubiquiti ER-X. -+ `chmod +x ./cfddns.sh` +#### 1.1 Using Github Raw -+ try execute `./cfddns.sh` +```bash +cd /config/scripts/ && pwd +# /config/scripts/ + +curl -LS -o /config/scripts/cloudflare-ddns-edgeos.tar.gz https://github.com/MijazzChan/cloudflare-ddns-edgeos/raw/releases/cloudflare-ddns-edgeos.tar.gz +``` + +#### 1.2 Trouble with GFW? + +```bash +cd /config/scripts/ && pwd +# /config/scripts/ + +curl -LS -o /config/scripts/cloudflare-ddns-edgeos.tar.gz https://cdn.jsdelivr.net/gh/MijazzChan/cloudflare-ddns-edgeos@releases/cloudflare-ddns-edgeos.tar.gz +``` + +### 2 - Deploy + ++ `tar -xvf /config/scripts/cloudflare-ddns-edgeos.tar.gz` + ++ Alter variables in `/config/scripts/cloudflare-ddns-edgeos/cfddns.sh`. + ++ `+x` to files using `chmod +x /config/scripts/cloudflare-ddns-edgeos/cfddns.sh` + +### 3 - Test + +Before you set it as a scheduled task, execute it first. +```bash +/config/scripts/cloudflare-ddns-edgeos/cfddns.sh +``` +If it updates your domain record **both successfully and correctly**, proceed to next step. + +**Otherwise**, feel free to [open a issue](https://github.com/MijazzChan/cloudflare-ddns-edgeos/issues/new) -## Using `edgeos`'s task-scheduler to cron +### 4 - Using `task-scheduler` to `cron` it ```bash configure @@ -25,3 +57,31 @@ save exit ``` +## About + +EdgeOS somehow didn't support ddns on cloudflare, at least not an option in their web-ui. You need to configure it under cli. + +Besides, it communicates with cloudflare through v1 api (currently v4 is actively supported & maintained by cf). + +Thus...this project. + + +## Release/Feature History + +### v1.0-hotfix + ++ Fix script import error. (MUST use absolute path to import `cloudflare-ddns`) + ++ Update usage documentation. + +### v1.0 + ++ Initial release, test passed on er-x. + +## License + +Copyright © 2022 MijazzChan + +This work is free. You can redistribute it and/or modify it under the +terms of the Do What The Fuck You Want To Public License, Version 2, +as published by Sam Hocevar. See http://www.wtfpl.net/ for more details. \ No newline at end of file diff --git a/cfddns.sh b/cfddns.sh index da397e4..161bcd7 100755 --- a/cfddns.sh +++ b/cfddns.sh @@ -2,7 +2,8 @@ # Import utility function here -. ./cloudflare-ddns +# You `cloudflare-ddns` file ABSOLUTE PATH here! +. /config/scripts/cloudflare-ddns-edgeos/cloudflare-ddns ######## # Alter here