瀏覽代碼

Move remote gogs backup to app script

Bob Mottram 9 年之前
父節點
當前提交
ee157c9253
共有 2 個文件被更改,包括 36 次插入28 次删除
  1. 36
    2
      src/freedombone-app-gogs
  2. 0
    26
      src/freedombone-backup-remote

+ 36
- 2
src/freedombone-app-gogs 查看文件

@@ -38,7 +38,7 @@ GIT_ADMIN_PASSWORD=
38 38
 GOGS_COMMIT='3fb4f7f4980b4339fd9ef6a3ba5b0acab83d264d'
39 39
 
40 40
 function reconfigure_gogs {
41
-    echo -n ''
41
+	echo -n ''
42 42
 }
43 43
 
44 44
 function upgrade_gogs {
@@ -146,7 +146,41 @@ function restore_local_gogs {
146 146
 }
147 147
 
148 148
 function backup_remote_gogs {
149
-	echo -n ''
149
+	export GVM_ROOT=/home/git/gvm
150
+	if [ -d $GVM_ROOT/bin ]; then
151
+		cd $GVM_ROOT/bin
152
+		[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"
153
+		gvm use go${GO_VERSION} --default
154
+		systemctl set-environment GOPATH=$GOPATH
155
+	fi
156
+
157
+	if [ -d $GOPATH/src/github.com/gogits ]; then
158
+		GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Gogs domain" | awk -F ':' '{print $2}')
159
+		function_check suspend_site
160
+		suspend_site ${GIT_DOMAIN_NAME}
161
+
162
+		function_check backup_database_to_friend
163
+		backup_database_to_friend gogs
164
+
165
+		echo $"Obtaining Gogs settings backup"
166
+
167
+		function_check backup_directory_to_friend
168
+		backup_directory_to_friend $GOPATH/src/github.com/gogits/gogs/custom gogs
169
+
170
+		echo $"Obtaining Gogs repos backup"
171
+
172
+		mv /home/git/gogs-repositories/*.git /home/git/gogs-repositories/bob
173
+		backup_directory_to_friend /home/git/gogs-repositories gogsrepos
174
+
175
+		echo $"Obtaining Gogs authorized_keys backup"
176
+
177
+		backup_directory_to_friend /home/git/.ssh gogsssh
178
+
179
+		function_check restart_site
180
+		restart_site
181
+
182
+		echo $"Gogs backup complete"
183
+	fi
150 184
 }
151 185
 
152 186
 function restore_remote_gogs {

+ 0
- 26
src/freedombone-backup-remote 查看文件

@@ -244,31 +244,6 @@ function backup_tor {
244 244
 	fi
245 245
 }
246 246
 
247
-function backup_gogs {
248
-	export GVM_ROOT=/home/git/gvm
249
-	if [ -d $GVM_ROOT/bin ]; then
250
-		cd $GVM_ROOT/bin
251
-		[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"
252
-		gvm use go${GO_VERSION} --default
253
-		systemctl set-environment GOPATH=$GOPATH
254
-	fi
255
-
256
-	if [ -d $GOPATH/src/github.com/gogits ]; then
257
-		GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Gogs domain" | awk -F ':' '{print $2}')
258
-		suspend_site ${GIT_DOMAIN_NAME}
259
-		backup_database_to_friend gogs
260
-		backup_directory_to_friend /root/tempgogsdata gogsdata
261
-		echo $"Obtaining Gogs settings backup"
262
-		backup_directory_to_friend $GOPATH/src/github.com/gogits/gogs/custom gogs
263
-		echo $"Obtaining Gogs repos backup"
264
-		mv /home/git/gogs-repositories/*.git /home/git/gogs-repositories/bob
265
-		backup_directory_to_friend /home/git/gogs-repositories gogsrepos
266
-		echo $"Obtaining Gogs authorized_keys backup"
267
-		backup_directory_to_friend /home/git/.ssh gogsssh
268
-		restart_site
269
-	fi
270
-}
271
-
272 247
 function backup_wiki {
273 248
 	if [ -d /etc/dokuwiki ]; then
274 249
 		echo $"Backing up wiki"
@@ -514,7 +489,6 @@ if [[ $TEST_MODE == "no" ]]; then
514 489
 	backup_admin_readme
515 490
 	backup_mariadb
516 491
 
517
-	backup_gogs
518 492
 	backup_wiki
519 493
 	backup_blog
520 494
 	backup_certs