#!/bin/shvars="gitd_ip gitd_basepath git_name git_email tinydns_config tinydns__rootsrvrname tinydns__rootsrvrip tinydns__tldsrvrname tinydns__tldsrvrip tinydns__srvrip tinydns__srvrname"echo"Welcome to the resdb configurator!" >&2echo >&2for var in $vars;doexport"$var"="$(cat conf/$var2>/dev/null)"doneif[ x"$gitd_basepath"= x ];thengitd_basepath="$(pwd)/"fiif[ x"$git_name"= x ];thengit_name="Anonymous Coward"fiif[ x"$git_email"= x ];thengit_email="nobody@nowhere"fiif[ x"$tinydns_config"= x ];thentinydns_config=nfiif[ x"$tinydns__rootsrvrname"= x ];thentinydns__rootsrvrname="uz5hn5hz5x5bp09p5z2806x4gngcw1k5j2wk88fuvkth5pp2hw4t2d.rootns.somerandomnick.ano"fiif[ x"$tinydns__rootsrvrip"= x ];thentinydns__rootsrvrip="1.0.27.39"fiif[ x"$tinydns__tldsrvrname"= x ];thentinydns__tldsrvrname="uz5fvb7zdqyuz4q8ysjdfuf04kzd2lrt0l6fp4uyguxdg5tfut06ck.anons.somerandomnick.ano"fiif[ x"$tinydns__tldsrvrip"= x ];thentinydns__tldsrvrip="1.0.27.37"fiif[ x"$tinydns__srvrname"= x ];thentinydns__srvrname="uz5z6spsd4jsd2k984wuzknr13gwjc630gmvtcv4bmpsrb04c179h1.ns.somerandomnick.ano"fiif[ x"$tinydns__srvrip"= x ];thentinydns__srvrip="1.0.27.86"fiecho"Please enter the IP address you'd like gitd to listen on." >&2echo"(Default: $gitd_ip)" >&2echo -n "IP? " >&2read new_gitd_ipif[ x"$new_gitd_ip" != x ];thengitd_ip="$new_gitd_ip"fiecho"Please enter the full path to resdb." >&2echo"(Default: $gitd_basepath)" >&2echo -n "BasePath? " >&2read new_gitd_basepathif[ x"$new_gitd_basepath" != x ];thengitd_basepath="$new_gitd_basepath"fiecho"Please enter your name." >&2echo"(Default: $git_name)" >&2echo -n "Name? " >&2read new_git_nameif[ x"$new_git_name" != x ];thengit_name="$new_git_name"fiecho"Please enter your email." >&2echo"(Default: $git_email)" >&2echo -n "Email? " >&2read new_git_emailif[ x"$new_git_email" != x ];thengit_email="$new_git_email"fiecho -n "Would you like to configure the tinydns datafile generator? " >&2read new_tinydns_configif[ x"$new_tinydns_config" != x ];thentinydns_config="$new_tinydns_config"fiif[ x"$tinydns_config"= xy ];thenecho"Please enter the hostname of your root nameserver." >&2echo"(Default: $tinydns__rootsrvrname)" >&2echo -n "RootSrvName? " >&2read new_tinydns__rootsrvrnameif[ x"$new_tinydns__rootsrvrname" != x ];thentinydns__rootsrvrname="$new_tinydns__rootsrvrname"fiecho"Please enter the IP address of your root nameserver." >&2echo"(Default: $tinydns__rootsrvrip)" >&2echo -n "RootSrvIP? " >&2read new_tinydns__rootsrvripif[ x"$new_tinydns__rootsrvrip" != x ];thentinydns__rootsrvrip="$new_tinydns__rootsrvrip"fiecho"Please enter the hostname of your .ano TLD server." >&2echo"(Default: $tinydns__tldsrvrname)" >&2echo -n "TLDSrvName? " >&2read new_tinydns__tldsrvrnameif[ x"$new_tinydns__tldsrvrname" != x ];thentinydns__tldsrvrname="$new_tinydns__tldsrvrname"fiecho"Please enter the IP address of your .ano TLD server." >&2echo"(Default: $tinydns__tldsrvrip)" >&2echo -n "TLDSrvIP? " >&2read new_tinydns__tldsrvripif[ x"$new_tinydns__tldsrvrip" != x ];thentinydns__tldsrvrip="$new_tinydns__tldsrvrip"fiecho"Please enter the hostname of your nameserver." >&2echo"(Default: $tinydns__srvrname)" >&2echo -n "SrvName? " >&2read new_tinydns__srvrnameif[ x"$new_tinydns__srvrname" != x ];thentinydns__srvrname="$new_tinydns__srvrname"fiecho"Please enter the IP address of your nameserver." >&2echo"(Default: $tinydns__srvrip)" >&2echo -n "SrvIP? " >&2read new_tinydns__srvripif[ x"$new_tinydns__srvrip" != x ];thentinydns__srvrip="$new_tinydns__srvrip"fifiecho"Proposed configuration:" >&2for var in $vars;doecho"$var=${!var}" >&2doneecho -n "To write the configuration, hit RETURN. To abort, hit ^C: " >&2read write_configecho -n "Writing configuration... " >&2mkdir -p conf ||exit1for var in $vars;doecho"${!var}" > conf/"$var"||exit1doneecho"Done" >&2echo -n "Updating git configuration... " >&2cd"$(cat ./conf/gitd_basepath)"||exit1git config user.name "$(cat ./conf/git_name)"||exit1git config user.email "$(cat ./conf/git_email)"||exit1echo"Done" >&2