瀏覽代碼

Remote restore for rss

Bob Mottram 9 年之前
父節點
當前提交
4875d2d7ed
共有 1 個文件被更改,包括 40 次插入0 次删除
  1. 40
    0
      src/freedombone-restore-remote

+ 40
- 0
src/freedombone-restore-remote 查看文件

@@ -125,6 +125,27 @@ function restore_database_from_friend {
125 125
         restore_directory_from_friend /root/temp${1} ${1}
126 126
         RESTORE_SUBDIR="var"
127 127
         if [ ${1} ]; then
128
+
129
+            # special handling of ttrss
130
+            if [[ ${2} == "ttrss" ]]; then
131
+                if [ -d /etc/share/${2} ]; then
132
+                    rm -rf /etc/share/${2}
133
+                    mv /root/temp${1}/etc/share/${2} /etc/share/
134
+                    if [ ! "$?" = "0" ]; then
135
+                        exit 639
136
+                    fi
137
+                    if [ -d /etc/letsencrypt/live/${2} ]; then
138
+                        ln -s /etc/letsencrypt/live/${2}/privkey.pem /etc/ssl/private/${2}.key
139
+                        ln -s /etc/letsencrypt/live/${2}/fullchain.pem /etc/ssl/certs/${2}.pem
140
+                    else
141
+                        # Ensure that the bundled SSL cert is being used
142
+                        if [ -f /etc/ssl/certs/${2}.bundle.crt ]; then
143
+                            sed -i "s|${2}.crt|${2}.bundle.crt|g" /etc/nginx/sites-available/${2}
144
+                        fi
145
+                    fi
146
+                fi
147
+            fi
148
+
128 149
             if [ -d /var/www/${2}/htdocs ]; then
129 150
                 if [ -d /root/temp${1}/${RESTORE_SUBDIR}/www/${2}/htdocs ]; then
130 151
                     rm -rf /var/www/${2}/htdocs
@@ -575,6 +596,24 @@ function restore_gnu_social {
575 596
     fi
576 597
 }
577 598
 
599
+function restore_rss_reader {
600
+    if [[ $RESTORE_APP != 'all' ]]; then
601
+        if [[ $RESTORE_APP != 'ttrss' ]]; then
602
+            return
603
+        fi
604
+    fi
605
+    if grep -q "RSS reader domain" $COMPLETION_FILE; then
606
+        RSS_READER_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "RSS reader domain" | awk -F ':' '{print $2}')
607
+        restore_database_from_friend ttrss ${RSS_READER_DOMAIN_NAME}
608
+        if [ -d $SERVER_DIRECTORY/backup/ttrss ]; then
609
+            chown -R www-data:www-data /etc/share/ttrss
610
+        fi
611
+        if [ -d /root/tempttrss ]; then
612
+            rm -rf /root/tempttrss
613
+        fi
614
+    fi
615
+}
616
+
578 617
 function restore_hubzilla {
579 618
     if [[ $RESTORE_APP != 'all' ]]; then
580 619
         if [[ $RESTORE_APP != 'hubzilla' ]]; then
@@ -886,6 +925,7 @@ restore_mailing_list
886 925
 restore_xmpp
887 926
 restore_gnu_social
888 927
 restore_hubzilla
928
+restore_rss_reader
889 929
 restore_owncloud
890 930
 restore_gogs
891 931
 restore_wiki