virtual-appliance/appliances/airport/Makefile

48 lines
2.2 KiB
Makefile
Raw Normal View History

2015-12-12 22:42:37 +01:00
APP_ROOT := /var/lib/airport
AIRPORT_REPO ?= https://bitbucket.org/marduk/airport
2015-12-12 22:42:37 +01:00
AIRPORT_BRANCH ?= stable
2016-10-19 14:26:12 +02:00
PGVER := 9.6
preinstall:
2015-12-12 22:42:37 +01:00
postinstall: airport.service settings.py issue nginx.conf airport-pre.service airport-gameserver.service airport-wsgi.service
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)
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
$(inroot) bash -c "echo y |$(EMERGE) --config postgresql:$(PGVER)"
$(inroot) systemctl enable postgresql-$(PGVER)
2015-12-12 22:42:37 +01:00
$(inroot) $(EMERGE) --oneshot --noreplace $(USEPKG) dev-python/setuptools dev-python/virtualenv
rm -rf $(CHROOT)/$(APP_ROOT)
hg clone -u $(AIRPORT_BRANCH) $(AIRPORT_REPO) $(CHROOT)/$(APP_ROOT)
chroot $(CHROOT) virtualenv -p /usr/bin/python3 $(APP_ROOT)
$(inroot) bash -c ". $(APP_ROOT)/bin/activate ; pip install -r $(APP_ROOT)/requirements.txt"
$(inroot) bash -c ". $(APP_ROOT)/bin/activate ; pip install psycopg2 uwsgi"
2015-12-12 22:42:37 +01:00
cp settings.py $(CHROOT)/$(APP_ROOT)/djangoproject/djangoproject
$(inroot) id -u airport >/dev/null || $(inroot) useradd -d $(APP_ROOT) -M -U -G postgres airport
$(inroot) chown -R airport:airport $(APP_ROOT)
ifdef AIRPORT_SERIES
2015-12-12 22:42:37 +01:00
cat settings_$(AIRPORT_SERIES).py >> $(CHROOT)/$(APP_ROOT)/djangoproject/djangoproject/settings.py
cp $(CHROOT)/$(APP_ROOT)/djangoproject/airport/fixtures/$(AIRPORT_SERIES).json \
$(CHROOT)/$(APP_ROOT)/djangoproject/airport/fixtures/initial_data.json
endif
cp issue $(CHROOT)/etc/issue
2015-12-12 22:42:37 +01:00
cp -u airport-pre.service $(CHROOT)/etc/systemd/system/airport-pre.service
cp -u airport-wsgi.service $(CHROOT)/etc/systemd/system/airport-wsgi.service
cp -u airport-gameserver.service $(CHROOT)/etc/systemd/system/airport-gameserver.service
$(M4) -D HOSTNAME=$(HOSTNAME) nginx.conf > $(CHROOT)/etc/nginx/nginx.conf
$(inroot) gpasswd -a nginx airport
2015-12-12 22:42:37 +01:00
$(inroot) systemctl enable airport-wsgi.service
$(inroot) systemctl enable airport-gameserver.service
ifeq ($(AVAHI),YES)
$(inroot) $(EMERGE) --noreplace $(USEPKG) net-dns/avahi
$(inroot) rm -f /etc/avahi/services/*
cp airport.service $(CHROOT)/etc/avahi/services
The great systemd commit. This change converts the appliances from openrc to systemd. In addition, systemd needs to at least be be installed on the build machine as we now use systemd-nspawn instead of chroot/bind mounts do to the fact that systemd-nspawn is much more robust and lese prone to errors. In addition: * All stage4 tarballs and images are now stored in the images/ directory by default. * A package dir is now required and is set up in the packages/ directory by default. * The portage directory is not unpacked in the chroot every time anymore and is instead bind-mounted from a directory by systemd-nspawn. This is the portage/ directory by default. * In addition there is a distfiles/ directory (by default) which is bind-mounted in the chroot. It does what you'd probably expect. * The Makefile learned new target, eclean, which will run eclean-dist and eclean-pkg to clean out obsolete distfiles and binary packages. * The REMOVE_PORTAGE_TREE option is removed as portage is no longer installed. * The unused/untested PRUNE_CRITICAL functionality has been removed. I have no idea if it worked and if it didn't I didn't want to fix it. * As appliances are always using systemd, UDEV is no longer optional. * Timezones and hostnames are now handled by systemd (systemd-firstboot). * Stage4 tarballs are now directly importable as systemd containers (and probably docker too though I haven't tested that yet). * A number of packages (for example dhcpd, acpid) have been removed from the appliances when systemd provides equivalent functionality. * We no longer override etc-update.conf. There's no reason. * A number of Makefile targets, checkpoints, temp files, etc have been removed as they are no longer needed.
2015-02-22 16:32:16 +01:00
$(inroot) systemctl enable avahi-daemon
endif
$(inroot) $(EMERGE) --depclean --with-bdeps=n
clean: