diff --git a/Makefile b/Makefile index 3634d970..3dce8627 100644 --- a/Makefile +++ b/Makefile @@ -240,10 +240,9 @@ prepare-image: FORCE cp $(KERNEL_BUILD_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux.elf $(BOARD_KDIR)/ +$(SUBMAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image -f $(GLUONDIR)/include/Makefile.image prepare KDIR="$(BOARD_KDIR)" -CheckSite := $(STAGING_DIR_HOST)/bin/lua $(GLUONDIR)/scripts/load_site.lua || (echo 'Your site configuration did not pass validation.';false) - prepare: FORCE - @$(CheckSite) + @$(STAGING_DIR_HOST)/bin/lua $(GLUONDIR)/packages/gluon/gluon/gluon-core/files/usr/lib/lua/gluon/site_config.lua \ + || (echo 'Your site configuration did not pass validation.'; false) mkdir -p $(GLUON_IMAGEDIR) $(BOARD_BUILDDIR) echo 'src packages file:../openwrt/bin/$(BOARD)/packages' > $(BOARD_BUILDDIR)/opkg.conf diff --git a/include/gluon.mk b/include/gluon.mk index fbf1698f..a9ad6e2a 100644 --- a/include/gluon.mk +++ b/include/gluon.mk @@ -3,6 +3,7 @@ __gluon_inc=1 GLUON_ORIGOPENWRTDIR := $(GLUONDIR)/openwrt GLUON_SITEDIR := $(GLUONDIR)/site +GLUON_SITE_CONFIG := $(GLUON_SITEDIR)/site.conf GLUON_IMAGEDIR ?= $(GLUONDIR)/images GLUON_BUILDDIR ?= $(GLUONDIR)/build @@ -12,7 +13,7 @@ GLUON_OPENWRTDIR = $(GLUON_BUILDDIR)/$(GLUON_TARGET)/openwrt BOARD_BUILDDIR = $(GLUON_BUILDDIR)/$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET)) BOARD_KDIR = $(BOARD_BUILDDIR)/kernel -export GLUONDIR GLUON_SITEDIR GLUON_IMAGEDIR GLUON_OPENWRTDIR GLUON_BUILDDIR +export GLUONDIR GLUON_SITEDIR GLUON_SITE_CONFIG GLUON_IMAGEDIR GLUON_OPENWRTDIR GLUON_BUILDDIR $(GLUON_SITEDIR)/site.mk: $(error There was no site configuration found. Please check out a site configuration to $(GLUON_SITEDIR)) diff --git a/scripts/load_site.lua b/scripts/load_site.lua deleted file mode 100644 index 8192774d..00000000 --- a/scripts/load_site.lua +++ /dev/null @@ -1,7 +0,0 @@ -local function loader() - coroutine.yield('return ') - coroutine.yield(io.open(os.getenv('GLUONDIR') .. '/site/site.conf'):read('*a')) -end - --- setfenv doesn't work with Lua 5.2 anymore, but we're using 5.1 -config = setfenv(assert(load(coroutine.wrap(loader), 'site.conf')), {})() diff --git a/scripts/site.sh b/scripts/site.sh index 82b55451..597a2857 100755 --- a/scripts/site.sh +++ b/scripts/site.sh @@ -1,5 +1,8 @@ #!/bin/sh export GLUONDIR="$(dirname "$0")/.." +export GLUON_SITE_CONFIG="$GLUONDIR/site/site.conf" -"$GLUONDIR"/openwrt/staging_dir/host/bin/lua -e "dofile(os.getenv('GLUONDIR') .. '/scripts/load_site.lua') print(assert(config.$1))" 2>/dev/null +SITE_CONFIG_LUA=packages/gluon/gluon/gluon-core/files/usr/lib/lua/gluon/site_config.lua + +"$GLUONDIR"/openwrt/staging_dir/host/bin/lua -e "print(assert(dofile(os.getenv('GLUONDIR') .. '/${SITE_CONFIG_LUA}').$1))" 2>/dev/null