<commit_before>#!/bin/sh -e

if [ -z "$DDNS_USERNAME" -o -z "$DDNS_TOKEN" -o -z "$DDNS_DOMAIN" ] ; then
  echo "required environment: DDNS_USERNAME DDNS_TOKEN DDNS_DOMAIN; skipping dynamic dns"
  exit 0
fi

export DDNS_HOSTNAME=`curl --silent http://169.254.169.254/latest/meta-data/hostname | cut -f1 -d.`

### workaround for flaky resolvers
### remove when this (or at least a switch for this) is built into base image
apt-get install bind9
echo "nameserver 127.0.0.1" > /etc/resolv.conf
echo "supersede domain-name-servers 127.0.0.1;" >> /etc/dhcp/dhclient.conf
###

ddns=/etc/cron.hourly/ddns

../../render.py < ddns > $ddns

chmod 755 $ddns

$ddns

for init in ddns ; do
    install $init.init /etc/init.d/$init
    update-rc.d $init defaults
done

# wait until the DNS catches up ...

./wait.py<commit_msg>apt fix.<commit_after>#!/bin/sh -e

if [ -z "$DDNS_USERNAME" -o -z "$DDNS_TOKEN" -o -z "$DDNS_DOMAIN" ] ; then
  echo "required environment: DDNS_USERNAME DDNS_TOKEN DDNS_DOMAIN; skipping dynamic dns"
  exit 0
fi

export DDNS_HOSTNAME=`curl --silent http://169.254.169.254/latest/meta-data/hostname | cut -f1 -d.`

### workaround for flaky resolvers
### remove when this (or at least a switch for this) is built into base image
apt-get -y install bind9
echo "nameserver 127.0.0.1" > /etc/resolv.conf
echo "supersede domain-name-servers 127.0.0.1;" >> /etc/dhcp/dhclient.conf
###

ddns=/etc/cron.hourly/ddns

../../render.py < ddns > $ddns

chmod 755 $ddns

$ddns

for init in ddns ; do
    install $init.init /etc/init.d/$init
    update-rc.d $init defaults
done

# wait until the DNS catches up ...

./wait.py
{'fraction_non_alphanumeric': 0.1467324290998767, 'fraction_numerical': 0.036991368680641186, 'mean_word_length': 3.3050397877984086, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1306738', 'n_tokens_mistral': 682, 'n_tokens_neox': 625, 'n_words': 179}