From owner-svn-src-all@freebsd.org Sun Jun 10 01:38:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7DEF10087B7; Sun, 10 Jun 2018 01:38:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6D54E82E5B; Sun, 10 Jun 2018 01:38:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F09D25E3A; Sun, 10 Jun 2018 01:38:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5A1creQ058329; Sun, 10 Jun 2018 01:38:53 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5A1crbu058328; Sun, 10 Jun 2018 01:38:53 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201806100138.w5A1crbu058328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 10 Jun 2018 01:38:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334907 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 334907 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2018 01:38:53 -0000 Author: kevans Date: Sun Jun 10 01:38:52 2018 New Revision: 334907 URL: https://svnweb.freebsd.org/changeset/base/334907 Log: lualoader: Process loader_conf_files properly loader.conf(5) documents loader_conf_files to mean "additional configuration files to be processed right after the present file." However, lualoader ignored loader_conf_files after processing /boot/defaults/loader.conf. Rewrite these bits to process loader_conf_files after each loaded file. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sun Jun 10 00:02:56 2018 (r334906) +++ head/stand/lua/config.lua Sun Jun 10 01:38:52 2018 (r334907) @@ -250,7 +250,34 @@ local function loadModule(mod, silent) return status end +local function readConfFiles(loaded_files) + local f = loader.getenv("loader_conf_files") + if f ~= nil then + for name in f:gmatch("([%w%p]+)%s*") do + if loaded_files[name] ~= nil then + goto continue + end + local prefiles = loader.getenv("loader_conf_files") + + print("Loading " .. name) + -- These may or may not exist, and that's ok. Do a + -- silent parse so that we complain on parse errors but + -- not for them simply not existing. + if not config.processFile(name, true) then + print(MSG_FAILPARSECFG:format(name)) + end + + loaded_files[name] = true + local newfiles = loader.getenv("loader_conf_files") + if prefiles ~= newfiles then + readConfFiles(loaded_files) + end + ::continue:: + end + end +end + local function readFile(name, silent) local f = io.open(name) if f == nil then @@ -467,17 +494,8 @@ function config.load(file, reloading) print(MSG_FAILPARSECFG:format(file)) end - local f = loader.getenv("loader_conf_files") - if f ~= nil then - for name in f:gmatch("([%w%p]+)%s*") do - -- These may or may not exist, and that's ok. Do a - -- silent parse so that we complain on parse errors but - -- not for them simply not existing. - if not config.processFile(name, true) then - print(MSG_FAILPARSECFG:format(name)) - end - end - end + local loaded_files = {file = true} + readConfFiles(loaded_files) checkNextboot()