From 01f25f5ecb2b627d44312eb49b5d96c06aef32bd Mon Sep 17 00:00:00 2001 From: Albert Hopkins Date: Wed, 5 Dec 2018 17:06:13 -0800 Subject: [PATCH] airport: cleanups This change makes the Makefile a little more efficient and removes support for avahi (I never use it). --- appliances/airport/Makefile | 31 ++++++++++++++++-------------- appliances/airport/airport.service | 7 ------- appliances/airport/make.conf | 1 + 3 files changed, 18 insertions(+), 21 deletions(-) delete mode 100644 appliances/airport/airport.service diff --git a/appliances/airport/Makefile b/appliances/airport/Makefile index bc75cc7..d2d572b 100644 --- a/appliances/airport/Makefile +++ b/appliances/airport/Makefile @@ -2,11 +2,24 @@ APP_ROOT := /var/lib/airport AIRPORT_REPO ?= https://bitbucket.org/marduk/airport AIRPORT_BRANCH ?= stable PGVER := 10 +repo := $(CHROOT)/$(APP_ROOT) +etc_issue := $(CHROOT)/etc/issue +services := $(wildcard *.service) +service_targets := $(patsubst %,$(CHROOT)/etc/systemd/system/%,$(services)) + +$(CHROOT)/etc/systemd/system/%.service: %.service + cp $< $@ + RUN systemctl enable $< + +$(etc_issue): issue + cp $< $@ + +$(repo): + hg clone -u $(AIRPORT_BRANCH) $(AIRPORT_REPO) $@ preinstall: - -postinstall: airport.service settings.py issue nginx.conf airport-pre.service airport-gameserver.service airport-wsgi.service +postinstall: settings.py issue nginx.conf $(service_targets) $(repo) $(etc_issue) RUN eselect postgresql set $(PGVER) rm -rf $(CHROOT)/var/lib/postgresql/$(PGVER) RUN bash -c "echo y |$(EMERGE) --config postgresql:$(PGVER)" @@ -15,8 +28,8 @@ postinstall: airport.service settings.py issue nginx.conf airport-pre.service ai rm -rf $(CHROOT)/$(APP_ROOT) hg clone -u $(AIRPORT_BRANCH) $(AIRPORT_REPO) $(CHROOT)/$(APP_ROOT) chroot $(CHROOT) virtualenv -p /usr/bin/python3 $(APP_ROOT) - RUN bash -c ". $(APP_ROOT)/bin/activate ; pip install -r $(APP_ROOT)/requirements.txt" - RUN bash -c ". $(APP_ROOT)/bin/activate ; pip install psycopg2 uwsgi" + RUN $(APP_ROOT)/bin/pip install -r $(APP_ROOT)/requirements.txt + RUN $(APP_ROOT)/bin/pip install psycopg2 uwsgi COPY settings.py /$(APP_ROOT)/djangoproject/djangoproject RUN id -u airport >/dev/null || RUN useradd -d $(APP_ROOT) -M -U -G postgres airport RUN chown -R airport:airport $(APP_ROOT) @@ -25,20 +38,10 @@ ifdef AIRPORT_SERIES RUN cp /$(APP_ROOT)/djangoproject/airport/fixtures/$(AIRPORT_SERIES).json \ /$(APP_ROOT)/djangoproject/airport/fixtures/initial_data.json endif - COPY issue /etc/issue - COPY -u airport-pre.service /etc/systemd/system/airport-pre.service - COPY -u airport-wsgi.service /etc/systemd/system/airport-wsgi.service - COPY -u airport-gameserver.service /etc/systemd/system/airport-gameserver.service $(M4) -D HOSTNAME=$(HOSTNAME) nginx.conf > $(CHROOT)/etc/nginx/nginx.conf RUN gpasswd -a nginx airport RUN systemctl enable airport-wsgi.service RUN systemctl enable airport-gameserver.service -ifeq ($(AVAHI),YES) - RUN $(EMERGE) --noreplace $(USEPKG) net-dns/avahi - RUN rm -f /etc/avahi/services/* - COPY airport.service /etc/avahi/services - RUN systemctl enable avahi-daemon -endif RUN $(EMERGE) --depclean --with-bdeps=n diff --git a/appliances/airport/airport.service b/appliances/airport/airport.service deleted file mode 100644 index 5c8a5ee..0000000 --- a/appliances/airport/airport.service +++ /dev/null @@ -1,7 +0,0 @@ - - Airport - - _http._tcp - 80 - - diff --git a/appliances/airport/make.conf b/appliances/airport/make.conf index bccd359..1333e47 100644 --- a/appliances/airport/make.conf +++ b/appliances/airport/make.conf @@ -2,3 +2,4 @@ PYTHON_TARGETS="python3_6" USE_PYTHON="3.6" NGINX_MODULES_HTTP="auth_basic gzip proxy referer rewrite headers_more uwsgi" +INSTALL_MASK="$INSTALL_MASK /etc/nginx/nginx.conf /etc/issue"