瀏覽代碼

Move remote blog backup to app script

Bob Mottram 9 年之前
父節點
當前提交
84db3b4037
共有 2 個文件被更改,包括 14 次插入17 次删除
  1. 13
    2
      src/freedombone-app-blog
  2. 1
    15
      src/freedombone-backup-remote

+ 13
- 2
src/freedombone-app-blog 查看文件

@@ -39,7 +39,7 @@ MY_BLOG_TITLE="My Blog"
39 39
 MY_BLOG_SUBTITLE="Another ${PROJECT_NAME} Blog"
40 40
 
41 41
 function reconfigure_blog {
42
-    echo -n ''
42
+	echo -n ''
43 43
 }
44 44
 
45 45
 function upgrade_blog {
@@ -121,7 +121,18 @@ function restore_local_blog {
121 121
 }
122 122
 
123 123
 function backup_remote_blog {
124
-	echo -n ''
124
+	if grep -q "Blog domain" $COMPLETION_FILE; then
125
+		FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
126
+		temp_backup_dir=/var/www/${FULLBLOG_DOMAIN_NAME}/htdocs
127
+		if [ -d $temp_backup_dir ]; then
128
+			echo $"Backing up blog"
129
+			backup_directory_to_friend $temp_backup_dir blog
130
+			echo $"Backup of blog complete"
131
+		else
132
+			echo $"Blog domain specified but not found in $temp_backup_dir"
133
+			exit 2578
134
+		fi
135
+	fi
125 136
 }
126 137
 
127 138
 function restore_remote_blog {

+ 1
- 15
src/freedombone-backup-remote 查看文件

@@ -244,19 +244,6 @@ function backup_tor {
244 244
 	fi
245 245
 }
246 246
 
247
-function backup_blog {
248
-	if grep -q "Blog domain" $COMPLETION_FILE; then
249
-		FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
250
-		if [ -d /var/www/${FULLBLOG_DOMAIN_NAME} ]; then
251
-			echo $"Backing up blog"
252
-			backup_directory_to_friend /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs blog
253
-		else
254
-			echo $"Blog domain specified but not found in /var/www/${FULLBLOG_DOMAIN_NAME}"
255
-			exit 2578
256
-		fi
257
-	fi
258
-}
259
-
260 247
 function backup_certs {
261 248
 	if [ -d /etc/ssl ]; then
262 249
 		echo $"Backing up certificates"
@@ -480,10 +467,9 @@ if [[ $TEST_MODE == "no" ]]; then
480 467
 	backup_web_server
481 468
 	backup_admin_readme
482 469
 	backup_mariadb
483
-
484
-	backup_blog
485 470
 	backup_certs
486 471
 	backup_mailing_list
472
+
487 473
 	backup_xmpp
488 474
 	backup_ipfs
489 475
 	backup_dlna