# Require script to be run via sudo, but not as root
if[[$EUID!= 0 ]];then
echo"This script requires root privileges! However, it may fail if running with root user. Please, run it again and prefix the command by 'sudo'."
exit 1
fi
function configure {
configoptions=()
configoptions=('default')
echo"You are going to generate all the files needed to be able to join the Grandenet network, based on re6st: a resilient overlay mesh network providing IPv6 over IPv4."
read-p"token (you can get one on http://www.grandenet.cn): " token
echo"
################ New configuration generation ####################
"
read-p"Please, give your token (you can get one on http://www.grandenet.cn): " token
re6st-conf --registry"${registry}"--token"${token}"--dir"${configdir}"||{echo"An error occured while generating the configuration. Created files in '${configdir}': ";ls"${configdir}";echo"Exiting.";exit 1 ;}
read-p"save configuration on an external device [Y/n]? " save
read-p"Save configuration on an external device [Y/n]? " save
if["$save"!="n"-a"$save"!="N"];then
save=1
if[[$(ls-d"${mountpoint}"/*)]];then
echo"Detected external partitions:"
echo"Mounted external partitions list:"
for mnt in"${mountpoint}"/*;do
echo" * $mnt"
done
else
echo"no external device partition mounted on ${mountpoint}"
echo"No external device partition mounted on ${mountpoint}."
fi
read-e-p"Where the configuration directory should be saved (use tabulation for autocompletion): " place
read-e-p"A folder called 're6stconf' will be generated in order to backup the freshly created configuration. Where should it be created (use tabulation for autocompletion)? " place
place+="/re6stconf"
echo"configuration will be saved in $place"
...
...
@@ -63,24 +74,29 @@ function configure {
install"${file}""${place}"
done
else
echo"Configuration will be placed in ${configfile}, please do a manual backup later or you could lose your access to this network."
echo-e"Configuration will be placed in ${configdir},\e[31m please do a manual backup later or you could lose your access to this network\e[0m."