diff --git a/cmd/root.go b/cmd/root.go index 101a8ce..da9f4f9 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -337,6 +337,10 @@ func Execute() error { // Configures the global logger for Zap so that we can call it from any location // in the code without having to pass around a logger instance. func configureLogging(logDir string, debug bool) error { + if err := os.MkdirAll(path.Join(logDir, "/install"), 0700); err != nil { + return errors.WithStack(err) + } + cfg := zap.NewProductionConfig() if debug { cfg = zap.NewDevelopmentConfig() diff --git a/config/config_system.go b/config/config_system.go index 3fec067..f946e6c 100644 --- a/config/config_system.go +++ b/config/config_system.go @@ -49,11 +49,6 @@ func (sc *SystemConfiguration) ConfigureDirectories() error { return err } - log.WithField("path", sc.LogDirectory).Debug("ensuring log directory exists") - if err := os.MkdirAll(path.Join(sc.LogDirectory, "/install"), 0700); err != nil { - return err - } - log.WithField("path", sc.Data).Debug("ensuring server data directory exists") if err := os.MkdirAll(sc.Data, 0700); err != nil { return err diff --git a/server/filesystem.go b/server/filesystem.go index e088aaf..0cb6803 100644 --- a/server/filesystem.go +++ b/server/filesystem.go @@ -574,7 +574,8 @@ func (fs *Filesystem) Copy(p string) error { } defer dest.Close() - if _, err := io.Copy(dest, source); err != nil { + buf := make([]byte, 1024*4) + if _, err := io.CopyBuffer(dest, source, buf); err != nil { return errors.WithStack(err) }