nginx: autoload dynamic modules
[feed/packages.git] / net / nginx / Makefile
index b90cef9c103a51043b9782b4f115c4095d72c243..c8bfe102b6b8c240e500da7cf0905f073098b19d 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=nginx
 PKG_VERSION:=1.25.4
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=nginx-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://nginx.org/download/
@@ -195,6 +195,15 @@ define Package/nginx-mod-luci/description
  Support file for LuCI in nginx. Include custom nginx configuration, autostart script for uwsgi.
 endef
 
+define Package/nginx-mod-luci/preinst
+#!/bin/sh
+grep -r -l ngx_http_ubus_module.so /etc/nginx/module.d | grep -v ngx_http_ubus.module | while read file; do
+  echo "Removing old LuCI module load file for 'ngx_http_ubus.so' in $$file."
+  rm -f $$file
+done
+exit 0
+endef
+
 define Package/nginx-mod-luci/install
        $(INSTALL_DIR) $(1)/etc/nginx/conf.d
        $(INSTALL_CONF) ./files-luci-support/luci.locations $(1)/etc/nginx/conf.d/
@@ -375,8 +384,10 @@ define BuildModule
 
   define Package/nginx-mod-$(1)/install
        $(INSTALL_DIR) $$(1)/usr/lib/nginx/modules
+       $(INSTALL_DIR) $$(1)/etc/nginx/module.d
        $(foreach m,$(3),
-         $(CP) $$(PKG_INSTALL_DIR)/usr/lib/nginx/modules/$(m)_module.so $$(1)/usr/lib/nginx/modules
+         $(CP) $$(PKG_INSTALL_DIR)/usr/lib/nginx/modules/$(m)_module.so $$(1)/usr/lib/nginx/modules && \
+         echo "load_module /usr/lib/nginx/modules/$(m)_module.so;" > $$(1)/etc/nginx/module.d/$(m).module
        )
        $(call Module/nginx-mod-$(1)/install,$$(1))
   endef