FreeDNS updater

This commit is contained in:
Bob Mottram 2015-02-15 15:16:06 +00:00
parent e188a4d06b
commit 033cae364c
1 changed files with 60 additions and 0 deletions

View File

@ -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