From 7582b0e5067d7b408dd25d53628e5822aaa3116d Mon Sep 17 00:00:00 2001 From: Ville Kallioniemi Date: Fri, 30 Dec 2011 23:22:48 -0700 Subject: [PATCH 1/3] Mac install target for the upnp daemon was trying to install files that don't exist and launchd config file had hardcoded paths. * commented out code that was trying to install files/scripts that don't exist * added a make target for generating launchd config file with accurate install paths * enabled installing man page --- miniupnpd/Makefile.macosx | 15 +++++++++------ ...plist => org.tuxfamily.miniupnpd.plist.before} | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) rename miniupnpd/mac/{org.tuxfamily.miniupnpd.plist => org.tuxfamily.miniupnpd.plist.before} (75%) diff --git a/miniupnpd/Makefile.macosx b/miniupnpd/Makefile.macosx index 57e901b..caa716e 100644 --- a/miniupnpd/Makefile.macosx +++ b/miniupnpd/Makefile.macosx @@ -47,8 +47,8 @@ LIBS = INSTALL_BINDIR = $(PREFIX)/sbin INSTALL_ETCDIR = $(PREFIX)/etc/miniupnpd -# INSTALL_MANDIR = $(PREFIX)/man -INSTALL_MANDIR = /usr/share/man/man1 +INSTALL_MANDIR = $(PREFIX)/man/man1 +#INSTALL_MANDIR = /usr/share/man/man1 all: $(EXECUTABLES) @@ -57,19 +57,19 @@ clean: testupnpdescgen.o testgetifstats.o testupnppermissions.o \ miniupnpdctl.o testgetifaddr.o config.h -install: miniupnpd genuuid +install: miniupnpd genuuid genlaunchd $(STRIP) miniupnpd $(INSTALL) -d $(INSTALL_BINDIR) $(INSTALL) miniupnpd $(INSTALL_BINDIR) $(INSTALL) -d $(INSTALL_ETCDIR) - $(INSTALL) ipfw/ipfw_init.sh $(INSTALL_ETCDIR) - $(INSTALL) ipfw/ipfw_removeall.sh $(INSTALL_ETCDIR) - $(INSTALL) --mode=0644 -b miniupnpd.conf $(INSTALL_ETCDIR) + $(INSTALL) -m 0644 -b miniupnpd.conf $(INSTALL_ETCDIR) $(INSTALL) -d $(INSTALL_MANDIR) $(INSTALL) miniupnpd.1 $(INSTALL_MANDIR) # TODO Fix these paths and those within the plist $(INSTALL) -d $(PREFIX)/Library/LaunchDaemons $(INSTALL) mac/org.tuxfamily.miniupnpd.plist $(PREFIX)/Library/LaunchDaemons + #$(INSTALL) ipfw/ipfw_init.sh $(INSTALL_ETCDIR) + #$(INSTALL) ipfw/ipfw_removeall.sh $(INSTALL_ETCDIR) # genuuid is using the uuid cli tool available under MacOSX UUID != if which uuidgen 2>&1 > /dev/null; then \ @@ -84,6 +84,9 @@ genuuid: sed -e "s/^uuid=[-0-9a-f]*/uuid=$(UUID)/" miniupnpd.conf.before > miniupnpd.conf $(RM) miniupnpd.conf.before +genlaunchd: + sed -e "s|INSTALLPREFIX|$(PREFIX)|g" mac/org.tuxfamily.miniupnpd.plist.before > mac/org.tuxfamily.miniupnpd.plist + depend: config.h mkdep $(ALL_OBJS:.o=.c) testupnpdescgen.c testgetifstats.c \ testupnppermissions.c miniupnpdctl.c testgetifaddr.c diff --git a/miniupnpd/mac/org.tuxfamily.miniupnpd.plist b/miniupnpd/mac/org.tuxfamily.miniupnpd.plist.before similarity index 75% rename from miniupnpd/mac/org.tuxfamily.miniupnpd.plist rename to miniupnpd/mac/org.tuxfamily.miniupnpd.plist.before index 0922d40..ed6e81f 100644 --- a/miniupnpd/mac/org.tuxfamily.miniupnpd.plist +++ b/miniupnpd/mac/org.tuxfamily.miniupnpd.plist.before @@ -7,8 +7,8 @@ org.tuxfamily.miniupnpd ProgramArguments - /usr/sbin/miniupnpd - -f /etc/miniupnpd/miniupnpd.conf + INSTALLPREFIX/sbin/miniupnpd + -f INSTALLPREFIX/etc/miniupnpd/miniupnpd.conf RunAtLoad From e8c488f9e17ec1eae425ceca3612b4d954b506ee Mon Sep 17 00:00:00 2001 From: Ville Kallioniemi Date: Sat, 31 Dec 2011 01:12:39 -0700 Subject: [PATCH 2/3] UUID generation for the default config file was not working on the mac. Man page was getting installed to the the wrong location. * change to always use uuidgen (available on all osx releases) * fix regex to match uuidgen's uuid format which contains capital letters * fix mac man page install directory * make mac clean target delete the generated launchd config file --- miniupnpd/Makefile.macosx | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/miniupnpd/Makefile.macosx b/miniupnpd/Makefile.macosx index caa716e..9979d27 100644 --- a/miniupnpd/Makefile.macosx +++ b/miniupnpd/Makefile.macosx @@ -47,15 +47,15 @@ LIBS = INSTALL_BINDIR = $(PREFIX)/sbin INSTALL_ETCDIR = $(PREFIX)/etc/miniupnpd -INSTALL_MANDIR = $(PREFIX)/man/man1 -#INSTALL_MANDIR = /usr/share/man/man1 +INSTALL_MANDIR = $(PREFIX)/share/man/man1 all: $(EXECUTABLES) clean: $(RM) $(ALL_OBJS) $(EXECUTABLES) \ testupnpdescgen.o testgetifstats.o testupnppermissions.o \ - miniupnpdctl.o testgetifaddr.o config.h + miniupnpdctl.o testgetifaddr.o config.h \ + mac/org.tuxfamily.miniupnpd.plist install: miniupnpd genuuid genlaunchd $(STRIP) miniupnpd @@ -65,23 +65,14 @@ install: miniupnpd genuuid genlaunchd $(INSTALL) -m 0644 -b miniupnpd.conf $(INSTALL_ETCDIR) $(INSTALL) -d $(INSTALL_MANDIR) $(INSTALL) miniupnpd.1 $(INSTALL_MANDIR) - # TODO Fix these paths and those within the plist $(INSTALL) -d $(PREFIX)/Library/LaunchDaemons $(INSTALL) mac/org.tuxfamily.miniupnpd.plist $(PREFIX)/Library/LaunchDaemons #$(INSTALL) ipfw/ipfw_init.sh $(INSTALL_ETCDIR) #$(INSTALL) ipfw/ipfw_removeall.sh $(INSTALL_ETCDIR) -# genuuid is using the uuid cli tool available under MacOSX -UUID != if which uuidgen 2>&1 > /dev/null; then \ - echo `uuidgen` ; \ - elif which uuid 2>&1 > /dev/null; then \ - echo `uuid` ; \ - else echo "00000000-0000-0000-0000-000000000000"; \ - fi - genuuid: $(MV) miniupnpd.conf miniupnpd.conf.before - sed -e "s/^uuid=[-0-9a-f]*/uuid=$(UUID)/" miniupnpd.conf.before > miniupnpd.conf + sed -e "s/^uuid=[-0-9a-fA-F]*/uuid=`uuidgen 2>/dev/null`/" miniupnpd.conf.before > miniupnpd.conf $(RM) miniupnpd.conf.before genlaunchd: From f9549e86b186627388f5f06b4108048c44ac8b42 Mon Sep 17 00:00:00 2001 From: Ville Kallioniemi Date: Sat, 31 Dec 2011 12:06:17 -0700 Subject: [PATCH 3/3] Man page and mac installation fixes. * fix minissdpd man page not getting installed * fix miniupnpc man page wasn't installed * fix minissdpd attempted to install init.d file on mac --- minissdpd/Makefile | 7 +++++++ miniupnpc/Makefile | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/minissdpd/Makefile b/minissdpd/Makefile index a897b89..be62850 100644 --- a/minissdpd/Makefile +++ b/minissdpd/Makefile @@ -16,6 +16,7 @@ CFLAGS = -Wall -Os -D_GNU_SOURCE -fno-strict-aliasing -Wstrict-prototypes CC = gcc RM = rm -f INSTALL = install +OS = $(shell uname -s) #EXECUTABLES = minissdpd testminissdpd listifaces EXECUTABLES = minissdpd testminissdpd testcodelength @@ -26,6 +27,8 @@ ALLOBJS = $(MINISSDPDOBJS) $(TESTMINISSDPDOBJS) testcodelength.o INSTALLPREFIX ?= $(PREFIX)/usr SBININSTALLDIR = $(INSTALLPREFIX)/sbin +MANINSTALLDIR = $(INSTALLPREFIX)/share/man + .PHONY: all clean install depend @@ -37,8 +40,12 @@ clean: install: minissdpd $(INSTALL) -d $(SBININSTALLDIR) $(INSTALL) minissdpd $(SBININSTALLDIR) + $(INSTALL) -d $(MANINSTALLDIR)/man1 + $(INSTALL) minissdpd.1 $(MANINSTALLDIR)/man1/minissdpd.1 +ifneq ($(OS), Darwin) $(INSTALL) -d $(PREFIX)/etc/init.d $(INSTALL) minissdpd.init.d.script $(PREFIX)/etc/init.d/minissdpd +endif minissdpd: $(MINISSDPDOBJS) $(CC) $(CFLAGS) -o $@ $(MINISSDPDOBJS) diff --git a/miniupnpc/Makefile b/miniupnpc/Makefile index 2f46e6d..ba49234 100644 --- a/miniupnpc/Makefile +++ b/miniupnpc/Makefile @@ -85,6 +85,7 @@ INSTALLPREFIX ?= $(PREFIX)/usr INSTALLDIRINC = $(INSTALLPREFIX)/include/miniupnpc INSTALLDIRLIB = $(INSTALLPREFIX)/lib INSTALLDIRBIN = $(INSTALLPREFIX)/bin +INSTALLDIRMAN = $(INSTALLPREFIX)/share/man FILESTOINSTALL = $(LIBRARY) $(EXECUTABLES) ifneq ($(OS), AmigaOS) @@ -142,6 +143,11 @@ else $(INSTALL) -m 755 upnpc-shared $(INSTALLDIRBIN)/upnpc endif $(INSTALL) -m 755 external-ip.sh $(INSTALLDIRBIN)/external-ip +ifneq ($(OS), AmigaOS) + $(INSTALL) -d $(INSTALLDIRMAN)/man3 + $(INSTALL) man3/miniupnpc.3 $(INSTALLDIRMAN)/man3/miniupnpc.3 +endif + cleaninstall: $(RM) -r $(INSTALLDIRINC)