From cdbb05bf6a2864077f905cb96353e83f5b2b9ea8 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Sat, 13 May 2017 12:30:08 +0200 Subject: add distribution ID to avahi service names Now that we have pacredir in official repositories... ArchLinux ARM will have the package as well, having package names (at least for 'any') clash. So add distribution ID to avahi service names. This is incompatible with pacredir < 0.2.3, so make sure to update all your installations. --- .gitignore | 1 + Makefile | 18 ++++++++++++------ avahi/pacdbserve.service.in | 2 +- avahi/pacserve.service | 15 --------------- avahi/pacserve.service.in | 15 +++++++++++++++ config.def.h | 4 ++-- 6 files changed, 31 insertions(+), 24 deletions(-) delete mode 100644 avahi/pacserve.service create mode 100644 avahi/pacserve.service.in diff --git a/.gitignore b/.gitignore index ff8db53..5e671cb 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ arch pacredir config.h avahi/pacdbserve.service +avahi/pacserve.service README.html version.h pacredir-*.tar.xz diff --git a/Makefile b/Makefile index b0f5870..800d0b8 100644 --- a/Makefile +++ b/Makefile @@ -21,17 +21,20 @@ CFLAGS_EXTRA += $(shell pkg-config --libs --cflags libmicrohttpd) CFLAGS_EXTRA += -liniparser LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie +# the distribution ID +ID := $(shell grep 'ID=' < /etc/os-release | cut -d= -f2) + # this is just a fallback in case you do not use git but downloaded # a release tarball... VERSION := 0.2.2 -all: pacredir avahi/pacdbserve.service README.html +all: pacredir avahi/pacdbserve.service avahi/pacserve.service README.html arch: arch.c arch.h $(CC) $(CFLAGS) $(LDFLAGS) -o arch arch.c pacredir: pacredir.c arch.h pacredir.h config.h version.h - $(CC) $(CFLAGS) $(CFLAGS_EXTRA) $(LDFLAGS) -o pacredir pacredir.c + $(CC) $(CFLAGS) $(CFLAGS_EXTRA) $(LDFLAGS) -DID=\"$(ID)\" -o pacredir pacredir.c config.h: $(CP) config.def.h config.h @@ -42,14 +45,17 @@ version.h: $(wildcard .git/HEAD .git/index .git/refs/tags/*) Makefile echo "#endif" >> $@ avahi/pacdbserve.service: arch avahi/pacdbserve.service.in - $(SED) 's/%ARCH%/$(shell ./arch)/' avahi/pacdbserve.service.in > avahi/pacdbserve.service + $(SED) 's/%ARCH%/$(shell ./arch)/;s/%ID%/$(ID)/' avahi/pacdbserve.service.in > avahi/pacdbserve.service + +avahi/pacserve.service: avahi/pacserve.service.in + $(SED) 's/%ID%/$(ID)/' avahi/pacserve.service.in > avahi/pacserve.service README.html: README.md $(MD) README.md > README.html install: install-bin install-doc -install-bin: pacredir +install-bin: pacredir avahi/pacdbserve.service avahi/pacserve.service $(INSTALL) -D -m0755 pacredir $(DESTDIR)$(PREFIX)/bin/pacredir $(LN) -s darkhttpd $(DESTDIR)$(PREFIX)/bin/pacserve $(LN) -s darkhttpd $(DESTDIR)$(PREFIX)/bin/pacdbserve @@ -70,10 +76,10 @@ install-doc: README.html $(INSTALL) -D -m0644 README.html $(DESTDIR)$(PREFIX)/share/doc/pacredir/README.html clean: - $(RM) -f *.o *~ arch pacredir avahi/pacdbserve.service README.html version.h + $(RM) -f *.o *~ arch pacredir avahi/pacdbserve.service avahi/pacserve.service README.html version.h distclean: - $(RM) -f *.o *~ arch pacredir avahi/pacdbserve.service README.html version.h config.h + $(RM) -f *.o *~ arch pacredir avahi/pacdbserve.service avahi/pacserve.service README.html version.h config.h release: git archive --format=tar.xz --prefix=pacredir-$(VERSION)/ $(VERSION) > pacredir-$(VERSION).tar.xz diff --git a/avahi/pacdbserve.service.in b/avahi/pacdbserve.service.in index ee6a9bb..106bc28 100644 --- a/avahi/pacdbserve.service.in +++ b/avahi/pacdbserve.service.in @@ -8,7 +8,7 @@ %h - _pacdbserve_%ARCH%._tcp + _pacdbserve_%ID%_%ARCH%._tcp 7079 diff --git a/avahi/pacserve.service b/avahi/pacserve.service deleted file mode 100644 index 568d08d..0000000 --- a/avahi/pacserve.service +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - %h - - - _pacserve._tcp - 7078 - - - diff --git a/avahi/pacserve.service.in b/avahi/pacserve.service.in new file mode 100644 index 0000000..2da20f7 --- /dev/null +++ b/avahi/pacserve.service.in @@ -0,0 +1,15 @@ + + + + + + + + %h + + + _pacserve_%ID%._tcp + 7078 + + + diff --git a/config.def.h b/config.def.h index 3a08859..fd31880 100644 --- a/config.def.h +++ b/config.def.h @@ -24,8 +24,8 @@ #define PORT_PACDBSERVE 7079 /* avahi service names */ -#define PACSERVE "_pacserve._tcp" -#define PACDBSERVE "_pacdbserve_" ARCH "._tcp" +#define PACSERVE "_pacserve_" ID "._tcp" +#define PACDBSERVE "_pacdbserve_" ID "_" ARCH "._tcp" /* path to the config file */ #define CONFIGFILE "/etc/pacredir.conf" -- cgit v1.2.3-70-g09d2