Skip to content

Commit

Permalink
Merge pull request #11 from jasperla/ETC_var
Browse files Browse the repository at this point in the history
make the path to vnstat.conf variable
  • Loading branch information
vergoh committed Jan 5, 2015
2 parents 131f639 + e4b9c27 commit 668bc16
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
BIN ?= $(DESTDIR)/usr/bin
SBIN ?= $(DESTDIR)/usr/sbin
MAN ?= $(DESTDIR)/usr/share/man
ETC ?= $(DESTDIR)/etc/

# bin and man dirs for *BSD
BIN_BSD ?= $(DESTDIR)/usr/local/bin
SBIN_BSD ?= $(DESTDIR)/usr/local/sbin
MAN_BSD ?= $(DESTDIR)/usr/local/man
ETC_BSD ?= $(DESTDIR)/etc

.PHONY: vnstat tests check all clean debug install uninstall bsdinstall bsduninstall dist

Expand Down Expand Up @@ -58,10 +60,10 @@ install:
fi

# install default config if such doesn't exist
@if [ ! -f "$(DESTDIR)/etc/vnstat.conf" ]; \
then echo "Installing config to $(DESTDIR)/etc/vnstat.conf"; \
install -d -m 755 $(DESTDIR)/etc; \
install -m 644 cfg/vnstat.conf $(DESTDIR)/etc/vnstat.conf; \
@if [ ! -f "$(ETC)/vnstat.conf" ]; \
then echo "Installing config to $(ETC)/vnstat.conf"; \
install -d -m 755 $(ETC); \
install -m 644 cfg/vnstat.conf $(ETC)/vnstat.conf; \
fi

# install everything else
Expand Down Expand Up @@ -118,7 +120,7 @@ uninstall:
rm -f $(MAN)/man1/vnstat*
rm -f $(MAN)/man5/vnstat*
rm -f $(DESTDIR)/etc/cron.d/vnstat
rm -f $(DESTDIR)/etc/vnstat.conf
rm -f $(ETC)/vnstat.conf
rm -f $(DESTDIR)/etc/ppp/ip-up.d/vnstat
rm -f $(DESTDIR)/etc/ppp/ip-down.d/vnstat

Expand Down Expand Up @@ -148,12 +150,12 @@ bsdinstall:
fi

# install default config if such doesn't exist
@if [ ! -f "$(DESTDIR)/etc/vnstat.conf" ]; \
then echo "Installing config to $(DESTDIR)/etc/vnstat.conf"; \
install -d -m 755 $(DESTDIR)/etc; \
install -m 644 cfg/vnstat.conf $(DESTDIR)/etc/vnstat.conf; \
sed -e 's/lib/db/g' $(DESTDIR)/etc/vnstat.conf >$(DESTDIR)/etc/vnstat.conf.bsd; \
mv -f $(DESTDIR)/etc/vnstat.conf.bsd $(DESTDIR)/etc/vnstat.conf; \
@if [ ! -f "$(ETC_BSD)/vnstat.conf" ]; \
then echo "Installing config to $(ETC_BSD)/vnstat.conf"; \
install -d -m 755 $(ETC_BSD); \
install -m 644 cfg/vnstat.conf $(ETC_BSD)/vnstat.conf; \
sed -e 's/lib/db/g' $(ETC_BSD)/vnstat.conf >$(ETC_BSD)/vnstat.conf.bsd; \
mv -f $(ETC_BSD)/vnstat.conf.bsd $(ETC_BSD)/vnstat.conf; \
fi

# update man page
Expand Down Expand Up @@ -196,7 +198,7 @@ bsduninstall:
rm -f $(SBIN_BSD)/vnstatd
rm -f $(MAN_BSD)/man1/vnstat*
rm -f $(MAN_BSD)/man5/vnstat*
rm -f $(DESTDIR)/etc/vnstat.conf
rm -f $(ETC_BSD)/vnstat.conf
@echo "A possible cron entry needs to be removed manually if such exists."

dist: clean
Expand Down

0 comments on commit 668bc16

Please sign in to comment.