diff --git a/duckdns.sh/README.md b/duckdns.sh/README.md new file mode 100644 index 0000000..85c61b5 --- /dev/null +++ b/duckdns.sh/README.md @@ -0,0 +1,98 @@ +--- +title: DuckDNS.sh +homepage: https://github.com/BeyondCodeBootcamp/DuckDNS.sh +tagline: | + DuckDNS.sh: Dynamic DNS updater for https://duckdns.org. Works on all POSIX*ish* systems (Mac, Linux, Docker, BSD, etc). +--- + +To update or switch versions, run `webi duckdns.sh@stable` (or `@v1.0.3`, +`@beta`, etc). + +### Files + +These are the files / directories that are created and/or modified with this +install: + +```txt +~/.config/envman/PATH.env +~/.local/bin/duckdns.sh +~/.config/duckdns.sh/ +``` + +## Cheat Sheet + +> DuckDNS.sh (`duckdns.sh`) is the best Dynamic DNS client to date. Not only +> does it have some nice sub commands and work on all Posix systems, but it can +> also register itself with your system launcher - `systemd` on Linux and +> `launchctl` on macOS. + +Paste your token from [duckdns.org](https://duckdns.org) to start. + +```sh +# duckdns.sh auth +# duckdns.sh auth foobar # do NOT include '.duckdns.org' +``` + +Set to launch on login (Mac) or on boot (Linux) + +```sh +# duckdns.sh enable +duckdns.sh enable foobar +``` + +### Usage + +Use `-v` to filter out all matches so that only non-matches are left. + +```sh +USAGE + duckdns.sh [arguments...] + +SUBCOMMANDS + myip - show this device's ip(s) + ip - show subdomain's ip(s) + + list - show subdomains + auth - add Duck DNS token + update - update subdomain to device ip + set [ipv6] - set ipv4 and/or ipv6 explicitly + clear - unset ip(s) + run - check ip and update every 5m + enable - enable on boot (Linux) or login (macOS) + disable - disable on boot or login + + help - show this menu + version - show version and exit +``` + +### How to check your current IP address + +```sh +duckdns.sh myip +``` + +This is the same as + +```sh +curl -fsSL 'https://api.ipify.org?format=text' +curl -fsSL 'https://api64.ipify.org?format=text' +``` + +### How to check your domain's current DNS records + +```sh +duckdns.sh ip foobar +``` + +This is the same as + +```sh +dig +short A foobar.duckdns.org +dig +short AAAA foobar.duckdns.org +``` + +### How to manually set your domain's DNS records + +```sh +duckdns.sh set foobar 127.0.0.1 ::1 +``` diff --git a/duckdns.sh/install.sh b/duckdns.sh/install.sh new file mode 100644 index 0000000..1a9d7f1 --- /dev/null +++ b/duckdns.sh/install.sh @@ -0,0 +1,41 @@ +#!/bin/sh +set -e +set -u + +__init_duckdns_sh() { + + ###################### + # Install duckdns.sh # + ###################### + + # Every package should define these 6 variables + pkg_cmd_name="duckdns.sh" + + pkg_dst_cmd="$HOME/.local/bin/duckdns.sh" + pkg_dst="$pkg_dst_cmd" + + pkg_src_cmd="$HOME/.local/opt/duckdns.sh-v$WEBI_VERSION/bin/duckdns.sh" + pkg_src_dir="$HOME/.local/opt/duckdns.sh-v$WEBI_VERSION" + pkg_src="$pkg_src_cmd" + + # pkg_install must be defined by every package + pkg_install() { + # ~/.local/opt/duckdns.sh-v1.0.3/bin + mkdir -p "$(dirname "$pkg_src_cmd")" + + # mv ./*DuckDNS.sh*/duckdns.sh ~/.local/opt/duckdns.sh-v1.0.3/bin/duckdns.sh + mv ./*DuckDNS.sh*/duckdns.sh "$pkg_src_cmd" + } + + # pkg_get_current_version is recommended, but (soon) not required + pkg_get_current_version() { + # 'duckdns.sh version' has output in this format: + # DuckDNS.sh v1.0.3 (2023-01-15 00:49:52 +0000) + # Copyright 2023 AJ ONeal + # This trims it down to just the version number: + # 1.0.3 + duckdns.sh version | head -n 1 | cut -d ' ' -f 2 | sed 's:^v::' + } +} + +__init_duckdns_sh diff --git a/duckdns.sh/releases.js b/duckdns.sh/releases.js new file mode 100644 index 0000000..9327bcc --- /dev/null +++ b/duckdns.sh/releases.js @@ -0,0 +1,28 @@ +'use strict'; + +var githubSource = require('../_common/github-source.js'); +var owner = 'BeyondCodeBootcamp'; +var repo = 'DuckDNS.sh'; + +module.exports = function (request) { + let arches = [ + 'amd64', + 'arm64', + 'armv6l', + 'armv7l', + 'ppc64le', + 's390x', + 'x86' + ]; + let oses = ['freebsd', 'linux', 'macos', 'posix']; + return githubSource(request, owner, repo, oses, arches).then(function (all) { + return all; + }); +}; + +if (module === require.main) { + module.exports(require('@root/request')).then(function (all) { + all = require('../_webi/normalize.js')(all); + console.info(JSON.stringify(all, null, 2)); + }); +}