Check tahoelafs server creation

This commit is contained in:
Bob Mottram 2017-03-07 14:48:18 +00:00
parent 4501edce9b
commit 10258bd293
1 changed files with 15 additions and 11 deletions

View File

@ -488,19 +488,19 @@ function add_tahoelafs_server {
return return
fi fi
if grep -q "$public_key" $tahoelafs_storage_file; then if [ ! -f ${tahoelafs_storage_file} ]; then
return echo 'storage:' > ${tahoelafs_storage_file}
fi
if [ ! -f $tahoelafs_storage_file ]; then
echo 'storage:' > $tahoelafs_storage_file
else else
echo '# storage' >> $tahoelafs_storage_file if grep -q "${public_key}" ${tahoelafs_storage_file}; then
return
fi
echo '# storage' >> ${tahoelafs_storage_file}
fi fi
echo " $public_key" >> $tahoelafs_storage_file echo " ${public_key}" >> ${tahoelafs_storage_file}
echo " ann:" >> $tahoelafs_storage_file echo " ann:" >> ${tahoelafs_storage_file}
echo " nickname: $nick" >> $tahoelafs_storage_file echo " nickname: ${nick}" >> ${tahoelafs_storage_file}
echo " anonymous-storage-FURL: $furl" >> $tahoelafs_storage_file echo " anonymous-storage-FURL: ${furl}" >> ${tahoelafs_storage_file}
chown tahoelafs:debian-tor $tahoelafs_storage_file chown tahoelafs:debian-tor ${tahoelafs_storage_file}
if ! grep -q "HidServAuth ${storage_hostname}" /etc/tor/torrc; then if ! grep -q "HidServAuth ${storage_hostname}" /etc/tor/torrc; then
echo "HidServAuth ${storage_hostname}" >> /etc/tor/torrc echo "HidServAuth ${storage_hostname}" >> /etc/tor/torrc
@ -618,6 +618,10 @@ function install_tahoelafs {
create_tahoelafs_stealth_node /home/tahoelafs/storage /home/tahoelafs/client ${node_nick} ${client_nick} create_tahoelafs_stealth_node /home/tahoelafs/storage /home/tahoelafs/client ${node_nick} ${client_nick}
add_tahoelafs_server "$(get_tahoelafs_storage_hostname)" "$(get_tahoelafs_public_key)" "${node_nick}" "$(get_tahoelafs_furl)" add_tahoelafs_server "$(get_tahoelafs_storage_hostname)" "$(get_tahoelafs_public_key)" "${node_nick}" "$(get_tahoelafs_furl)"
if ! grep -q "HidServAuth $(get_tahoelafs_storage_hostname)" /etc/tor/torrc; then
echo $'Unable to create tahoelafs server'
exit 738752
fi
# start the storage node # start the storage node
su -c '/home/tahoelafs/tahoelafs/venv/bin/python2 /home/tahoelafs/tahoelafs/venv/bin/tahoe start /home/tahoelafs/storage' - tahoelafs su -c '/home/tahoelafs/tahoelafs/venv/bin/python2 /home/tahoelafs/tahoelafs/venv/bin/tahoe start /home/tahoelafs/storage' - tahoelafs