summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorkakwa <carpentier.pf@gmail.com>2015-11-28 15:08:50 +0100
committerkakwa <carpentier.pf@gmail.com>2015-11-28 15:08:50 +0100
commita59b1fcc21f35bafa16b65ac8c722e14d2dc925e (patch)
treebab394c3ad84f2cf4a0965e837c20afadd073312 /cmd
parentc5a9be91152de507ade9a98674d9eadfc6d1198b (diff)
downloadgitea-a59b1fcc21f35bafa16b65ac8c722e14d2dc925e.tar.gz
gitea-a59b1fcc21f35bafa16b65ac8c722e14d2dc925e.zip
Fix dump of log and custom directory in dump cmd
Now, the dump cmd uses setting.CustomPath and setting.LogRootPath instead of setting.WorkDir which was kind of broken if the gogs binary was in a different directory than gogs data. Additionally, the backup of setting.CustomPath directory is only done if it exists.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/dump.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/cmd/dump.go b/cmd/dump.go
index 0c07f36cf0..e8354784cf 100644
--- a/cmd/dump.go
+++ b/cmd/dump.go
@@ -68,17 +68,21 @@ func runDump(ctx *cli.Context) {
log.Fatalf("Fail to create %s: %v", fileName, err)
}
- workDir, _ := setting.WorkDir()
if err := z.AddFile("gogs-repo.zip", reposDump); err !=nil {
log.Fatalf("Fail to include gogs-repo.zip: %v", err)
}
if err := z.AddFile("gogs-db.sql", dbDump); err !=nil {
log.Fatalf("Fail to include gogs-db.sql: %v", err)
}
- if err := z.AddDir("custom", path.Join(workDir, "custom")); err !=nil {
- log.Fatalf("Fail to include custom: %v", err)
+ customDir, err := os.Stat(setting.CustomPath)
+ if err == nil && customDir.IsDir() {
+ if err := z.AddDir("custom", setting.CustomPath); err !=nil {
+ log.Fatalf("Fail to include custom: %v", err)
+ }
+ } else {
+ log.Printf("Custom dir %s doesn't exist, skipped", setting.CustomPath)
}
- if err := z.AddDir("log", path.Join(workDir, "log")); err !=nil {
+ if err := z.AddDir("log", setting.LogRootPath); err !=nil {
log.Fatalf("Fail to include log: %v", err)
}
// FIXME: SSH key file.