Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Feb 2018 01:10:04 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329684 - head/stand/lua
Message-ID:  <201802210110.w1L1A4sB095124@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Wed Feb 21 01:10:03 2018
New Revision: 329684
URL: https://svnweb.freebsd.org/changeset/base/329684

Log:
  lualoader: Drop terminating semicolons
  
  This was previously chosen out of convenience, as we had a mixed style and
  needed to be consistent. I started learning Lua on Friday, so I switched
  everything over. It is not a very lua-nic convention, though, so drop it.
  
  Excessive parenthesizing around conditionals is next on the chopping block.

Modified:
  head/stand/lua/color.lua
  head/stand/lua/config.lua
  head/stand/lua/core.lua
  head/stand/lua/drawer.lua
  head/stand/lua/loader.lua
  head/stand/lua/menu.lua
  head/stand/lua/password.lua
  head/stand/lua/screen.lua

Modified: head/stand/lua/color.lua
==============================================================================
--- head/stand/lua/color.lua	Wed Feb 21 00:24:54 2018	(r329683)
+++ head/stand/lua/color.lua	Wed Feb 21 01:10:03 2018	(r329684)
@@ -26,74 +26,74 @@
 -- $FreeBSD$
 --
 
-local core = require("core");
+local core = require("core")
 
-local color = {};
+local color = {}
 
 -- Module exports
-color.BLACK   = 0;
-color.RED     = 1;
-color.GREEN   = 2;
-color.YELLOW  = 3;
-color.BLUE    = 4;
-color.MAGENTA = 5;
-color.CYAN    = 6;
-color.WHITE   = 7;
+color.BLACK   = 0
+color.RED     = 1
+color.GREEN   = 2
+color.YELLOW  = 3
+color.BLUE    = 4
+color.MAGENTA = 5
+color.CYAN    = 6
+color.WHITE   = 7
 
-color.DEFAULT = 0;
-color.BRIGHT  = 1;
-color.DIM     = 2;
+color.DEFAULT = 0
+color.BRIGHT  = 1
+color.DIM     = 2
 
 function color.isEnabled()
-	local c = loader.getenv("loader_color");
+	local c = loader.getenv("loader_color")
 	if (c ~= nil) then
 		if (c:lower() == "no") or (c == "0") then
-			return false;
+			return false
 		end
 	end
-	return (not core.isSerialBoot());
+	return (not core.isSerialBoot())
 end
 
-color.disabled = (not color.isEnabled());
+color.disabled = (not color.isEnabled())
 
 function color.escapef(c)
 	if (color.disabled) then
-		return c;
+		return c
 	end
-	return "\027[3" .. c .. "m";
+	return "\027[3" .. c .. "m"
 end
 
 function color.escapeb(c)
 	if (color.disabled) then
-		return c;
+		return c
 	end
-	return "\027[4" .. c .. "m";
+	return "\027[4" .. c .. "m"
 end
 
 function color.escape(fg, bg, att)
 	if (color.disabled) then
-		return "";
+		return ""
 	end
 	if (not att) then
 		att = ""
 	else
-		att = att .. ";";
+		att = att .. ";"
 	end
-	return "\027[" .. att .. "3" .. fg .. ";4" .. bg .. "m";
+	return "\027[" .. att .. "3" .. fg .. ";4" .. bg .. "m"
 end
 
 function color.default()
 	if (color.disabled) then
-		return "";
+		return ""
 	end
-	return "\027[0;37;40m";
+	return "\027[0;37;40m"
 end
 
 function color.highlight(str)
 	if (color.disabled) then
-		return str;
+		return str
 	end
-	return "\027[1m" .. str .. "\027[0m";
+	return "\027[1m" .. str .. "\027[0m"
 end
 
-return color;
+return color

Modified: head/stand/lua/config.lua
==============================================================================
--- head/stand/lua/config.lua	Wed Feb 21 00:24:54 2018	(r329683)
+++ head/stand/lua/config.lua	Wed Feb 21 01:10:03 2018	(r329684)
@@ -27,12 +27,12 @@
 -- $FreeBSD$
 --
 
-local config = {};
+local config = {}
 
-local modules = {};
+local modules = {}
 
