feat: add DuckDNS.sh

This commit is contained in:
AJ ONeal
2023-01-15 03:23:45 +00:00
parent 22aa8ba596
commit 25b003996a
3 changed files with 167 additions and 0 deletions
+98
View File
@@ -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 <subdomain>
# duckdns.sh auth foobar # do NOT include '.duckdns.org'
```
Set to launch on login (Mac) or on boot (Linux)
```sh
# duckdns.sh enable <subdomain>
duckdns.sh enable foobar
```
### Usage
Use `-v` to filter out all matches so that only non-matches are left.
```sh
USAGE
duckdns.sh <subcommand> [arguments...]
SUBCOMMANDS
myip - show this device's ip(s)
ip <subdomain> - show subdomain's ip(s)
list - show subdomains
auth <subdomain> - add Duck DNS token
update <subdomain> - update subdomain to device ip
set <subdomain> <ip> [ipv6] - set ipv4 and/or ipv6 explicitly
clear <subdomain> - unset ip(s)
run <subdomain> - check ip and update every 5m
enable <subdomain> - enable on boot (Linux) or login (macOS)
disable <subdomain> - 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
```
+41
View File
@@ -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
+28
View File
@@ -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));
});
}