From cecce3326586af51dc1390909546250ef57f930c Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@robotics.uk.to>
Date: Sat, 9 Jul 2016 21:38:19 +0100
Subject: [PATCH] Move remote ipfs backup to app script

---
 src/freedombone-app-ipfs      | 12 ++++++++++--
 src/freedombone-backup-remote |  8 --------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/freedombone-app-ipfs b/src/freedombone-app-ipfs
index e56ddb274..55f46ef86 100755
--- a/src/freedombone-app-ipfs
+++ b/src/freedombone-app-ipfs
@@ -35,7 +35,7 @@ IPFS_COMMIT='20b06a4cbce8884f5b194da6e98cb11f2c77f166'
 IPFS_PORT=4001
 
 function reconfigure_ipfs {
-    echo -n ''
+	echo -n ''
 }
 
 function upgrade_ipfs {
@@ -92,7 +92,15 @@ function restore_local_ipfs {
 }
 
 function backup_remote_ipfs {
-	echo -n ''
+	if ! grep -q "Admin user" $COMPLETION_FILE; then
+		return
+	fi
+	ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
+	if [ -d /home/$ADMIN_USERNAME/.ipfs ]; then
+		echo $"Backing up IPFS"
+		backup_directory_to_friend /home/$ADMIN_USERNAME/.ipfs ipfs
+		echo $"Backup of IPFS complete"
+	fi
 }
 
 function restore_remote_ipfs {
diff --git a/src/freedombone-backup-remote b/src/freedombone-backup-remote
index 629299db4..91c50fcc5 100755
--- a/src/freedombone-backup-remote
+++ b/src/freedombone-backup-remote
@@ -276,13 +276,6 @@ function backup_admin_readme {
 	fi
 }
 
-function backup_ipfs {
-	if [ -d /home/$ADMIN_USERNAME/.ipfs ]; then
-		echo $"Backing up IPFS"
-		backup_directory_to_friend /home/$ADMIN_USERNAME/.ipfs ipfs
-	fi
-}
-
 function backup_dlna {
 	if [ -d /var/cache/minidlna ]; then
 		echo $"Backing up DLNA cache"
@@ -463,7 +456,6 @@ if [[ $TEST_MODE == "no" ]]; then
 	backup_certs
 	backup_mailing_list
 
-	backup_ipfs
 	backup_dlna
 	backup_voip
 	backup_tox
-- 
GitLab