Browse Source

add package ffho-domain-migration

migrate from ffho-site-generate to upstream multidomain support. Additional we
will remove the 'ffho_' prefix if present.
Karsten Böddeker 6 years ago
parent
commit
b150c1183c

+ 37 - 0
ffho/ffho-domain-migration/Makefile

@@ -0,0 +1,37 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ffho-domain-migration
+PKG_VERSION:=1
+
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+
+include $(TOPDIR)/../package/gluon.mk
+
+define Package/ffho-domain-migration
+  SECTION:=ffho
+  CATEGORY:=FFHO
+  TITLE:=Migration script for gluon multidomain support
+  DEPENDS:=+gluon-core @GLUON_MULTIDOMAIN
+  MAINTAINER:=Freifunk Hochstift <kontakt@hochstift.freifunk.net>
+endef
+
+define Package/ffho-domain-migration/description
+	Migration script for gluon multidomain support
+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/ffho-domain-migration/install
+	$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
+endef
+
+$(eval $(call BuildPackage,ffho-domain-migration))

+ 12 - 0
ffho/ffho-domain-migration/luasrc/lib/gluon/upgrade/002-domain-migration

@@ -0,0 +1,12 @@
+#!/usr/bin/lua
+
+local fs = require 'nixio.fs'
+local uci = require("simple-uci").cursor()
+
+local file = '/etc/config/currentsite'
+if fs.stat(file) then
+	local domain = uci:get('currentsite', 'current', 'name')
+	uci:set('gluon', 'core', 'domain', domain:match('^ffho_(.*)$') or domain)
+	uci:save('gluon')
+	fs.remove(file)
+end