appliances/ejabberd/Makefile

61 lines
2.9 KiB
Makefile

02firstboot = $(CHROOT)/usr/local/bin/02firstboot.start
cert-renew.sh = $(CHROOT)/etc/ssl/cert-renew.sh
nginx_conf = $(CHROOT)/etc/nginx/nginx.conf.applorig
example_com_conf = $(CHROOT)/etc/nginx/conf.d/example.com.conf
ejabberd_example_com_conf = $(CHROOT)/etc/nginx/conf.d/ejabberd.example.com.conf
install_movim = /usr/share/movim
MOVIM_VER ?= 0.19.1rc7
MOVIM_TARBALL = movim-$(MOVIM_VER).tar.gz
MOVIM_URL = https://github.com/movim/movim/archive/refs/tags/v$(MOVIM_VER).tar.gz
systemd-units: appliance/PostgreSQL-Backup.sh appliance/backup.service appliance/backup.timer appliance/cert-renew.service appliance/cert-renew.timer
mkdir -p $(CHROOT)/usr/local/bin
cp appliance/PostgreSQL-Backup.sh $(CHROOT)/usr/local/bin/
cp appliance/backup.service appliance/backup.timer appliance/cert-renew.service appliance/cert-renew.timer $(CHROOT)/etc/systemd/system/
$(02firstboot): appliance/02firstboot.start
mkdir -p $(CHROOT)/usr/local/bin
cp $< $@
touch $(CHROOT)/02firstboot
$(cert-renew.sh): appliance/cert-renew.sh
mkdir -p $(CHROOT)/etc/ssl
cp $< $@
$(nginx_conf): nginx/nginx.conf
cp nginx/proxy_params $(CHROOT)/etc/nginx/
sed -i 's#^listen = .*#listen = /run/php-fpm/www.socket#' $(CHROOT)/etc/php/fpm-php7.4/fpm.d/www.conf
sed -i 's#^;listen.owner = .*#listen.owner = nginx#' $(CHROOT)/etc/php/fpm-php7.4/fpm.d/www.conf
sed -i 's#^;listen.group = .*#listen.group = nginx#' $(CHROOT)/etc/php/fpm-php7.4/fpm.d/www.conf
mv $(CHROOT)/etc/nginx/nginx.conf $@
cp $< $(CHROOT)/etc/nginx/nginx.conf
$(example_com_conf): nginx/conf.d/example.com.conf
mkdir -p $(CHROOT)/etc/nginx/conf.d
cp $< $@
$(ejabberd_example_com_conf): nginx/conf.d/ejabberd.example.com.conf
mkdir -p $(CHROOT)/etc/nginx/conf.d
cp $< $@
$(install_movim):
RUN test -f /var/cache/distfiles/$(MOVIM_TARBALL) || \
RUN wget $(MOVIM_URL) -O /var/cache/distfiles/$(MOVIM_TARBALL)
RUN sh -c 'tar xf /var/cache/distfiles/$(MOVIM_TARBALL) -C /usr/share && mv $(install_movim)-$(MOVIM_VER) $(install_movim) && cd $(install_movim) && echo yes | composer install'
cp $(CHROOT)/$(install_movim)/etc/systemd/system/movim.service $(CHROOT)/etc/systemd/system/
sed -i 's#include fastcgi_params;#include fastcgi_params;\n\t\tfastcgi_param SCRIPT_FILENAME $$request_filename;\n\t\tfastcgi_pass unix:/run/php-fpm/www.socket;#' $(CHROOT)/$(install_movim)/etc/nginx/conf.d/movim.conf
preinstall:
# workaround for https://bugs.gentoo.org/716968
mkdir -p $(CHROOT)/etc/ssl/ejabberd
touch $(CHROOT)/etc/ssl/ejabberd/server.pem
postinstall: systemd-units $(nginx_conf) $(example_com_conf) $(ejabberd_example_com_conf) $(02firstboot) $(cert-renew.sh) $(install_movim)
# workaround for https://bugs.gentoo.org/716968
rm -rf $(CHROOT)/etc/ssl/ejabberd
# configure postgresql
sed -i 's#^PG_INITDB_OPTS=.*#PG_INITDB_OPTS="--encoding=UTF8 --locale=de_DE.UTF-8"#' $(CHROOT)/etc/conf.d/postgresql-*
rm -rf $(CHROOT)/var/lib/postgresql/*
RUN emerge --config dev-db/postgresql