aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile7
-rw-r--r--avahi/pacdbserve.service.in (renamed from avahi/pacdbserve.service)2
-rw-r--r--pacredir.c10
4 files changed, 17 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index e21dcd7..2e6e296 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
*~
*.o
pacredir
+avahi/pacdbserve.service
README.html
diff --git a/Makefile b/Makefile
index 9487510..1bb8d07 100644
--- a/Makefile
+++ b/Makefile
@@ -4,23 +4,28 @@ CC := gcc
MD := markdown
INSTALL := install
RM := rm
+SED := sed
CFLAGS += -O2 -Wall -Werror
CFLAGS += $(shell pkg-config --libs --cflags libcurl)
CFLAGS += $(shell pkg-config --libs --cflags avahi-client)
CFLAGS += $(shell pkg-config --libs --cflags libmicrohttpd)
VERSION := $(shell git describe --tags --long 2>/dev/null)
+ARCH := $(shell uname -m)
# this is just a fallback in case you do not use git but downloaded
# a release tarball...
ifeq ($(VERSION),)
VERSION := 0.0.1
endif
-all: pacredir README.html
+all: pacredir pacdbserve README.html
pacredir: pacredir.c
$(CC) $(CFLAGS) -o pacredir pacredir.c \
-DVERSION="\"$(VERSION)\""
+pacdbserve: avahi/pacdbserve.service.in
+ $(SED) 's/%ARCH%/$(ARCH)/' avahi/pacdbserve.service.in > avahi/pacdbserve.service
+
README.html: README.md
$(MD) README.md > README.html
diff --git a/avahi/pacdbserve.service b/avahi/pacdbserve.service.in
index 38c8211..ee6a9bb 100644
--- a/avahi/pacdbserve.service
+++ b/avahi/pacdbserve.service.in
@@ -8,7 +8,7 @@
<name replace-wildcards="yes">%h</name>
<service>
- <type>_pacdbserve._tcp</type>
+ <type>_pacdbserve_%ARCH%._tcp</type>
<port>7079</port>
</service>
diff --git a/pacredir.c b/pacredir.c
index a55f143..7cc19f9 100644
--- a/pacredir.c
+++ b/pacredir.c
@@ -24,6 +24,14 @@
#include <curl/curl.h>
#include <microhttpd.h>
+#if defined __x86_64__
+# define ARCH "x86_64"
+#elif defined __i386__
+# define ARCH "i686"
+#else
+# error Unknown architecture!
+#endif
+
#define PAGE307 "<html><head><title>307 temporary redirect</title>" \
"</head><body>307 temporary redirect: " \
"<a href=\"%s\">%s</a></body></html>"
@@ -31,7 +39,7 @@
"</head><body>404 Not Found: %s</body></html>"
#define PORT 7077
#define PACSERVE "_pacserve._tcp"
-#define PACDBSERVE "_pacdbserve._tcp"
+#define PACDBSERVE "_pacdbserve_" ARCH "._tcp"
#define SYNCPATH "/var/lib/pacman/sync"
#define BADTIME 60 * 10