diff --git a/src/freedombone-app-tahoelafs b/src/freedombone-app-tahoelafs index f752a843..ed7d1684 100755 --- a/src/freedombone-app-tahoelafs +++ b/src/freedombone-app-tahoelafs @@ -488,19 +488,19 @@ function add_tahoelafs_server { return fi - if grep -q "$public_key" $tahoelafs_storage_file; then - return - fi - if [ ! -f $tahoelafs_storage_file ]; then - echo 'storage:' > $tahoelafs_storage_file + if [ ! -f ${tahoelafs_storage_file} ]; then + echo 'storage:' > ${tahoelafs_storage_file} else - echo '# storage' >> $tahoelafs_storage_file + if grep -q "${public_key}" ${tahoelafs_storage_file}; then + return + fi + echo '# storage' >> ${tahoelafs_storage_file} fi - echo " $public_key" >> $tahoelafs_storage_file - echo " ann:" >> $tahoelafs_storage_file - echo " nickname: $nick" >> $tahoelafs_storage_file - echo " anonymous-storage-FURL: $furl" >> $tahoelafs_storage_file - chown tahoelafs:debian-tor $tahoelafs_storage_file + echo " ${public_key}" >> ${tahoelafs_storage_file} + echo " ann:" >> ${tahoelafs_storage_file} + echo " nickname: ${nick}" >> ${tahoelafs_storage_file} + echo " anonymous-storage-FURL: ${furl}" >> ${tahoelafs_storage_file} + chown tahoelafs:debian-tor ${tahoelafs_storage_file} if ! grep -q "HidServAuth ${storage_hostname}" /etc/tor/torrc; then 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} 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 su -c '/home/tahoelafs/tahoelafs/venv/bin/python2 /home/tahoelafs/tahoelafs/venv/bin/tahoe start /home/tahoelafs/storage' - tahoelafs