From 033cae364c118c0a4fcf626a2082c7494f7ed3d6 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 15 Feb 2015 15:16:06 +0000 Subject: [PATCH] FreeDNS updater --- src/freedombone | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/src/freedombone b/src/freedombone index 07e6dfc7..97f5b95e 100755 --- a/src/freedombone +++ b/src/freedombone @@ -2570,6 +2570,65 @@ function create_restore_script { echo 'create_restore_script' >> $COMPLETION_FILE } +function create_freedns_updater { + # currently inadyn doesn't work as expected with freeDNS, so this is a workaround + if grep -Fxq "create_freedns_updater" $COMPLETION_FILE; then + return + fi + if [[ $DDNS_PROVIDER != "default@freedns.afraid.org" ]]; then + return + fi + + FREEDNS_WGET='wget -q --read-timeout=0.0 --waitretry=5 --tries=4 https://freedns.afraid.org/dynamic/update.php?' + + echo '#!/bin/bash' > /usr/bin/dynamicdns + echo 'cd /tmp' >> /usr/bin/dynamicdns + if [ $DEFAULT_DOMAIN_CODE ]; then + echo "# $DEFAULT_DOMAIN_CODE" >> /usr/bin/dynamicdns + echo "$FREEDNS_WGET$DEFAULT_DOMAIN_CODE==" >> /usr/bin/dynamicdns + fi + if [ $WIKI_CODE ]; then + if [[ $WIKI_CODE != "$DEFAULT_DOMAIN_CODE" ]]; then + echo "# $WIKI_CODE" >> /usr/bin/dynamicdns + echo "$FREEDNS_WGET$WIKI_CODE==" >> /usr/bin/dynamicdns + fi + fi + if [ $FULLBLOG_CODE ]; then + if [[ $FULLBLOG_CODE != "$DEFAULT_DOMAIN_CODE" ]]; then + echo "# $FULLBLOG_CODE" >> /usr/bin/dynamicdns + echo "$FREEDNS_WGET$FULLBLOG_CODE==" >> /usr/bin/dynamicdns + fi + fi + if [ $REDMATRIX_CODE ]; then + if [[ $REDMATRIX_CODE != "$DEFAULT_DOMAIN_CODE" ]]; then + echo "# $REDMATRIX_CODE" >> /usr/bin/dynamicdns + echo "$FREEDNS_WGET$REDMATRIX_CODE==" >> /usr/bin/dynamicdns + fi + fi + if [ $OWNCLOUD_CODE ]; then + if [[ $OWNCLOUD_CODE != "$DEFAULT_DOMAIN_CODE" ]]; then + echo "# $OWNCLOUD_CODE" >> /usr/bin/dynamicdns + echo "$FREEDNS_WGET$OWNCLOUD_CODE==" >> /usr/bin/dynamicdns + fi + fi + if [ $MICROBLOG_CODE ]; then + if [[ $MICROBLOG_CODE != "$DEFAULT_DOMAIN_CODE" ]]; then + echo "# $MICROBLOG_CODE" >> /usr/bin/dynamicdns + echo "$FREEDNS_WGET$MICROBLOG_CODE==" >> /usr/bin/dynamicdns + fi + fi + echo 'exit 0' >> /usr/bin/dynamicdns + chmod 600 /usr/bin/dynamicdns + chmod +x /usr/bin/dynamicdns + + if ! grep -q "/usr/bin/dynamicdns" /etc/crontab; then + echo '*/3 * * * * root /usr/bin/dynamicdns' >> /etc/crontab + service cron restart + fi + + echo 'create_freedns_updater' >> $COMPLETION_FILE +} + function backup_to_friends_servers { if grep -Fxq "backup_to_friends_servers" $COMPLETION_FILE; then return @@ -8524,6 +8583,7 @@ change_debian_repos enable_backports configure_dns install_dynamicdns +create_freedns_updater initial_setup enforce_good_passwords install_editor