virtual-appliance/appliances/dpaste/Makefile

48 lines
2.0 KiB
Makefile
Raw Normal View History

2014-05-10 15:22:48 +02:00
PGVER = 9.3
2013-08-31 03:35:00 +02:00
DPASTE_USER = dpaste
DPASTE_HOME = /opt/dpaste
PIP = $(DPASTE_HOME)/bin/pip
DPASTE_REPO = https://github.com/bartTC/dpaste
rcdefault := /etc/runlevels/default
preinstall:
postinstall: bash_profile nginx.conf dpaste.init settings.py firstboot.start
$(inroot) $(EMERGE) $(USEPKG) --oneshot --noreplace dev-vcs/git
$(inroot) $(EMERGE) --noreplace $(USEPKG) dev-db/postgresql:$(PGVER)
2013-08-31 03:35:00 +02:00
$(inroot) passwd -d postgres
$(inroot) eselect postgresql set $(PGVER)
$(inroot) rm -rf /var/lib/postgresql/$(PGVER)/data
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)
$(inroot) $(EMERGE) --oneshot --noreplace $(USEPKG) dev-python/virtualenv
2013-08-31 03:35:00 +02:00
$(inroot) getent passwd $(DPASTE_USER) || \
$(inroot) useradd -c "Dpaste Server" -G postgres -U -d $(DPASTE_HOME) $(DPASTE_USER)
rm -rf $(CHROOT)/$(DPASTE_HOME)
mkdir -p $(CHROOT)/$(DPASTE_HOME)
mkdir -p $(CHROOT)/$(DPASTE_HOME)/media
mkdir -p $(CHROOT)/$(DPASTE_HOME)/var
$(inroot) rm -rf $(DPASTE_HOME)/dpaste
$(inroot) git clone $(DPASTE_REPO) $(DPASTE_HOME)/dpaste
sed -i 's/dpaste\.de/dpaste/g' $(CHROOT)/$(DPASTE_HOME)/dpaste/dpaste/templates/dpaste/*.html
cp bash_profile $(CHROOT)$(DPASTE_HOME)/.bash_profile
$(inroot) virtualenv -p /usr/bin/python2.7 $(DPASTE_HOME)
$(inroot) $(PIP) install -r $(DPASTE_HOME)/dpaste/requirements.txt
$(inroot) $(PIP) install psycopg2
$(inroot) $(DPASTE_HOME)/bin/django-admin.py startproject project $(DPASTE_HOME)
grep ^SECRET_KEY $(CHROOT)/$(DPASTE_HOME)/project/settings.py > $(CHROOT)/$(DPASTE_HOME)/project/keyfile.py
cp settings.py $(CHROOT)/$(DPASTE_HOME)/project/settings.py
chmod +x $(CHROOT)/$(DPASTE_HOME)/manage.py
cp nginx.conf $(CHROOT)/etc/nginx
cp dpaste.init $(CHROOT)/etc/init.d/dpaste
cp firstboot.start $(CHROOT)/etc/local.d/firstboot.start
touch $(CHROOT)/firstboot
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 nginx
2013-08-31 03:35:00 +02:00
$(inroot) ln -sf ../manage.py $(DPASTE_HOME)/bin/manage
$(inroot) $(EMERGE) --depclean --with-bdeps=n
clean: