Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default database directory for package builds #223

Merged
merged 2 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# CHANGELOG

## 5.0.3 (2023-04-15)

* On 5.0.0 through 5.0.2, the default database directory was not being
correctly set for Debian and RPM package builds. The directory
`/usr/local/share/GeoIP` was being used rather than `/usr/share/GeoIP`.
This build restores `/usr/share/GeoIP` as the default directory for
these builds. Reported by Yvan. GitHub #222.

## 5.0.2 (2023-04-13)

* "Database ... up to date" messages are now only shown if the verbose
Expand Down
3 changes: 2 additions & 1 deletion cmd/geoipupdate/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"log"
"os"

"github.com/maxmind/geoipupdate/v5/pkg/geoipupdate/vars"
flag "github.com/spf13/pflag"
)

Expand All @@ -20,7 +21,7 @@ func getArgs() *Args {
configFile := flag.StringP(
"config-file",
"f",
defaultConfigFile,
vars.DefaultConfigFile,
"Configuration file",
)
databaseDirectory := flag.StringP(
Expand Down
15 changes: 11 additions & 4 deletions cmd/geoipupdate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,23 @@ import (
"github.com/maxmind/geoipupdate/v5/pkg/geoipupdate/vars"
)

// These values are set by build scripts. Changing the names of
// the variables should be considered a breaking change.
var (
version = "unknown"
defaultConfigFile string
version = "unknown"
defaultConfigFile string
defaultDatabaseDirectory string
)

func main() {
log.SetFlags(0)

if defaultConfigFile == "" {
defaultConfigFile = vars.DefaultConfigFile
if defaultConfigFile != "" {
vars.DefaultConfigFile = defaultConfigFile
}

if defaultDatabaseDirectory != "" {
vars.DefaultDatabaseDirectory = defaultDatabaseDirectory
}

args := getArgs()
Expand Down
2 changes: 1 addition & 1 deletion pkg/geoipupdate/vars/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
package vars

// Version defines current geoipupdate version.
const Version = "5.0.2"
const Version = "5.0.3"