瀏覽代碼

Check tahoelafs server creation

Bob Mottram 8 年之前
父節點
當前提交
10258bd293
共有 1 個檔案被更改,包括 15 行新增11 行删除
  1. 15
    11
      src/freedombone-app-tahoelafs

+ 15
- 11
src/freedombone-app-tahoelafs 查看文件

@@ -488,19 +488,19 @@ function add_tahoelafs_server {
488 488
         return
489 489
     fi
490 490
 
491
-    if grep -q "$public_key" $tahoelafs_storage_file; then
492
-        return
493
-    fi
494
-    if [ ! -f $tahoelafs_storage_file ]; then
495
-        echo 'storage:' > $tahoelafs_storage_file
491
+    if [ ! -f ${tahoelafs_storage_file} ]; then
492
+        echo 'storage:' > ${tahoelafs_storage_file}
496 493
     else
497
-        echo '# storage' >> $tahoelafs_storage_file
494
+        if grep -q "${public_key}" ${tahoelafs_storage_file}; then
495
+            return
496
+        fi
497
+        echo '# storage' >> ${tahoelafs_storage_file}
498 498
     fi
499
-    echo "  $public_key" >> $tahoelafs_storage_file
500
-    echo "    ann:" >> $tahoelafs_storage_file
501
-    echo "      nickname: $nick" >> $tahoelafs_storage_file
502
-    echo "      anonymous-storage-FURL: $furl" >> $tahoelafs_storage_file
503
-    chown tahoelafs:debian-tor $tahoelafs_storage_file
499
+    echo "  ${public_key}" >> ${tahoelafs_storage_file}
500
+    echo "    ann:" >> ${tahoelafs_storage_file}
501
+    echo "      nickname: ${nick}" >> ${tahoelafs_storage_file}
502
+    echo "      anonymous-storage-FURL: ${furl}" >> ${tahoelafs_storage_file}
503
+    chown tahoelafs:debian-tor ${tahoelafs_storage_file}
504 504
 
505 505
     if ! grep -q "HidServAuth ${storage_hostname}" /etc/tor/torrc; then
506 506
         echo "HidServAuth ${storage_hostname}" >> /etc/tor/torrc
@@ -618,6 +618,10 @@ function install_tahoelafs {
618 618
     create_tahoelafs_stealth_node /home/tahoelafs/storage /home/tahoelafs/client ${node_nick} ${client_nick}
619 619
 
620 620
     add_tahoelafs_server "$(get_tahoelafs_storage_hostname)" "$(get_tahoelafs_public_key)" "${node_nick}" "$(get_tahoelafs_furl)"
621
+    if ! grep -q "HidServAuth $(get_tahoelafs_storage_hostname)" /etc/tor/torrc; then
622
+        echo $'Unable to create tahoelafs server'
623
+        exit 738752
624
+    fi
621 625
 
622 626
     # start the storage node
623 627
     su -c '/home/tahoelafs/tahoelafs/venv/bin/python2 /home/tahoelafs/tahoelafs/venv/bin/tahoe start /home/tahoelafs/storage' - tahoelafs