gluon-autoupdater: split CONFIG_GLUON_BRANCH into two separate options
The new options are CONFIG_GLUON_AUTOUPDATER_BRANCH and CONFIG_GLUON_AUTOUPDATER_ENABLED and allow to control the default branch and default enable status separately. The `or ''` fallback in targets/generic is removed, as GLUON_ENV will set all variables in GLUON_VARS, making previously non-existing variables exist with an empty value.
This commit is contained in:
parent
26f02a4eb3
commit
ee53357580
10
package/gluon-autoupdater/Config.in
Normal file
10
package/gluon-autoupdater/Config.in
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
if PACKAGE_gluon-autoupdater
|
||||||
|
|
||||||
|
config GLUON_AUTOUPDATER_BRANCH
|
||||||
|
string "Autoupdater branch"
|
||||||
|
default ""
|
||||||
|
|
||||||
|
config GLUON_AUTOUPDATER_ENABLED
|
||||||
|
bool "Enable autoupdater by default"
|
||||||
|
|
||||||
|
endif
|
@ -3,7 +3,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
PKG_NAME:=gluon-autoupdater
|
PKG_NAME:=gluon-autoupdater
|
||||||
PKG_VERSION:=4
|
PKG_VERSION:=4
|
||||||
|
|
||||||
PKG_CONFIG_DEPENDS := CONFIG_GLUON_BRANCH
|
PKG_CONFIG_DEPENDS := CONFIG_GLUON_AUTOUPDATER_BRANCH CONFIG_GLUON_AUTOUPDATER_ENABLED
|
||||||
|
|
||||||
include ../gluon.mk
|
include ../gluon.mk
|
||||||
|
|
||||||
@ -13,19 +13,19 @@ define Package/gluon-autoupdater
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/gluon-autoupdater/config
|
define Package/gluon-autoupdater/config
|
||||||
config GLUON_BRANCH
|
source "$(SOURCE)/Config.in"
|
||||||
string "Gluon autoupdater branch"
|
|
||||||
depends on PACKAGE_gluon-autoupdater
|
|
||||||
default ""
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/gluon-autoupdater/install
|
define Package/gluon-autoupdater/install
|
||||||
$(Gluon/Build/Install)
|
$(Gluon/Build/Install)
|
||||||
|
|
||||||
ifneq ($(CONFIG_GLUON_BRANCH),"")
|
|
||||||
$(INSTALL_DIR) $(1)/lib/gluon/autoupdater
|
$(INSTALL_DIR) $(1)/lib/gluon/autoupdater
|
||||||
echo '$(call qstrip,$(CONFIG_GLUON_BRANCH))' > $(1)/lib/gluon/autoupdater/default_branch
|
ifneq ($(CONFIG_GLUON_AUTOUPDATER_BRANCH),"")
|
||||||
endif
|
echo '$(call qstrip,$(CONFIG_GLUON_AUTOUPDATER_BRANCH))' > $(1)/lib/gluon/autoupdater/default_branch
|
||||||
|
endif
|
||||||
|
ifneq ($(CONFIG_GLUON_AUTOUPDATER_ENABLED),)
|
||||||
|
touch $(1)/lib/gluon/autoupdater/default_enabled
|
||||||
|
endif
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackageGluon,gluon-autoupdater))
|
$(eval $(call BuildPackageGluon,gluon-autoupdater))
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
local site = require 'gluon.site'
|
local site = require 'gluon.site'
|
||||||
local uci = require('simple-uci').cursor()
|
local uci = require('simple-uci').cursor()
|
||||||
|
local unistd = require 'posix.unistd'
|
||||||
|
|
||||||
|
|
||||||
for name, config in pairs(site.autoupdater.branches()) do
|
for name, config in pairs(site.autoupdater.branches()) do
|
||||||
@ -15,12 +16,11 @@ for name, config in pairs(site.autoupdater.branches()) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not uci:get('autoupdater', 'settings') then
|
if not uci:get('autoupdater', 'settings') then
|
||||||
local enabled = false
|
local enabled = unistd.access('/lib/gluon/autoupdater/default_enabled') ~= nil
|
||||||
local branch = site.autoupdater.branch()
|
|
||||||
|
|
||||||
|
local branch = site.autoupdater.branch()
|
||||||
local f = io.open('/lib/gluon/autoupdater/default_branch')
|
local f = io.open('/lib/gluon/autoupdater/default_branch')
|
||||||
if f then
|
if f then
|
||||||
enabled = true
|
|
||||||
branch = f:read('*line')
|
branch = f:read('*line')
|
||||||
f:close()
|
f:close()
|
||||||
end
|
end
|
||||||
|
@ -3,7 +3,9 @@ assert(env.GLUON_LANGS)
|
|||||||
|
|
||||||
config('GLUON_SITEDIR', env.GLUON_SITEDIR)
|
config('GLUON_SITEDIR', env.GLUON_SITEDIR)
|
||||||
config('GLUON_RELEASE', env.GLUON_RELEASE)
|
config('GLUON_RELEASE', env.GLUON_RELEASE)
|
||||||
try_config('GLUON_BRANCH', env.GLUON_BRANCH or '')
|
|
||||||
|
try_config('GLUON_AUTOUPDATER_BRANCH', env.GLUON_BRANCH)
|
||||||
|
try_config('GLUON_AUTOUPDATER_ENABLED', env.GLUON_BRANCH ~= '')
|
||||||
|
|
||||||
for lang in string.gmatch(env.GLUON_LANGS, '%S+') do
|
for lang in string.gmatch(env.GLUON_LANGS, '%S+') do
|
||||||
try_config('GLUON_WEB_LANG_' .. lang, true)
|
try_config('GLUON_WEB_LANG_' .. lang, true)
|
||||||
|
Loading…
Reference in New Issue
Block a user