gluon-site: install domain configs
The domain configs are not checked yet, and not used for anything. Based-on-patch-by: lemoer <git@irrelefant.net>
This commit is contained in:
		
							parent
							
								
									50812b162c
								
							
						
					
					
						commit
						020afc856f
					
				
							
								
								
									
										8
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								Makefile
									
									
									
									
									
								
							| @ -95,6 +95,11 @@ CheckTarget := [ '$(LEDE_TARGET)' ] \ | ||||
| 
 | ||||
| CheckExternal := test -d lede || (echo 'You don'"'"'t seem to have obtained the external repositories needed by Gluon; please call `make update` first!'; false) | ||||
| 
 | ||||
| define CheckSite | ||||
| 	@GLUON_SITEDIR='$(GLUON_SITEDIR)' GLUON_SITE_CONFIG='$(1).conf' $(LUA) scripts/site_config.lua \
 | ||||
| 		|| (echo 'Your site configuration ($(1).conf) did not pass validation.'; false) | ||||
| 
 | ||||
| endef | ||||
| 
 | ||||
| list-targets: FORCE | ||||
| 	@$(foreach target,$(GLUON_TARGETS),echo '$(target)';) | ||||
| @ -139,8 +144,7 @@ $(LUA): | ||||
| prepare-target: config $(LUA) ; | ||||
| 
 | ||||
| all: prepare-target | ||||
| 	@GLUON_SITEDIR='$(GLUON_SITEDIR)' $(LUA) scripts/site_config.lua \
 | ||||
|                 || (echo 'Your site configuration did not pass validation.'; false) | ||||
| 	$(foreach conf,site $(patsubst $(GLUON_SITEDIR)/%.conf,%,$(wildcard $(GLUON_SITEDIR)/domains/*.conf)),$(call CheckSite,$(conf))) | ||||
| 
 | ||||
| 	@scripts/clean_output.sh | ||||
| 	+@$(LEDEMAKE) | ||||
|  | ||||
| @ -2,13 +2,13 @@ include $(TOPDIR)/rules.mk | ||||
| 
 | ||||
| PKG_NAME:=gluon-site | ||||
| 
 | ||||
| GLUON_SITEDIR = '$(call qstrip,$(CONFIG_GLUON_SITEDIR))' | ||||
| GLUON_SITE_VERSION = $(shell ( cd $(GLUON_SITEDIR) && git --git-dir=.git describe --always --dirty=+ ) 2>/dev/null || echo unknown) | ||||
| GLUON_SITEDIR = $(call qstrip,$(CONFIG_GLUON_SITEDIR)) | ||||
| GLUON_SITE_VERSION = $(shell ( cd '$(GLUON_SITEDIR)' && git --git-dir=.git describe --always --dirty=+ ) 2>/dev/null || echo unknown) | ||||
| PKG_VERSION:=$(if $(DUMP),x,$(GLUON_SITE_VERSION)) | ||||
| 
 | ||||
| 
 | ||||
| PKG_CONFIG_DEPENDS := CONFIG_GLUON_RELEASE CONFIG_GLUON_SITEDIR | ||||
| PKG_FILE_DEPENDS := $(GLUON_SITEDIR)/site.conf $(GLUON_SITEDIR)/i18n/ | ||||
| PKG_FILE_DEPENDS := $(GLUON_SITEDIR)/site.conf $(GLUON_SITEDIR)/domains/ $(GLUON_SITEDIR)/i18n/ | ||||
| PKG_BUILD_DEPENDS := lua-cjson/host | ||||
| 
 | ||||
| PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) | ||||
| @ -37,20 +37,21 @@ config GLUON_SITEDIR | ||||
| endef | ||||
| 
 | ||||
| define Build/Prepare | ||||
| 	mkdir -p $(PKG_BUILD_DIR) | ||||
| endef | ||||
| 
 | ||||
| define Build/Configure | ||||
| 	mkdir -p $(PKG_BUILD_DIR)/domains | ||||
| endef | ||||
| 
 | ||||
| define Build/Compile | ||||
| 	GLUON_SITEDIR='$(call qstrip,$(CONFIG_GLUON_SITEDIR))' lua -e 'print(require("cjson").encode(assert(dofile("../../scripts/site_config.lua"))))' > $(PKG_BUILD_DIR)/site.json | ||||
| 	$(foreach conf,site $(patsubst $(GLUON_SITEDIR)/%.conf,%,$(wildcard $(GLUON_SITEDIR)/domains/*.conf)), | ||||
| 		GLUON_SITEDIR='$(GLUON_SITEDIR)' GLUON_SITE_CONFIG='$(conf).conf' lua -e 'print(require("cjson").encode(assert(dofile("../../scripts/site_config.lua"))))' > '$(PKG_BUILD_DIR)/$(conf).json' | ||||
| 	) | ||||
| 
 | ||||
| 	$(call GluonBuildI18N,gluon-site,$(GLUON_SITEDIR)/i18n) | ||||
| endef | ||||
| 
 | ||||
| define Package/gluon-site/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/gluon | ||||
| 	$(INSTALL_DATA) $(PKG_BUILD_DIR)/site.json $(1)/lib/gluon/ | ||||
| 	$(CP) $(PKG_BUILD_DIR)/domains $(1)/lib/gluon/ | ||||
| 	echo '$(GLUON_SITE_VERSION)' > $(1)/lib/gluon/site-version | ||||
| 	echo '$(call qstrip,$(CONFIG_GLUON_RELEASE))' > $(1)/lib/gluon/release | ||||
| 
 | ||||
|  | ||||
| @ -1,3 +1,4 @@ | ||||
| #!/bin/sh | ||||
| 
 | ||||
| export GLUON_SITE_CONFIG=site.conf | ||||
| exec lede/staging_dir/hostpkg/bin/lua -e "print(assert(dofile('scripts/site_config.lua').$1))" 2>/dev/null | ||||
|  | ||||
| @ -1,9 +1,10 @@ | ||||
| local config = os.getenv('GLUON_SITEDIR') | ||||
| local site = os.getenv('GLUON_SITEDIR') .. '/' | ||||
| local config = os.getenv('GLUON_SITE_CONFIG') | ||||
| 
 | ||||
| local function loader() | ||||
|    coroutine.yield('return ') | ||||
|    coroutine.yield(io.open(config .. '/site.conf'):read('*a')) | ||||
|    coroutine.yield(io.open(site..config):read('*a')) | ||||
| end | ||||
| 
 | ||||
| -- setfenv doesn't work with Lua 5.2 anymore, but we're using 5.1 | ||||
| return setfenv(assert(load(coroutine.wrap(loader), 'site.conf')), {})() | ||||
| return setfenv(assert(load(coroutine.wrap(loader), config)), {})() | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user