diff options
author | nachoparker <nacho@ownyourbits.com> | 2017-09-02 11:08:21 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2017-09-03 23:47:00 +0300 |
commit | 5f943aca5b905cc6188a5128d46adec384cd7796 (patch) | |
tree | b9208df8ff8a16f52000ce674f1d074a871ae732 | |
parent | dd08a396a986a044b6168bf443ca4448853ed2de (diff) |
freeDNS: fixesv0.26.1
-rw-r--r-- | etc/nextcloudpi-config.d/freeDNS.sh | 85 |
1 files changed, 41 insertions, 44 deletions
diff --git a/etc/nextcloudpi-config.d/freeDNS.sh b/etc/nextcloudpi-config.d/freeDNS.sh index 62e8eab4..5dee1b37 100644 --- a/etc/nextcloudpi-config.d/freeDNS.sh +++ b/etc/nextcloudpi-config.d/freeDNS.sh @@ -14,27 +14,42 @@ # # -ACTIVE_=yes -UPDATEURL_=https://freedns.afraid.org/dynamic/update.php +ACTIVE_=no UPDATEHASH_=abcdefghijklmnopqrstuvwxyzABCDEFGHIJK1234567 -DOMAIN_=nextcloud.example.com +DOMAIN_=mynextcloud.example.com UPDATEINTERVAL_=30 DESCRIPTION="DDNS FreeDNS client (need account)" -URL="${UPDATEURL_}?${UPDATEHASH_}" -show_info() +UPDATEURL=https://freedns.afraid.org/dynamic/update.php +URL="${UPDATEURL}?${UPDATEHASH_}" + +install() { - whiptail --yesno \ - --backtitle "NextCloudPi configuration" \ - --title --title "Instructions for FreeDNS client -Set the time in seconds in UPDATEINTERVAL. ->>> Long interval may lead to not updating your IP address for long time. <<<" \ - 20 90 + apt-get update + apt-get install --no-install-recommends -y dnsutils + cat > /etc/systemd/system/freedns.service <<EOF +[Unit] +Description=FreeDNS client + +[Service] +Type=simple +ExecStart=/usr/local/bin/freedns.sh + +[Install] +WantedBy=default.target +EOF } -install() +configure() { -apt-get install --no-install-recommends -y dnsutils + [[ $ACTIVE_ != "yes" ]] && { + systemctl stop freedns.timer + systemctl disable freedns.timer + systemctl daemon-reload + echo "FreeDNS client is disabled" + return 0 + } + cat > /usr/local/bin/freedns.sh <<EOF #!/bin/bash echo "FreeDNS client started" @@ -45,61 +60,43 @@ currentIP=$(wget -q -O - http://checkip.dyndns.org|sed s/[^0-9.]//g) wget -q -O /dev/null ${URL} } echo "Registered IP: \$registeredIP | Current IP: \$currentIP" - EOF - chmod +744 /usr/local/bin/freedns.sh - cat > /etc/systemd/system/freedns.service <<EOF -[Unit] -Description=FreeDNS client - -[Service]g -Type=simple -ExecStart=/bin/bash /usr/local/bin/freedns.sh - -[Install] -WantedBy=default.target -EOF -} - -configure() -{ cat > /etc/systemd/system/freedns.timer <<EOF [Unit] Description=Timer to run FreeDNS client per interval [Timer] -OnBootSec=${UPDATEINTERVAL_} -OnUnitActiveSec=${UPDATEINTERVAL_} +OnBootSec=${UPDATEINTERVAL_}min +OnUnitActiveSec=${UPDATEINTERVAL_}min Unit=freedns.service [Install] WantedBy=timers.target EOF - systemctl daemon-reload + systemctl daemon-reload - [[ $ACTIVE_ != "yes" ]] && { - systemctl stop freedns.timer - systemctl disable freedns.timer - systemctl daemon-reload - echo "FreeDNS client is disabled" - return 0 - } systemctl daemon-reload systemctl enable freedns.timer systemctl start freedns.timer - echo "FreeDNS client is enabled" cd /var/www/nextcloud sudo -u www-data php occ config:system:set trusted_domains 3 --value="$DOMAIN_" sudo -u www-data php occ config:system:set overwrite.cli.url --value=https://"$DOMAIN_" - + echo "FreeDNS client is enabled" +} + +cleanup() +{ + apt-get autoremove -y + apt-get clean + rm /var/lib/apt/lists/* -r } - cleanup() { :; } + # License # # This script is free software; you can redistribute it and/or modify it @@ -115,4 +112,4 @@ EOF # 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
\ No newline at end of file +# Boston, MA 02111-1307 USA |