1196200Sscottl-- 2196200Sscottl-- SPDX-License-Identifier: BSD-2-Clause 3196200Sscottl-- 4196200Sscottl-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org> 5196200Sscottl-- Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org> 6196200Sscottl-- All rights reserved. 7196200Sscottl-- 8196200Sscottl-- Redistribution and use in source and binary forms, with or without 9196200Sscottl-- modification, are permitted provided that the following conditions 10196200Sscottl-- are met: 11196200Sscottl-- 1. Redistributions of source code must retain the above copyright 12196200Sscottl-- notice, this list of conditions and the following disclaimer. 13196200Sscottl-- 2. Redistributions in binary form must reproduce the above copyright 14196200Sscottl-- notice, this list of conditions and the following disclaimer in the 15196200Sscottl-- documentation and/or other materials provided with the distribution. 16196200Sscottl-- 17196200Sscottl-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18196200Sscottl-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19196200Sscottl-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20196200Sscottl-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21196200Sscottl-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22196200Sscottl-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23196200Sscottl-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24196200Sscottl-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25196200Sscottl-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26196200Sscottl-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27196200Sscottl-- SUCH DAMAGE. 28196200Sscottl-- 29196200Sscottl 30196200Sscottl-- The cli module should be included first here. Some of the functions that it 31196200Sscottl-- defines are necessary for the Lua-based loader to operate in general. 32196200Sscottl-- Other modules will also need some of the functions it defines to safely 33196200Sscottl-- execute loader commands. 34196200Sscottlrequire("cli") 35196200Sscottllocal color = require("color") 36196200Sscottllocal core = require("core") 37196200Sscottllocal config = require("config") 38196200Sscottllocal password = require("password") 39196200Sscottl 40196200Sscottlconfig.load() 41196200Sscottl 42196200Sscottlif core.isUEFIBoot() then 43196200Sscottl loader.perform("efi-autoresizecons") 44196200Sscottlend 45196200Sscottl-- Our console may have been setup with different settings before we get 46196200Sscottl-- here, so make sure we reset everything back to default. 47196200Sscottlif color.isEnabled() then 48196200Sscottl printc(core.KEYSTR_RESET) 49196200Sscottlend 50196200Sscottltry_include("local") 51196200Sscottlpassword.check() 52196200Sscottlif not core.isMenuSkipped() then 53196200Sscottl require("menu").run() 54196200Sscottlelse 55196200Sscottl -- Load kernel/modules before we go 56196200Sscottl config.loadelf() 57196200Sscottlend 58196200Sscottl