From e2ad22bd2de3b47b7da089bfbbd9eb679c43ac81 Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@robotics.uk.to>
Date: Sat, 9 Jul 2016 10:33:56 +0100
Subject: [PATCH] Move rss local restore to app script

---
 src/freedombone-app-rss       | 23 +++++++++++++++++++++++
 src/freedombone-restore-local | 18 ------------------
 2 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/src/freedombone-app-rss b/src/freedombone-app-rss
index e3f26ab52..8b8dcba11 100755
--- a/src/freedombone-app-rss
+++ b/src/freedombone-app-rss
@@ -97,10 +97,33 @@ function backup_local_rss {
 	fi
 }
 
+function restore_local_rss {
+	if ! grep -q "RSS reader domain" $COMPLETION_FILE; then
+		return
+	fi
+	RSS_READER_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "RSS reader domain" | awk -F ':' '{print $2}')
+	if [ $RSS_READER_DOMAIN_NAME ]; then
+		echo $"Restoring ttrss"
+		temp_restore_dir=/root/tempttrss
+		restore_database ttrss ${RSS_READER_DOMAIN_NAME}
+		if [ -d $USB_MOUNT/backup/ttrss ]; then
+			chown -R www-data:www-data /etc/share/tt-rss
+			if [ -d $temp_restore_dir ]; then
+				rm -rf $temp_restore_dir
+			fi
+		fi
+		echo $"Restore of ttrss complete"
+	fi
+}
+
 function backup_remote_rss {
 	echo -n ''
 }
 
+function restore_remote_rss {
+	echo -n ''
+}
+
 function remove_rss {
 	if ! grep -Fxq "install_rss" $COMPLETION_FILE; then
 		return
diff --git a/src/freedombone-restore-local b/src/freedombone-restore-local
index 104ef20fe..23bd65556 100755
--- a/src/freedombone-restore-local
+++ b/src/freedombone-restore-local
@@ -840,23 +840,6 @@ function restore_gnusocial {
     fi
 }
 
-function restore_rss {
-    if [[ $RESTORE_APP != 'all' ]]; then
-        if [[ $RESTORE_APP != 'ttrss' ]]; then
-            return
-        fi
-    fi
-    if [ $RSS_READER_DOMAIN_NAME ]; then
-        restore_database ttrss ${RSS_READER_DOMAIN_NAME}
-        if [ -d $USB_MOUNT/backup/ttrss ]; then
-            chown -R www-data:www-data /etc/share/tt-rss
-            if [ -d /root/tempttrss ]; then
-                rm -rf /root/tempttrss
-            fi
-        fi
-    fi
-}
-
 function restore_hubzilla {
     if [[ $RESTORE_APP != 'all' ]]; then
         if [[ $RESTORE_APP != 'hubzilla' ]]; then
@@ -969,7 +952,6 @@ restore_ipfs
 restore_xmpp
 restore_gnusocial
 restore_hubzilla
-restore_rss
 
 restore_email
 restore_apps
-- 
GitLab