diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2018-03-06 14:11:53 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2018-03-06 14:15:57 +0100 |
commit | 44ceece354c50795ba04e450b9269e6e3f92dd34 (patch) | |
tree | b42200519bd20266990ac0db97b780e7de974129 | |
parent | b90d055be5dd30212ebd0c0a810a7f020df70321 (diff) |
geoip: store GeoIP files in $(PREFIX)/share by default
The /etc directory shouldn't contain non-human-readable files.
netsniff-ng (when called with the '-U' option) currently installs the
GeoIP database files to /etc/netsniff-ng by default.
Change this to install them to $(PREFIX)/share/netsniff-ng instead,
which is conformant to the FHS [1].
[1] https://wiki.debian.org/FilesystemHierarchyStandard
Also create the respective directory in the 'make install' target.
Fixes #187
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r-- | Cmds | 2 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | geoip.c | 18 |
3 files changed, 14 insertions, 9 deletions
@@ -37,6 +37,8 @@ endif INST = echo -e " INST\t$(1)" && install -d $(2) && \ install --mode=644 -DC $(1) $(2)/$(shell basename $(1)) +INSTD = echo -e " INSTD\t$(1)" && install -d $(1) + # Determine wheter origin of PREFIX is "file" or "command line" ifeq ("$(origin PREFIX)", "$(filter $(origin PREFIX), file command line)") INSTX = echo -e " INST\t$(1)" && install -d $(2) && \ @@ -36,6 +36,7 @@ SBINDIR = $(PREFIX)/sbin INCDIR = $(PREFIX)/include ETCDIR ?= $(CONFIG_ETCDIR) ETCDIRE = $(ETCDIR)/netsniff-ng +DATDIR = $(PREFIX)/share/netsniff-ng MAN8DIR = $(PREFIX)/share/man/man8 # Shut up make, helper warnings, parallel compilation! @@ -102,6 +103,7 @@ CFLAGS_MIN += -D_FILE_OFFSET_BITS=64 CFLAGS_MIN += -DVERSION_STRING=\"$(VERSION_STRING)\" CFLAGS_MIN += -DVERSION_LONG=\"$(VERSION_LONG)\" CFLAGS_MIN += -DETCDIRE_STRING=\"$(ETCDIRE)\" +CFLAGS_MIN += -DDATDIR_STRING=\"$(DATDIR)\" WFLAGS_DEF = -Wall @@ -170,6 +172,7 @@ mrproper: distclean install: install_all install_all: $(foreach tool,$(TOOLS),$(tool)_install) + $(Q)$(call INSTD,$(DATDIR)) install_allbutcurvetun: $(foreach tool,$(filter-out curvetun,$(TOOLS)),$(tool)_install) install_allbutmausezahn: $(foreach tool,$(filter-out mausezahn,$(TOOLS)),$(tool)_install) uninstall: $(foreach tool,$(TOOLS),$(tool)_uninstall) @@ -33,37 +33,37 @@ struct file { static const struct file files[] = { [GEOIP_CITY_EDITION_REV1] = { .desc = "City IPv4", - .local = ETCDIRE_STRING "/city4.dat", + .local = DATDIR_STRING "/city4.dat", .remote = "/GeoLiteCity.dat.gz", .possible_prefix = PRE, }, [GEOIP_CITY_EDITION_REV1_V6] = { .desc = "City IPv6", - .local = ETCDIRE_STRING "/city6.dat", + .local = DATDIR_STRING "/city6.dat", .remote = "/GeoLiteCityv6.dat.gz", .possible_prefix = PRE "/GeoLiteCityv6-beta", }, [GEOIP_COUNTRY_EDITION] = { .desc = "Country IPv4", - .local = ETCDIRE_STRING "/country4.dat", + .local = DATDIR_STRING "/country4.dat", .remote = "/GeoIP.dat.gz", .possible_prefix = PRE "/GeoLiteCountry", }, [GEOIP_COUNTRY_EDITION_V6] = { .desc = "Country IPv6", - .local = ETCDIRE_STRING "/country6.dat", + .local = DATDIR_STRING "/country6.dat", .remote = "/GeoIPv6.dat.gz", .possible_prefix = PRE, }, [GEOIP_ASNUM_EDITION] = { .desc = "AS Numbers IPv4", - .local = ETCDIRE_STRING "/asname4.dat", + .local = DATDIR_STRING "/asname4.dat", .remote = "/GeoIPASNum.dat.gz", .possible_prefix = PRE "/asnum", }, [GEOIP_ASNUM_EDITION_V6] = { .desc = "AS Numbers IPv6", - .local = ETCDIRE_STRING "/asname6.dat", + .local = DATDIR_STRING "/asname6.dat", .remote = "/GeoIPASNumv6.dat.gz", .possible_prefix = PRE "/asnum", }, @@ -627,19 +627,19 @@ static void init_mirrors(void) if (!fp) panic("Cannot open geoip.conf!\n"); - fmemset(buff, 0, sizeof(buff)); + memset(buff, 0, sizeof(buff)); while (fgets(buff, sizeof(buff), fp) != NULL && i < array_size(servers)) { buff[sizeof(buff) - 1] = 0; buff[strlen(buff) - 1] = 0; if (buff[0] == '#') { - fmemset(buff, 0, sizeof(buff)); + memset(buff, 0, sizeof(buff)); continue; } servers[i++] = xstrdup(buff); - fmemset(buff, 0, sizeof(buff)); + memset(buff, 0, sizeof(buff)); } fclose(fp); |