2012-01-09 22:21:06 +01:00
|
|
|
APP_ROOT := /var/airport
|
2012-01-19 02:01:00 +01:00
|
|
|
AIRPORT_REPO ?= https://bitbucket.org/marduk/airport
|
2013-10-12 16:13:51 +02:00
|
|
|
AIRPORT_BRANCH ?= default
|
2015-01-07 23:27:18 +01:00
|
|
|
PGVER := 9.4
|
2012-01-19 02:01:00 +01:00
|
|
|
|
|
|
|
rcdefault := /etc/runlevels/default
|
2012-01-09 22:21:06 +01:00
|
|
|
|
|
|
|
preinstall:
|
|
|
|
|
|
|
|
|
2014-01-11 16:05:38 +01:00
|
|
|
postinstall: airport.service settings.py local.start local.stop issue nginx.conf start-airport stop-airport stop-game
|
2012-09-12 21:17:40 +02:00
|
|
|
sed -i 's/^PG_INITDB_OPTS.*/PG_INITDB_OPTS="--locale=en_US.UTF-8"/' $(CHROOT)/etc/conf.d/postgresql-$(PGVER)
|
|
|
|
$(inroot) eselect postgresql set $(PGVER)
|
|
|
|
rm -rf $(CHROOT)/var/lib/postgresql/$(PGVER)
|
2015-02-22 16:32:16 +01:00
|
|
|
$(inroot) bash -c "echo y |$(EMERGE) --config postgresql:$(PGVER)"
|
|
|
|
$(inroot) systemctl enable postgresql-$(PGVER)
|
2015-03-13 12:31:00 +01:00
|
|
|
$(inroot) $(EMERGE) --oneshot --noreplace $(USEPKG) dev-python/virtualenv
|
2012-01-09 22:21:06 +01:00
|
|
|
rm -rf $(CHROOT)/$(APP_ROOT)
|
2013-10-12 16:13:51 +02:00
|
|
|
hg clone -u $(AIRPORT_BRANCH) $(AIRPORT_REPO) $(CHROOT)/$(APP_ROOT)
|
2014-01-11 16:05:38 +01:00
|
|
|
chroot $(CHROOT) virtualenv -p /usr/bin/python3 $(APP_ROOT)
|
2012-01-09 22:21:06 +01:00
|
|
|
$(inroot) bash -c ". $(APP_ROOT)/bin/activate ; pip install -r $(APP_ROOT)/requirements.txt"
|
2013-09-27 16:34:15 +02:00
|
|
|
$(inroot) bash -c ". $(APP_ROOT)/bin/activate ; pip install psycopg2 uwsgi"
|
2012-01-09 22:21:06 +01:00
|
|
|
mkdir -p $(CHROOT)/$(APP_ROOT)/etc
|
|
|
|
touch $(CHROOT)/$(APP_ROOT)/etc/__init__.py
|
|
|
|
cp settings.py $(CHROOT)/$(APP_ROOT)/etc
|
2014-01-11 16:05:38 +01:00
|
|
|
$(inroot) id -u airport >/dev/null || $(inroot) useradd -d $(APP_ROOT) -M -U -G postgres airport
|
|
|
|
mkdir -p $(CHROOT)/$(APP_ROOT)/bin
|
|
|
|
cp start-airport $(CHROOT)/$(APP_ROOT)/bin/start-airport
|
|
|
|
cp stop-airport $(CHROOT)/$(APP_ROOT)/bin/stop-airport
|
|
|
|
cp stop-game $(CHROOT)/$(APP_ROOT)/bin/stop-game
|
2013-09-27 16:34:15 +02:00
|
|
|
$(inroot) chown -R airport:airport $(APP_ROOT)
|
2014-01-11 16:05:38 +01:00
|
|
|
cp local.start $(CHROOT)/etc/local.d/airport.start
|
|
|
|
cp local.stop $(CHROOT)/etc/local.d/airport.stop
|
|
|
|
ifdef AIRPORT_SERIES
|
|
|
|
cat settings_$(AIRPORT_SERIES).py >> $(CHROOT)/$(APP_ROOT)/etc/settings.py
|
|
|
|
cp $(CHROOT)/$(APP_ROOT)/djangoproject/airport/fixtures/$(AIRPORT_SERIES).json \
|
|
|
|
$(CHROOT)/$(APP_ROOT)/djangoproject/airport/fixtures/initial_data.json
|
|
|
|
endif
|
2012-01-09 22:21:06 +01:00
|
|
|
cp issue $(CHROOT)/etc/issue
|
2013-09-27 16:34:15 +02:00
|
|
|
$(M4) -D HOSTNAME=$(HOSTNAME) nginx.conf > $(CHROOT)/etc/nginx/nginx.conf
|
2014-01-11 16:05:38 +01:00
|
|
|
$(inroot) gpasswd -a nginx airport
|
2015-02-22 16:32:16 +01:00
|
|
|
$(inroot) systemctl enable nginx
|
2012-01-09 22:21:06 +01:00
|
|
|
ifeq ($(AVAHI),YES)
|
2015-03-13 12:31:00 +01:00
|
|
|
$(inroot) $(EMERGE) --noreplace $(USEPKG) net-dns/avahi
|
2012-01-09 22:21:06 +01:00
|
|
|
$(inroot) rm -f /etc/avahi/services/*
|
|
|
|
cp airport.service $(CHROOT)/etc/avahi/services
|
2015-02-22 16:32:16 +01:00
|
|
|
$(inroot) systemctl enable avahi-daemon
|
2012-01-09 22:21:06 +01:00
|
|
|
endif
|
2013-09-27 16:34:15 +02:00
|
|
|
$(inroot) $(EMERGE) --depclean --with-bdeps=n
|
2012-01-09 22:21:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
clean:
|
|
|
|
|