Skip to content

Commit

Permalink
spDYN: support IPv6
Browse files Browse the repository at this point in the history
  • Loading branch information
TomTurnschuh authored and nachoparker committed Sep 16, 2018
1 parent 241f2e0 commit 3479014
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
6 changes: 4 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@

[v0.59.12](https://github.com/nextcloud/nextcloudpi/commit/5fc8986) (2018-09-07) Change email program from PHP to Sendmail
[v0.59.13](https://github.com/nextcloud/nextcloudpi/commit/3ccf987) (2018-09-15) spDYN: support IPv6

[v0.59.12](https://github.com/nextcloud/nextcloudpi/commit/241f2e0) (2018-09-07) Change email program from PHP to Sendmail

[v0.59.11](https://github.com/nextcloud/nextcloudpi/commit/5be7866) (2018-09-16) lamp: add referrer policy for enhanced privacy

[v0.59.10](https://github.com/nextcloud/nextcloudpi/commit/fcbd661) (2018-09-04) ncp-web: add hover text for ncp admin header icons

[v0.59.9 ](https://github.com/nextcloud/nextcloudpi/commit/6a755c3) (2018-09-16) nc-prettyURL: fixes

[v0.59.8](https://github.com/nextcloud/nextcloudpi/commit/a00cd0b) (2018-09-15) nc-format-USB: drive number was off by one (#631)
[v0.59.8 ](https://github.com/nextcloud/nextcloudpi/commit/a00cd0b) (2018-09-15) nc-format-USB: drive number was off by one (#631)

[v0.59.7 ](https://github.com/nextcloud/nextcloudpi/commit/e26a834) (2018-08-22) Rename DDNS apps so they show up together

Expand Down
20 changes: 14 additions & 6 deletions etc/ncp-config.d/DDNS_spDYN.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
ACTIVE_=no
DOMAIN_=mycloud.spdns.de
TOKEN_=your-spdns-token
IPv6_=no

INSTALLDIR=spdnsupdater
INSTALLPATH=/usr/local/etc/$INSTALLDIR
Expand All @@ -38,8 +39,15 @@ install()
### Configuration
IPv6_=$3
# Get current IP address from
get_ip_url="https://api.ipify.org/"
if [[ $IPv6 == "yes" ]]; then
get_ip_url="https://myexternalip.com/raw"
else
get_ip_url="https://api.ipify.org/"
fi
update_url="https://update.spdyn.de/nic/update"
Expand Down Expand Up @@ -78,7 +86,7 @@ function spdnsUpdater {
}
if [ $# -eq 2 ]
if [ $# -eq 3 ]
then
# if hostname and token
# Get current IP address
Expand All @@ -87,14 +95,14 @@ if [ $# -eq 2 ]
token=$2
params="-d hostname=$host -d myip=$currip -d user=$host -d pass=$token"
spdnsUpdater "$params"
elif [ $# -eq 3 ]
elif [ $# -eq 4 ]
then
# if hostname and user and passwd
# Get current IP address
currip=$(curl -s "$get_ip_url");
host=$1
user=$2
pass=$3
pass=$4
params="-d hostname=$host -d myip=$currip -d user=$user -d pass=$pass"
spdnsUpdater "$params"
else
Expand Down Expand Up @@ -122,11 +130,11 @@ configure()

# Adds file to cron to run script for DNS record updates and change permissions
touch $CRONFILE
echo "0 * * * * root $INSTALLPATH/spdnsUpdater.sh $DOMAIN_ $TOKEN_ >/dev/null 2>&1" > "$CRONFILE"
echo "0 * * * * root $INSTALLPATH/spdnsUpdater.sh $DOMAIN_ $TOKEN_ $IPv6_ >/dev/null 2>&1" > "$CRONFILE"
chmod +x "$CRONFILE"

# First-time execution of update script and print response from spdns.de server
"$INSTALLPATH"/spdnsUpdater.sh "$DOMAIN_" "$TOKEN_"
"$INSTALLPATH"/spdnsUpdater.sh "$DOMAIN_" "$TOKEN_" "IPv6_"

# Removes config files and cron job if ACTIVE_ is set to no
elif [[ $ACTIVE_ == "no" ]]; then
Expand Down

0 comments on commit 3479014

Please sign in to comment.