-local pattern_table;
-local carousel_choices = {};
+local pattern_table
+local carousel_choices = {}
 
 pattern_table = {
 	[1] = {
@@ -44,51 +44,51 @@ pattern_table = {
 		str = "^%s*([%w_]+)_load%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
 		process = function(k, v)
 			if (modules[k] == nil) then
-				modules[k] = {};
+				modules[k] = {}
 			end
-			modules[k].load = v:upper();
+			modules[k].load = v:upper()
 		end
 	},
 	--  module_name="value"
 	[3] = {
 		str = "^%s*([%w_]+)_name%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
 		process = function(k, v)
-			config.setKey(k, "name", v);
+			config.setKey(k, "name", v)
 		end
 	},
 	--  module_type="value"
 	[4] = {
 		str = "^%s*([%w_]+)_type%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
 		process = function(k, v)
-			config.setKey(k, "type", v);
+			config.setKey(k, "type", v)
 		end
 	},
 	--  module_flags="value"
 	[5] = {
 		str = "^%s*([%w_]+)_flags%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
 		process = function(k, v)
-			config.setKey(k, "flags", v);
+			config.setKey(k, "flags", v)
 		end
 	},
 	--  module_before="value"
 	[6] = {
 		str = "^%s*([%w_]+)_before%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
 		process = function(k, v)
-			config.setKey(k, "before", v);
+			config.setKey(k, "before", v)
 		end
 	},
 	--  module_after="value"
 	[7] = {
 		str = "^%s*([%w_]+)_after%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
 		process = function(k, v)
-			config.setKey(k, "after", v);
+			config.setKey(k, "after", v)
 		end
 	},
 	--  module_error="value"
 	[8] = {
 		str = "^%s*([%w_]+)_error%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
 		process = function(k, v)
-			config.setKey(k, "error", v);
+			config.setKey(k, "error", v)
 		end
 	},
 	--  exec="command"
@@ -96,7 +96,7 @@ pattern_table = {
 		str = "^%s*exec%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
 		process = function(k, v)
 			if (loader.perform(k) ~= 0) then
-				print("Failed to exec '" .. k .. "'");
+				print("Failed to exec '" .. k .. "'")
 			end
 		end
 	},
@@ -106,7 +106,7 @@ pattern_table = {
 		process = function(k, v)
 			if (config.setenv(k, v) ~= 0) then
 				print("Failed to set '" .. k ..
-				    "' with value: " .. v .. "");
+				    "' with value: " .. v .. "")
 			end
 		end
 	},
@@ -116,113 +116,113 @@ pattern_table = {
 		process = function(k, v)
 			if (config.setenv(k, v) ~= 0) then
 				print("Failed to set '" .. k ..
-				    "' with value: " .. v .. "");
+				    "' with value: " .. v .. "")
 			end
 		end
 	}
-};
+}
 
 -- Module exports
 -- Which variables we changed
-config.env_changed = {};
+config.env_changed = {}
 -- Values to restore env to (nil to unset)
-config.env_restore = {};
+config.env_restore = {}
 
 -- The first item in every carousel is always the default item.
 function config.getCarouselIndex(id)
-	local val = carousel_choices[id];
+	local val = carousel_choices[id]
 	if (val == nil) then
-		return 1;
+		return 1
 	end
-	return val;
+	return val
 end
 
 function config.setCarouselIndex(id, idx)
-	carousel_choices[id] = idx;
+	carousel_choices[id] = idx
 end
 
 function config.restoreEnv()
 	-- Examine changed environment variables
 	for k, v in pairs(config.env_changed) do
-		local restore_value = config.env_restore[k];
+		local restore_value = config.env_restore[k]
 		if (restore_value == nil) then
 			-- This one doesn't need restored for some reason
-			goto continue;
+			goto continue
 		end
-		local current_value = loader.getenv(k);
+		local current_value = loader.getenv(k)
 		if (current_value ~= v) then
 			-- This was overwritten by some action taken on the menu
 			-- most likely; we'll leave it be.
-			goto continue;
+			goto continue
 		end
-		restore_value = restore_value.value;
+		restore_value = restore_value.value
 		if (restore_value ~= nil) then
-			loader.setenv(k, restore_value);
+			loader.setenv(k, restore_value)
 		else
-			loader.unsetenv(k);
+			loader.unsetenv(k)
 		end
 		::continue::
 	end
 
