diff options
| author | Jason D. McCormick <jason@mfamily.org> | 2022-12-11 12:55:11 -0500 |
|---|---|---|
| committer | Jason D. McCormick <jason@mfamily.org> | 2022-12-11 12:55:11 -0500 |
| commit | 726ed2a21c45d3c98a86f089b73c0147b64113ac (patch) | |
| tree | 88617f25c4a50f95d1fe96e324c6aaea1f97db67 /he-dyndns-bash | |
| parent | 59542bb87f1787a9c2c7c10c4f410adee7bf9d70 (diff) | |
reorg repo
Diffstat (limited to 'he-dyndns-bash')
| -rwxr-xr-x | he-dyndns-bash | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/he-dyndns-bash b/he-dyndns-bash deleted file mode 100755 index 0ce3730..0000000 --- a/he-dyndns-bash +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -# -# Copyright (C)2019 by Jason D. McCormick <jason@mfamily.org> -# Licensed under the Apache License 2.0. See LICENSE included -# with the distribution bundle that contained this file. -# - -PATH="/usr/bin:/bin:/usr/sbin:/sbin" - -## KNOWLEDGE IS GOOD ## -usage() { echo "Usage: $0 [-s SECRET] -d HOSTNAME[,HOSTNAME,...]" 1>&2; exit 1; } - -## DO THE UPDATE FUNCTION ONCE FOR HAPPY EDITING ## -doUpdate() { - - if [ ! -z $2 ]; then - myip="&myip=$2" - fi - - /usr/bin/curl -s$1 "https://$FQDN:$CODE@$DNSSITE/nic/update?hostname=$FQDN$myip" > $tfile - if ! egrep -q '(good|nochg)' $tfile; then - echo -n "v$1 change: " - cat $tfile - echo - retval=1 - fi -} - -## MAIN ## -while getopts "46a:A:hd:s:" arg; do - case "${arg}" in - 4) - DO4=Y - ;; - 6) - DO6=Y - ;; - a) - ADDR4=${OPTARG} - ;; - A) - ADDR6=${OPTARG} - ;; - d) - FQDNS=${OPTARG} - ;; - s) - CODE=${OPTARG} - ;; - *) - usage - ;; - esac -done - -if [ -z "${FQDNS}" ]; then - usage -fi - -if [ ! -f /etc/he-dns-secret ] && [ -z "${CODE}" ]; then - usage -fi - -if [ -z "${CODE}" ]; then - . /etc/he-dns-secret - - if [ -z "${CODE}" ]; then - echo "/etc/he-dns-secret does not contain a CODE= variable" - exit 1 - fi -fi - -DNSSITE="dyn.dns.he.net"; -retval=0 -tfile=$(/bin/mktemp) - -for FQDN in $(echo $FQDNS | tr ',' ' ') -do - if [ ! -z ${DO4} ]; then - doUpdate 4 ${ADDR4} - fi - - if [ ! -z ${DO6} ]; then - doUpdate 6 ${ADDR6} - fi -done - -rm $tfile - -exit $retval - |
