#!/bin/shvars="gitd_ip gitd_basepath git_name git_email tinydns_config tinydns__tldsrvrname tinydns__tldsrvrip"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__tldsrvrname"= x ];thentinydns__tldsrvrname="uz5fvb7zdqyuz4q8ysjdfuf04kzd2lrt0l6fp4uyguxdg5tfut06ck.anons.somerandomnick.ano"fiif[ x"$tinydns__tldsrvrip"= x ];thentinydns__tldsrvrip="1.0.27.37"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 .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"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