-	config.env_changed = {};
-	config.env_restore = {};
+	config.env_changed = {}
+	config.env_restore = {}
 end
 
 function config.setenv(k, v)
 	-- Track the original value for this if we haven't already
 	if (config.env_restore[k] == nil) then
-		config.env_restore[k] = {value = loader.getenv(k)};
+		config.env_restore[k] = {value = loader.getenv(k)}
 	end
 
-	config.env_changed[k] = v;
+	config.env_changed[k] = v
 
-	return loader.setenv(k, v);
+	return loader.setenv(k, v)
 end
 
 function config.setKey(k, n, v)
 	if (modules[k] == nil) then
-		modules[k] = {};
+		modules[k] = {}
 	end
-	modules[k][n] = v;
+	modules[k][n] = v
 end
 
 function config.lsModules()
-	print("== Listing modules");
+	print("== Listing modules")
 	for k, v in pairs(modules) do
-		print(k, v.load);
+		print(k, v.load)
 	end
-	print("== List of modules ended");
+	print("== List of modules ended")
 end
 
 
 function config.isValidComment(c)
 	if (c ~= nil) then
-		local s = c:match("^%s*#.*");
+		local s = c:match("^%s*#.*")
 		if (s == nil) then
-			s = c:match("^%s*$");
+			s = c:match("^%s*$")
 		end
 		if (s == nil) then
-			return false;
+			return false
 		end
 	end
-	return true;
+	return true
 end
 
 function config.loadmod(mod, silent)
-	local status = true;
+	local status = true
 	for k, v in pairs(mod) do
 		if (v.load == "YES") then
-			local str = "load ";
+			local str = "load "
 			if (v.flags ~= nil) then
-				str = str .. v.flags .. " ";
+				str = str .. v.flags .. " "
 			end
 			if (v.type ~= nil) then
-				str = str .. "-t " .. v.type .. " ";
+				str = str .. "-t " .. v.type .. " "
 			end
 			if (v.name ~= nil) then
-				str = str .. v.name;
+				str = str .. v.name
 			else
-				str = str .. k;
+				str = str .. k
 			end
 
 			if (v.before ~= nil) then
@@ -231,21 +231,21 @@ function config.loadmod(mod, silent)
 						print("Failed to execute '" ..
 						    v.before ..
 						    "' before loading '" .. k ..
-						    "'");
+						    "'")
 					end
-					status = false;
+					status = false
 				end
 			end
 
 			if (loader.perform(str) ~= 0) then
 				if (not silent) then
 					print("Failed to execute '" .. str ..
-					    "'");
+					    "'")
 				end
 				if (v.error ~= nil) then
-					loader.perform(v.error);
+					loader.perform(v.error)
 				end
-				status = false;
+				status = false
 			end
 
 			if (v.after ~= nil) then
@@ -254,211 +254,211 @@ function config.loadmod(mod, silent)
 						print("Failed to execute '" ..
 						    v.after ..
 						    "' after loading '" .. k ..
-						    "'");
+						    "'")
 					end
-					status = false;
+					status = false
 				end
 			end
 
 		else
 			-- if not silent then
-				-- print("Skiping module '". . k .. "'");
+				-- print("Skiping module '". . k .. "'")
 			-- end
 		end
 	end
 
-	return status;
+	return status
 end
 
 function config.parse(name, silent)
-	local f = io.open(name);
+	local f = io.open(name)
 	if (f == nil) then
 		if (not silent) then
-			print("Failed to open config: '" .. name .. "'");
+			print("Failed to open config: '" .. name .. "'")
 		end
-		return false;
+		return false
 	end
 
-	local text;
-	local r;
+	local text
+	local r
 
-	text, r = io.read(f);
+	text, r = io.read(f)
 
 	if (text == nil) then
 		if (not silent) then
-			print("Failed to read config: '" .. name .. "'");
+			print("Failed to read config: '" .. name .. "'")
 		end
-		return false;
+		return false
 	end
 
-	local n = 1;
-	local status = true;
+	local n = 1
+	local status = true
 
 	for line in text:gmatch("([^\n]+)") do
 		if (line:match("^%s*$") == nil) then
-			local found = false;
+			local found = false
 
 			for i, val in ipairs(pattern_table) do
-				local k, v, c = line:match(val.str);
+				local k, v, c = line:match(val.str)
 				if (k ~= nil) then
