Browse Source

Record onion service domains

Bob Mottram 8 years ago
parent
commit
88f0c36f44
1 changed files with 11 additions and 1 deletions
  1. 11
    1
      src/freedombone-utils-onion

+ 11
- 1
src/freedombone-utils-onion View File

@@ -103,7 +103,17 @@ function add_onion_service {
103 103
         echo $"${onion_service_name} onion site hostname not found"
104 104
         exit 76362
105 105
     fi
106
-    echo $(cat /var/lib/tor/hidden_service_${onion_service_name}/hostname)
106
+
107
+    onion_address=$(cat /var/lib/tor/hidden_service_${onion_service_name}/hostname)
108
+
109
+    # Record the domain in the completion file
110
+    if ! grep "${onion_service_name} onion domain" $COMPLETION_FILE; then
111
+        echo "${onion_service_name} onion domain:${onion_address}" >> $COMPLETION_FILE
112
+    else
113
+        sed -i "s|${onion_service_name} onion domain.*|${onion_service_name} onion domain:${onion_address}|g" $COMPLETION_FILE
114
+    fi
115
+
116
+    echo $onion_address
107 117
 }
108 118
 
109 119
 function set_default_onion_domains {