diff options
author | nachoparker <nacho@ownyourbits.com> | 2017-09-25 13:44:22 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2017-09-27 02:17:39 +0300 |
commit | 0c535b5b5a84f4e42735e78859ec8879c5a1cefc (patch) | |
tree | 193570810b0ee430e4838b20e9c3b33a43f56e74 | |
parent | 6ded3469593107810681e23608afd9c2fbe46140 (diff) |
reviewed duckDNS: small adaptationsv0.30.0
-rw-r--r-- | changelog.md | 8 | ||||
-rw-r--r-- | etc/nextcloudpi-config.d/duckDNS.sh | 75 | ||||
-rw-r--r-- | etc/nextcloudpi-config.d/nc-duckdns.sh | 77 |
3 files changed, 81 insertions, 79 deletions
diff --git a/changelog.md b/changelog.md index 547f3eaa..d6062347 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ -[v0.29.3](https://github.com/nextcloud/nextcloudpi/commit/0a5eabe) (2017-09-24) ncp-web: authentication fixes +[v0.30.0](https://github.com/nextcloud/nextcloudpi/commit/ab69e1f) (2017-09-25) reviewed duckDNS: small adaptations + +[v0.29.4 ](https://github.com/nextcloud/nextcloudpi/commit/caa38a3) (2017-09-23) nc-backup: apply limit before backup + +[v0.29.3 ](https://github.com/nextcloud/nextcloudpi/commit/9df3950) (2017-09-24) ncp-web: authentication fixes [v0.29.2 ](https://github.com/nextcloud/nextcloudpi/commit/353be22) (2017-09-20) changed hostname @@ -7,7 +11,7 @@ [v0.29.0 ](https://github.com/nextcloud/nextcloudpi/commit/0c1f1af) (2017-09-20) updated to NC12.0.3 -[v0.28.2 ](https://github.com/nextcloud/nextcloudpi/commit/ac3fcab) (2017-09-18) ncp-web: point changelog to master +[v0.28.2](https://github.com/nextcloud/nextcloudpi/commit/ac3fcab) (2017-09-18) ncp-web: point changelog to master [v0.28.1 ](https://github.com/nextcloud/nextcloudpi/commit/3b71b3d) (2017-09-15) nc-static-IP: add new IP to trusted domain diff --git a/etc/nextcloudpi-config.d/duckDNS.sh b/etc/nextcloudpi-config.d/duckDNS.sh new file mode 100644 index 00000000..4db8772e --- /dev/null +++ b/etc/nextcloudpi-config.d/duckDNS.sh @@ -0,0 +1,75 @@ +#!/bin/bash + +# DuckDNS installation on Raspbian for NextcloudPi +# +# +# Copyleft 2017 by Courtney Hicks +# GPL licensed (see end of file) * Use at your own risk! +# + +ACTIVE_=no +DOMAIN_=mycloud.duckdns.org +TOKEN_=your-duckdns-token + +INSTALLDIR=duckdns +INSTALLPATH=/usr/local/etc/$INSTALLDIR +CRONFILE=/etc/cron.d/duckdns +DESCRIPTION="Free Dynamic DNS provider (need account from https://duckdns.org)" + +install() { :; } + +configure() +{ + local DOMAIN="$( sed 's|.duckdns.org||' <<<"$DOMAIN_" )" + if [[ $ACTIVE_ == "yes" ]]; then + mkdir -p "$INSTALLPATH" + + # Creates duck.sh script that checks for updates to DNS records + touch "$INSTALLPATH"/duck.sh + touch "$INSTALLPATH"/duck.log + echo -e "echo url=\"https://www.duckdns.org/update?domains=$DOMAIN&token=$TOKEN_&ip=\" | curl -k -o "$INSTALLPATH"/duck.log -K -" > "$INSTALLPATH"/duck.sh + + # Adds file to cron to run script for DNS record updates and change permissions + touch $CRONFILE + echo "*/5 * * * * root $INSTALLPATH/duck.sh >/dev/null 2>&1" > "$CRONFILE" + chmod 700 "$INSTALLPATH"/duck.sh + chmod +x "$CRONFILE" + + # First-time execution of duck script + "$INSTALLPATH"/duck.sh > /dev/null 2>&1 + + SUCCESS="$( cat $INSTALLPATH/duck.log )" + + # Checks for successful run of duck.sh + if [[ $SUCCESS == "OK" ]]; then + echo "DuckDNS is enabled" + elif [[ $SUCCESS == "KO" ]]; then + echo "DuckDNS install failed, is your information correct?" + fi + + # Removes config files and cron job if ACTIVE_ is set to no + elif [[ $ACTIVE_ == "no" ]]; then + rm -f "$CRONFILE" + rm -f "$INSTALLPATH"/duck.sh + rm -f "$INSTALLPATH"/duck.log + rmdir "$INSTALLPATH" + echo "DuckDNS is now disabled" + fi +} + +# License +# +# This script is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This script is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this script; if not, write to the +# Free Software Foundation, Inc., 59 Temple Place, Suite 330, +# Boston, MA 02111-1307 USA diff --git a/etc/nextcloudpi-config.d/nc-duckdns.sh b/etc/nextcloudpi-config.d/nc-duckdns.sh deleted file mode 100644 index c53f4e60..00000000 --- a/etc/nextcloudpi-config.d/nc-duckdns.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash - -# DuckDNS installation on Raspbian for NextcloudPi -# -# -# Copyleft 2017 by Courtney Hicks -# GPL licensed (see end of file) * Use at your own risk! -# - -ACTIVE_=no -DOMAIN_=yourduckdnsdomain -TOKEN_=your-duckdns-token -INSTALLDIR=duckdns -INSTALLPATH=/etc/$INSTALLDIR -CRONFILE=/etc/cron.d/duckdns -DESCRIPTION="Free Dynamic DNS provider (need account from https://duckdns.org)" - -install() { :; } - - -configure() -{ - - if [[ $ACTIVE_ == "yes" ]]; then - mkdir $INSTALLPATH 2> /dev/null - # Creates duck.sh script that checks for updates to DNS records - touch $INSTALLPATH/duck.sh - touch $INSTALLPATH/duck.log - echo -e "echo url=\"https://www.duckdns.org/update?domains=$DOMAIN_&token=$TOKEN_&ip=\" | curl -k -o $INSTALLPATH/duck.log -K -" > $INSTALLPATH/duck.sh - - # Adds file to cron to run script for DNS record updates and change permissions - touch $CRONFILE - echo "*/5 * * * * $INSTALLPATH/duck.sh >/dev/null 2>&1" > $CRONFILE - chmod 700 $INSTALLPATH/duck.sh - chmod +x $CRONFILE - - # First-time execution of duck script - $INSTALLPATH/duck.sh > /dev/null 2>&1 - - SUCCESS=`cat $INSTALLPATH/duck.log` - - # Checks for successful run of duck.sh - if [[ $SUCCESS == "OK" ]]; then - echo "DuckDNS is enabled" - elif [[ $SUCCESS == "KO" ]]; then - echo "DuckDNS install failed, is your information correct?" - fi - - # Removes config files and cron job if ACTIVE_ is set to no - elif [[ $ACTIVE_ == "no" ]]; then - rm $CRONFILE 2> /dev/null - rm $INSTALLPATH/duck.sh 2> /dev/null - rm $INSTALLPATH/duck.log 2> /dev/null - rmdir $INSTALLPATH 2> /dev/null - echo "DuckDNS is now disabled" - fi -} - - -cleanup() { :; } - -# License -# -# This script is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This script is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this script; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place, Suite 330, -# Boston, MA 02111-1307 USA |