summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure36
-rwxr-xr-xscripts/check_db_safety29
-rwxr-xr-xscripts/conf_var7
-rwxr-xr-xscripts/nameserver_autogen/tinydns_tld_datafile19
4 files changed, 89 insertions, 2 deletions
diff --git a/configure b/configure
index 00f72f4..c8823dc 100755
--- a/configure
+++ b/configure
@@ -1,16 +1,25 @@
#!/bin/sh
-vars="gitd_ip gitd_basepath"
+vars="gitd_ip gitd_basepath tinydns_config tinydns__tldsrvrname tinydns__tldsrvrip"
echo "Welcome to the resdb configurator!" >&2
echo >&2
for var in $vars ; do
- export "$var"="$(cat conf/$var)"
+ export "$var"="$(cat conf/$var 2>/dev/null)"
done
if [ x"$gitd_basepath" = x ]; then
gitd_basepath="$(pwd)/"
fi
+if [ x"$tinydns_config" = x ]; then
+ tinydns_config=n
+fi
+if [ x"$tinydns__tldsrvrname" = x ]; then
+ tinydns__tldsrvrname="uz5fvb7zdqyuz4q8ysjdfuf04kzd2lrt0l6fp4uyguxdg5tfut06ck.anons.somerandomnick.ano"
+fi
+if [ x"$tinydns__tldsrvrip" = x ]; then
+ tinydns__tldsrvrip="1.0.27.37"
+fi
echo "Please enter the IP address you'd like gitd to listen on." >&2
echo "(Default: $gitd_ip)" >&2
@@ -28,6 +37,29 @@ if [ x"$new_gitd_basepath" != x ]; then
gitd_basepath="$new_gitd_basepath"
fi
+echo -n "Would you like to configure the tinydns datafile generator? " >&2
+read new_tinydns_config
+if [ x"$new_tinydns_config" != x ]; then
+ tinydns_config="$new_tinydns_config"
+fi
+if [ x"$tinydns_config" = xy ]; then
+ echo "Please enter the hostname of your .ano TLD server." >&2
+ echo "(Default: $tinydns__tldsrvrname)" >&2
+ echo -n "TLDSrvName? " >&2
+ read new_tinydns__tldsrvrname
+ if [ x"$new_tinydns__tldsrvrname" != x ]; then
+ tinydns__tldsrvrname="$new_tinydns__tldsrvrname"
+ fi
+
+ echo "Please enter the IP address of your .ano TLD server." >&2
+ echo "(Default: $tinydns__tldsrvrip)" >&2
+ echo -n "TLDSrvIP? " >&2
+ read new_tinydns__tldsrvrip
+ if [ x"$new_tinydns__tldsrvrip" != x ]; then
+ tinydns__tldsrvrip="$new_tinydns__tldsrvrip"
+ fi
+fi
+
echo "Proposed configuration:" >&2
for var in $vars ; do
echo "$var=${!var}" >&2
diff --git a/scripts/check_db_safety b/scripts/check_db_safety
new file mode 100755
index 0000000..f3f3236
--- /dev/null
+++ b/scripts/check_db_safety
@@ -0,0 +1,29 @@
+#!/bin/sh
+if [ "$(ls db/dom/ | tr -d 'a-z0-9\n-' | wc -c)" != 0 ]; then
+ echo "There's a bad TLD. You probably don't want to run any shell scripts." >&2
+ exit 1
+fi
+for tld in db/dom/* ; do
+ if [ "$(ls $tld/ | tr -d 'a-z0-9\n-' | wc -c)" != 0 ]; then
+ tld="$(basename $tld)"
+ echo "There's a bad domain under $tld." >&2
+ echo "You probably don't want to run any shell scripts." >&2
+ exit 1
+ fi
+ for dom in $tld/* ; do
+ if [ "$(ls $dom/ns/ | tr -d 'a-z0-9\n.-' | wc -c)" != 0 ]; then
+ domain="$(basename $dom).$(basename $tld)"
+ echo "There's a bad nameserver under $domain." >&2
+ echo "You probably don't want to run any shell scripts." >&2
+ fi
+ for ns in $dom/ns/* ; do
+ if [ "$(cat $ns | tr -d '0-9.\n' | wc -c)" != 0 ]; then
+ domain="$(basename $dom).$(basename $tld)"
+ nsname="$(basename $ns)"
+ echo "There's a bad nameserver IP under $domain, for" >&2
+ echo " $nsname" >&2
+ echo "You probably don't want to run any shell scripts." >&2
+ fi
+ done
+ done
+done
diff --git a/scripts/conf_var b/scripts/conf_var
new file mode 100755
index 0000000..b2bffaf
--- /dev/null
+++ b/scripts/conf_var
@@ -0,0 +1,7 @@
+#!/bin/sh
+if [ -r "conf/$1" ]; then
+ exec cat "conf/$1"
+else
+ echo "$2"
+ exec false
+fi
diff --git a/scripts/nameserver_autogen/tinydns_tld_datafile b/scripts/nameserver_autogen/tinydns_tld_datafile
new file mode 100755
index 0000000..ff84576
--- /dev/null
+++ b/scripts/nameserver_autogen/tinydns_tld_datafile
@@ -0,0 +1,19 @@
+#!/bin/sh
+if ! ./scripts/check_db_safety; then
+ exit 1
+fi
+tldsrvrname="$(./scripts/conf_var tinydns__tldsrvrname uz5fvb7zdqyuz4q8ysjdfuf04kzd2lrt0l6fp4uyguxdg5tfut06ck.anons.somerandomnick.ano)"
+tldsrvrip="$(./scripts/conf_var tinydns__tldsrvrip 1.0.27.37)"
+for tld in db/dom/* ; do
+ tldname="$(basename $tld)"
+ echo "+$tldsrvrname:$tldsrvrip:3600"
+ echo ".$tldname::$tldsrvrname"
+ for zone in $tld/* ; do
+ for ns in $zone/ns/* ; do
+ domain="$(basename $zone).$(basename $tld)"
+ nsip="$(cat $ns)"
+ nsname="$(basename $ns)"
+ echo "&$domain:$nsip:$nsname"
+ done
+ done
+done