From 0c7d808862f74f6f9de42521bc645ba092c4c1fb Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 22 Jul 2020 00:17:48 +0200 Subject: [PATCH 1/2] [GH-138] Snap only works if run from the home folder. --- CHANGELOG.md | 7 ++++++- cli/common.go | 10 ++++++++-- snap/snapcraft.yaml | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 962f513b..def32306 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] None +## [4.1.4] - 2020-07-21 +### Fixed +- Permission denied issue when creating backup zip in subdirectory + ## [4.1.3] - 2020-07-20 ### Added - Overwrite default zipFileName @@ -220,7 +224,8 @@ None ### Added - Download all artifacts from a certain Nexus3 repository. -[Unreleased]: https://github.com/030/n3dr/compare/4.1.3...HEAD +[Unreleased]: https://github.com/030/n3dr/compare/4.1.4...HEAD +[4.1.4]: https://github.com/030/n3dr/compare/4.1.3...4.1.4 [4.1.3]: https://github.com/030/n3dr/compare/4.1.2...4.1.3 [4.1.2]: https://github.com/030/n3dr/compare/4.1.1...4.1.2 [4.1.1]: https://github.com/030/n3dr/compare/4.1.0...4.1.1 diff --git a/cli/common.go b/cli/common.go index 631899c0..8e3c84ce 100644 --- a/cli/common.go +++ b/cli/common.go @@ -4,6 +4,7 @@ import ( "fmt" "io/ioutil" "net/http" + "os" "strconv" "time" @@ -98,11 +99,16 @@ func (n Nexus3) CreateZip(dir string) error { if n.ZipName == "" { n.ZipName = "n3dr-backup-" + time.Now().Format("01-02-2006T15-04-05") + ".zip" } - err := archiver.Archive([]string{dir}, n.ZipName) + cwd, err := os.Getwd() if err != nil { return err } - log.Infof("Zipfile: '%v' created", n.ZipName) + log.Warnf("Trying to create a zip file in: '%v'. Note that this could result in a 'permission denied' issue if N3DR has been installed using snap and is run in a different directory than your own home folder.", cwd) + err = archiver.Archive([]string{dir}, n.ZipName) + if err != nil { + return err + } + log.Infof("Zipfile: '%v' created in '%v'", n.ZipName, cwd) } return nil } diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 667b0210..ed94eb65 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,6 +1,6 @@ name: n3dr # you probably want to 'snapcraft register ' base: core18 # the base snap is the execution environment for this snap -version: '4.1.3' # just for humans, typically '1.2+git' or '1.3.2' +version: '4.1.4' # just for humans, typically '1.2+git' or '1.3.2' summary: Nexus3 Disaster Recovery # 79 char long summary description: | Download all artifacts at once or migrate automatically from Nexus to Nexus. From 0cf3e888cacfa2885e0ed3bdf8b5f685cb9ee2ff Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 22 Jul 2020 00:25:13 +0200 Subject: [PATCH 2/2] [GH-138] README updated. --- CHANGELOG.md | 4 ++-- README.md | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index def32306..bafb8640 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 None ## [4.1.4] - 2020-07-21 -### Fixed -- Permission denied issue when creating backup zip in subdirectory +### Added +- Warning that explains permission denied issue when running N3DR that was installed using snap ## [4.1.3] - 2020-07-20 ### Added diff --git a/README.md b/README.md index 6db4bc19..b429cf8f 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,10 @@ The aims of the n3dr tool are: snap install n3dr ``` +Note: one has to run n3dr from the home folder if this installation mode is +chosen. Otherwise a permission denied issue could occur, while creating the +backup zip. + ### MacOSX Get the darwin artifact from the releases tab.