-					found = true;
+					found = true
 
 					if (config.isValidComment(c)) then
-						val.process(k, v);
+						val.process(k, v)
 					else
 						print("Malformed line (" .. n ..
-						    "):\n\t'" .. line .. "'");
-						status = false;
+						    "):\n\t'" .. line .. "'")
+						status = false
 					end
 
-					break;
+					break
 				end
 			end
 
 			if (found == false) then
 				print("Malformed line (" .. n .. "):\n\t'" ..
-				    line .. "'");
-				status = false;
+				    line .. "'")
+				status = false
 			end
 		end
-		n = n + 1;
+		n = n + 1
 	end
 
-	return status;
+	return status
 end
 
 -- other_kernel is optionally the name of a kernel to load, if not the default
 -- or autoloaded default from the module_path
 function config.loadkernel(other_kernel)
-	local flags = loader.getenv("kernel_options") or "";
-	local kernel = other_kernel or loader.getenv("kernel");
+	local flags = loader.getenv("kernel_options") or ""
+	local kernel = other_kernel or loader.getenv("kernel")
 
 	local try_load = function (names)
 		for name in names:gmatch("([^;]+)%s*;?") do
-			r = loader.perform("load " .. flags .. " " .. name);
+			r = loader.perform("load " .. flags .. " " .. name)
 			if (r == 0) then
-				return name;
+				return name
 			end
 		end
-		return nil;
+		return nil
 	end
 
 	local load_bootfile = function()
-		local bootfile = loader.getenv("bootfile");
+		local bootfile = loader.getenv("bootfile")
 
 		-- append default kernel name
 		if (bootfile == nil) then
-			bootfile = "kernel";
+			bootfile = "kernel"
 		else
-			bootfile = bootfile .. ";kernel";
+			bootfile = bootfile .. ";kernel"
 		end
 
-		return try_load(bootfile);
+		return try_load(bootfile)
 	end
 
 	-- kernel not set, try load from default module_path
 	if (kernel == nil) then
-		local res = load_bootfile();
+		local res = load_bootfile()
 
 		if (res ~= nil) then
 			-- Default kernel is loaded
-			config.kernel_loaded = nil;
-			return true;
+			config.kernel_loaded = nil
+			return true
 		else
-			print("No kernel set, failed to load from module_path");
-			return false;
+			print("No kernel set, failed to load from module_path")
+			return false
 		end
 	else
 		-- Use our cached module_path, so we don't end up with multiple
 		-- automatically added kernel paths to our final module_path
-		local module_path = config.module_path;
-		local res = nil;
+		local module_path = config.module_path
+		local res = nil
 
 		if (other_kernel ~= nil) then
-			kernel = other_kernel;
+			kernel = other_kernel
 		end
 		-- first try load kernel with module_path = /boot/${kernel}
 		-- then try load with module_path=${kernel}
-		local paths = {"/boot/" .. kernel, kernel};
+		local paths = {"/boot/" .. kernel, kernel}
 
 		for k,v in pairs(paths) do
-			loader.setenv("module_path", v);
-			res = load_bootfile();
+			loader.setenv("module_path", v)
+			res = load_bootfile()
 
 			-- succeeded, add path to module_path
 			if (res ~= nil) then
-				config.kernel_loaded = kernel;
+				config.kernel_loaded = kernel
 				if (module_path ~= nil) then
 					loader.setenv("module_path", v .. ";" ..
-					    module_path);
+					    module_path)
 				end
-				return true;
+				return true
 			end
 		end
 
 		-- failed to load with ${kernel} as a directory
 		-- try as a file
-		res = try_load(kernel);
+		res = try_load(kernel)
 		if (res ~= nil) then
-			config.kernel_loaded = kernel;
-			return true;
+			config.kernel_loaded = kernel
+			return true
 		else
-			print("Failed to load kernel '" .. kernel .. "'");
-			return false;
+			print("Failed to load kernel '" .. kernel .. "'")
+			return false
 		end
 	end
 end
 
 function config.selectkernel(kernel)
-	config.kernel_selected = kernel;
+	config.kernel_selected = kernel
 end
 
 function config.load(file)
 	if (not file) then
-		file = "/boot/defaults/loader.conf";
+		file = "/boot/defaults/loader.conf"
 	end
 
 	if (not config.parse(file)) then
