From 259dbe47b5cfb962c3faa7eec046adcda41ba6a1 Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@robotics.uk.to>
Date: Mon, 25 Jan 2016 19:12:32 +0000
Subject: [PATCH] Install once only

---
 src/freedombone | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/freedombone b/src/freedombone
index 59702a5f4..332c89b4c 100755
--- a/src/freedombone
+++ b/src/freedombone
@@ -3524,13 +3524,20 @@ function install_tor {
     if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
         return
     fi
+    if grep -Fxq "install_tor" $COMPLETION_FILE; then
+        return
+    fi
     apt-get -y install tor
+    echo 'install_tor' >> $COMPLETION_FILE
 }
 
 function enable_ssh_via_onion {
     if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
         return
     fi
+    if grep -Fxq "enable_ssh_via_onion" $COMPLETION_FILE; then
+        return
+    fi
     apt-get -y install tor connect-proxy
     if ! grep -q 'Host *.onion' /home/$MY_USERNAME/.ssh/config; then
         if [ ! -d /home/$MY_USERNAME/.ssh ]; then
@@ -3548,6 +3555,7 @@ function enable_ssh_via_onion {
         echo 'Host *.onion' >> /root/.ssh/config
         echo 'ProxyCommand connect -R remote -5 -S 127.0.0.1:9050 %h %p' >> /root/.ssh/config
     fi
+    echo 'enable_ssh_via_onion' >> $COMPLETION_FILE
 }
 
 function install_editor {
-- 
GitLab