diff --git a/site2domain/Makefile b/site2domain/Makefile new file mode 100644 index 0000000..f486aa2 --- /dev/null +++ b/site2domain/Makefile @@ -0,0 +1,31 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=site2domain +PKG_VERSION:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include ../../../package/gluon.mk + +define Package/site2domain + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Set gluon.core.domain according to legacy site name, to prepare for multidomain gluon +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) +endef + +define Package/site2domain/install + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ +endef + +$(eval $(call BuildPackage,site2domain)) \ No newline at end of file diff --git a/site2domain/luasrc/lib/gluon/upgrade/590-site2domain b/site2domain/luasrc/lib/gluon/upgrade/590-site2domain new file mode 100755 index 0000000..41407ac --- /dev/null +++ b/site2domain/luasrc/lib/gluon/upgrade/590-site2domain @@ -0,0 +1,22 @@ +#!/usr/bin/lua + +local site = require 'gluon.site_config' +local fs = require 'nixio.fs' + +local sitecode = site.site_code + +if sitecode == 'ffhh-sued' then + domain = 'ffhh_sued' +elseif sitecode == 'ffhh-west' then + domain = 'ffhh_west' +elseif sitecode == 'ffhh-nowe' then + domain = 'ffhh_nowe' +elseif sitecode == 'ffhh-ost' then + domain = 'ffhh_ost' +else + domain = 'ffhh_nowe' +end + +local content = 'config core \'core\'\n\toption domain \'' .. domain .. '\'\n' + +fs.writefile('/etc/config/gluon', content)