---		print("Failed to parse configuration: '" .. file .. "'");
+--		print("Failed to parse configuration: '" .. file .. "'")
 	end
 
-	local f = loader.getenv("loader_conf_files");
+	local f = loader.getenv("loader_conf_files")
 	if (f ~= nil) then
 		for name in f:gmatch("([%w%p]+)%s*") do
 			if (not config.parse(name)) then
 --				print("Failed to parse configuration: '" ..
---				    name .. "'");
+--				    name .. "'")
 			end
 		end
 	end
 
 	-- Cache the provided module_path at load time for later use
-	config.module_path = loader.getenv("module_path");
+	config.module_path = loader.getenv("module_path")
 end
 
 -- Reload configuration
 function config.reload(file)
-	modules = {};
-	config.restoreEnv();
-	config.load(file);
+	modules = {}
+	config.restoreEnv()
+	config.load(file)
 end
 
 function config.loadelf()
-	local kernel = config.kernel_selected or config.kernel_loaded;
-	local loaded = false;
+	local kernel = config.kernel_selected or config.kernel_loaded
+	local loaded = false
 
-	print("Loading kernel...");
-	loaded = config.loadkernel(kernel);
+	print("Loading kernel...")
+	loaded = config.loadkernel(kernel)
 
 	if (not loaded) then
-		print("Failed to load any kernel");
-		return;
+		print("Failed to load any kernel")
+		return
 	end
 
-	print("Loading configured modules...");
+	print("Loading configured modules...")
 	if (not config.loadmod(modules)) then
-		print("Could not load one or more modules!");
+		print("Could not load one or more modules!")
 	end
 end
 
-return config;
+return config

Modified: head/stand/lua/core.lua
==============================================================================
--- head/stand/lua/core.lua	Wed Feb 21 00:24:54 2018	(r329683)
+++ head/stand/lua/core.lua	Wed Feb 21 01:10:03 2018	(r329684)
@@ -26,15 +26,15 @@
 -- $FreeBSD$
 --
 
-local config = require('config');
+local config = require('config')
 
-local core = {};
+local core = {}
 
 local compose_loader_cmd = function(cmd_name, argstr)
 	if (argstr ~= nil) then
-		cmd_name = cmd_name .. " " .. argstr;
+		cmd_name = cmd_name .. " " .. argstr
 	end
-	return cmd_name;
+	return cmd_name
 end
 
 -- Internal function
@@ -44,162 +44,162 @@ end
 -- will need to be explicitly overwritten to false
 local parse_boot_args = function(argv, with_kernel)
 	if (#argv == 0) then
-		return nil, "";
+		return nil, ""
 	end
 	if (with_kernel == nil) then
-		with_kernel = true;
+		with_kernel = true
 	end
-	local kernel_name;
-	local argstr = "";
+	local kernel_name
+	local argstr = ""
 
 	for k, v in ipairs(argv) do
 		if (with_kernel) and (v:sub(1,1) ~= "-") then
-			kernel_name = v;
+			kernel_name = v
 		else
-			argstr = argstr .. " " .. v;
+			argstr = argstr .. " " .. v
 		end
 	end
 	if (with_kernel) then
-		return kernel_name, argstr;
+		return kernel_name, argstr
 	else
-		return argstr;
+		return argstr
 	end
 end
 
 -- Globals
 function boot(...)
-	local argv = {...};
-	local cmd_name = "";
-	cmd_name, argv = core.popFrontTable(argv);
-	local kernel, argstr = parse_boot_args(argv);
+	local argv = {...}
+	local cmd_name = ""
+	cmd_name, argv = core.popFrontTable(argv)
+	local kernel, argstr = parse_boot_args(argv)
 	if (kernel ~= nil) then
-		loader.perform("unload");
-		config.selectkernel(kernel);
+		loader.perform("unload")
+		config.selectkernel(kernel)
 	end
-	core.boot(argstr);
+	core.boot(argstr)
 end
 
 function autoboot(...)
 	local argv = {...}
-	local cmd_name = "";
-	cmd_name, argv = core.popFrontTable(argv);
-	local argstr = parse_boot_args(argv, false);
-	core.autoboot(argstr);
+	local cmd_name = ""
+	cmd_name, argv = core.popFrontTable(argv)
+	local argstr = parse_boot_args(argv, false)
+	core.autoboot(argstr)
 end
 
 -- Module exports
 -- Commonly appearing constants
-core.KEY_BACKSPACE	= 8;
-core.KEY_ENTER		= 13;
-core.KEY_DELETE		= 127;
+core.KEY_BACKSPACE	= 8
+core.KEY_ENTER		= 13
+core.KEY_DELETE		= 127
 
-core.KEYSTR_ESCAPE	= "\027";
+core.KEYSTR_ESCAPE	= "\027"
 
-core.MENU_RETURN	= "return";
-core.MENU_ENTRY		= "entry";
-core.MENU_SEPARATOR	= "separator";
-core.MENU_SUBMENU	= "submenu";
-core.MENU_CAROUSEL_ENTRY	= "carousel_entry";
+core.MENU_RETURN	= "return"
+core.MENU_ENTRY		= "entry"
+core.MENU_SEPARATOR	= "separator"
+core.MENU_SUBMENU	= "submenu"
+core.MENU_CAROUSEL_ENTRY	= "carousel_entry"
 
 function core.setVerbose(b)
 	if (b == nil) then
-		b = not core.verbose;
+		b = not core.verbose
 	end
 
 	if (b == true) then
-		loader.setenv("boot_verbose", "YES");
+		loader.setenv("boot_verbose", "YES")
 	else
-		loader.unsetenv("boot_verbose");
+		loader.unsetenv("boot_verbose")
 	end
-	core.verbose = b;
+	core.verbose = b
 end
 
 function core.setSingleUser(b)
 	if (b == nil) then
-		b = not core.su;
+		b = not core.su
 	end
 
 	if (b == true) then
-		loader.setenv("boot_single", "YES");
+		loader.setenv("boot_single", "YES")
 	else
-		loader.unsetenv("boot_single");
+		loader.unsetenv("boot_single")
 	end
-	core.su = b;
+	core.su = b
 end
 
 function core.getACPIPresent(checkingSystemDefaults)
-	local c = loader.getenv("hint.acpi.0.rsdp");
+	local c = loader.getenv("hint.acpi.0.rsdp")
 
 	if (c ~= nil) then
 		if (checkingSystemDefaults == true) then
-			return true;
+			return true
 		end
 		-- Otherwise, respect disabled if it's set
-		c = loader.getenv("hint.acpi.0.disabled");
-		return (c == nil) or (tonumber(c) ~= 1);
+		c = loader.getenv("hint.acpi.0.disabled")
+		return (c == nil) or (tonumber(c) ~= 1)
 	end
-	return false;
+	return false
 end
 
 function core.setACPI(b)
 	if (b == nil) then
-		b = not core.acpi;
+		b = not core.acpi
 	end
 
 	if (b == true) then
-		loader.setenv("acpi_load", "YES");
-		loader.setenv("hint.acpi.0.disabled", "0");
-		loader.unsetenv("loader.acpi_disabled_by_user");
+		loader.setenv("acpi_load", "YES")
+		loader.setenv("hint.acpi.0.disabled", "0")
+		loader.unsetenv("loader.acpi_disabled_by_user")
 	else
-		loader.unsetenv("acpi_load");
-		loader.setenv("hint.acpi.0.disabled", "1");
-		loader.setenv("loader.acpi_disabled_by_user", "1");
+		loader.unsetenv("acpi_load")
+		loader.setenv("hint.acpi.0.disabled", "1")
+		loader.setenv("loader.acpi_disabled_by_user", "1")
 	end
-	core.acpi = b;
+	core.acpi = b
 end
 
 function core.setSafeMode(b)
 	if (b == nil) then
-		b = not core.sm;
+		b = not core.sm
 	end
 	if (b == true) then
-		loader.setenv("kern.smp.disabled", "1");
-		loader.setenv("hw.ata.ata_dma", "0");
-		loader.setenv("hw.ata.atapi_dma", "0");
-		loader.setenv("hw.ata.wc", "0");
-		loader.setenv("hw.eisa_slots", "0");
-		loader.setenv("kern.eventtimer.periodic", "1");
-		loader.setenv("kern.geom.part.check_integrity", "0");
+		loader.setenv("kern.smp.disabled", "1")
+		loader.setenv("hw.ata.ata_dma", "0")
+		loader.setenv("hw.ata.atapi_dma", "0")
+		loader.setenv("hw.ata.wc", "0")
+		loader.setenv("hw.eisa_slots", "0")
+		loader.setenv("kern.eventtimer.periodic", "1")
+		loader.setenv("kern.geom.part.check_integrity", "0")
 	else
-		loader.unsetenv("kern.smp.disabled");
-		loader.unsetenv("hw.ata.ata_dma");
-		loader.unsetenv("hw.ata.atapi_dma");
-		loader.unsetenv("hw.ata.wc");
-		loader.unsetenv("hw.eisa_slots");
-		loader.unsetenv("kern.eventtimer.periodic");
-		loader.unsetenv("kern.geom.part.check_integrity");
+		loader.unsetenv("kern.smp.disabled")
+		loader.unsetenv("hw.ata.ata_dma")
+		loader.unsetenv("hw.ata.atapi_dma")
+		loader.unsetenv("hw.ata.wc")
+		loader.unsetenv("hw.eisa_slots")
+		loader.unsetenv("kern.eventtimer.periodic")
+		loader.unsetenv("kern.geom.part.check_integrity")
 	end
-	core.sm = b;
+	core.sm = b
 end
 
 function core.kernelList()
-	local k = loader.getenv("kernel");
-	local v = loader.getenv("kernels") or "";
+	local k = loader.getenv("kernel")
+	local v = loader.getenv("kernels") or ""
 
-	local kernels = {};
-	local unique = {};
-	local i = 0;
+	local kernels = {}
+	local unique = {}
+	local i = 0
 	if (k ~= nil) then
-		i = i + 1;
-		kernels[i] = k;
-		unique[k] = true;
+		i = i + 1
+		kernels[i] = k
+		unique[k] = true
 	end
 
 	for n in v:gmatch("([^; ]+)[; ]?") do
 		if (unique[n] == nil) then
-			i = i + 1;
-			kernels[i] = n;
-			unique[n] = true;
+			i = i + 1
+			kernels[i] = n
+			unique[n] = true
 		end
 	end
 
@@ -207,89 +207,89 @@ function core.kernelList()
 	-- heuristic.  Any directory in /boot that contains an ordinary file
 	-- named "kernel" is considered eligible.
 	for file in lfs.dir("/boot") do
-		local fname = "/boot/" .. file;
+		local fname = "/boot/" .. file
 
 		if (file == "." or file == "..") then
-			goto continue;
+			goto continue
 		end
 
 		if (lfs.attributes(fname, "mode") ~= "directory") then
-			goto continue;
+			goto continue
 		end
 
 		if (lfs.attributes(fname .. "/kernel", "mode") ~= "file") then
-			goto continue;
+			goto continue
 		end
 
 		if (unique[file] == nil) then
-			i = i + 1;
-			kernels[i] = file;
-			unique[file] = true;
+			i = i + 1
+			kernels[i] = file
+			unique[file] = true
 		end
 
 		::continue::
 	end
-	return kernels;
+	return kernels
 end
 
 function core.setDefaults()
-	core.setACPI(core.getACPIPresent(true));
-	core.setSafeMode(false);
-	core.setSingleUser(false);
-	core.setVerbose(false);
+	core.setACPI(core.getACPIPresent(true))
+	core.setSafeMode(false)
+	core.setSingleUser(false)
+	core.setVerbose(false)
 end
 
 function core.autoboot(argstr)
-	config.loadelf();
-	loader.perform(compose_loader_cmd("autoboot", argstr));
+	config.loadelf()
+	loader.perform(compose_loader_cmd("autoboot", argstr))
 end
 
 function core.boot(argstr)
-	config.loadelf();
-	loader.perform(compose_loader_cmd("boot", argstr));
+	config.loadelf()
+	loader.perform(compose_loader_cmd("boot", argstr))
 end
 
 function core.isSingleUserBoot()
-	local single_user = loader.getenv("boot_single");
-	return single_user ~= nil and single_user:lower() == "yes";
+	local single_user = loader.getenv("boot_single")
+	return single_user ~= nil and single_user:lower() == "yes"
 end
 
 function core.isSerialBoot()
-	local c = loader.getenv("console");
+	local c = loader.getenv("console")
 
 	if (c ~= nil) then
 		if (c:find("comconsole") ~= nil) then
-			return true;
+			return true

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802210110.w1L1A4sB095124>