svn commit: r331859 - head/stand/lua
Kyle Evans
kevans at FreeBSD.org
Sun Apr 1 01:07:17 UTC 2018
Author: kevans
Date: Sun Apr 1 01:07:15 2018
New Revision: 331859
URL: https://svnweb.freebsd.org/changeset/base/331859
Log:
lualoader: Split logodefs out into logo-* files
This commit splits all of the logodefs/graphics out into their own own files
and provides a method for these files to register their logodefs with the
drawer. Graphics are now loaded on demand if they don't exist in the current
set of logodefs.
The drawer module becomes a little easier to navigate through without all of
the graphics mixed in. It's also easy to do one-off graphics like the
9.2 Die Hard tribute by dteske@ without adding even more to our memory
requirements.
Added:
head/stand/lua/logo-beastie.lua (contents, props changed)
head/stand/lua/logo-beastiebw.lua (contents, props changed)
head/stand/lua/logo-fbsdbw.lua (contents, props changed)
head/stand/lua/logo-orb.lua (contents, props changed)
head/stand/lua/logo-orbbw.lua (contents, props changed)
Modified:
head/stand/lua/Makefile
head/stand/lua/drawer.lua
Modified: head/stand/lua/Makefile
==============================================================================
--- head/stand/lua/Makefile Sun Apr 1 00:25:47 2018 (r331858)
+++ head/stand/lua/Makefile Sun Apr 1 01:07:15 2018 (r331859)
@@ -10,6 +10,11 @@ FILES= cli.lua \
drawer.lua \
hook.lua \
loader.lua \
+ logo-beastie.lua \
+ logo-beastiebw.lua \
+ logo-fbsdbw.lua \
+ logo-orb.lua \
+ logo-orbbw.lua \
menu.lua \
password.lua \
screen.lua
Modified: head/stand/lua/drawer.lua
==============================================================================
--- head/stand/lua/drawer.lua Sun Apr 1 00:25:47 2018 (r331858)
+++ head/stand/lua/drawer.lua Sun Apr 1 01:07:15 2018 (r331859)
@@ -36,12 +36,7 @@ local screen = require("screen")
local drawer = {}
-local fbsd_logo
-local beastie_color
-local beastie
-local fbsd_logo_v
-local orb_color
-local orb
+local fbsd_brand
local none
local function menuEntryName(drawing_menu, entry)
@@ -56,7 +51,20 @@ local function menuEntryName(drawing_menu, entry)
return entry.name
end
-fbsd_logo = {
+local function getLogodef(logo)
+ -- Look it up
+ local logodef = drawer.logodefs[logo]
+
+ -- Try to pull it in
+ if logodef == nil then
+ try_include('logo-' .. logo)
+ logodef = drawer.logodefs[logo]
+ end
+
+ return logodef
+end
+
+fbsd_brand = {
" ______ ____ _____ _____ ",
" | ____| | _ \\ / ____| __ \\ ",
" | |___ _ __ ___ ___ | |_) | (___ | | | |",
@@ -65,103 +73,6 @@ fbsd_logo = {
" | | | | | | || | | |",
" |_| |_| \\___|\\___||____/|_____/|_____/ "
}
-
-beastie_color = {
-" \027[31m, ,",
-" /( )`",
-" \\ \\___ / |",
-" /- \027[37m_\027[31m `-/ '",
-" (\027[37m/\\/ \\\027[31m \\ /\\",
-" \027[37m/ / |\027[31m ` \\",
-" \027[34mO O \027[37m) \027[31m/ |",
-" \027[37m`-^--'\027[31m`< '",
-" (_.) _ ) /",
-" `.___/` /",
-" `-----' /",
-" \027[33m<----.\027[31m __ / __ \\",
-" \027[33m<----|====\027[31mO)))\027[33m==\027[31m) \\) /\027[33m====|",
-" \027[33m<----'\027[31m `--' `.__,' \\",
-" | |",
-" \\ / /\\",
-" \027[36m______\027[31m( (_ / \\______/",
-" \027[36m,' ,-----' |",
-" `--{__________)\027[37m"
-}
-
-beastie = {
-" , ,",
-" /( )`",
-" \\ \\___ / |",
-" /- _ `-/ '",
-" (/\\/ \\ \\ /\\",
-" / / | ` \\",
-" O O ) / |",
-" `-^--'`< '",
-" (_.) _ ) /",
-" `.___/` /",
-" `-----' /",
-" <----. __ / __ \\",
-" <----|====O)))==) \\) /====|",
-" <----' `--' `.__,' \\",
-" | |",
-" \\ / /\\",
-" ______( (_ / \\______/",
-" ,' ,-----' |",
-" `--{__________)"
-}
-
-fbsd_logo_v = {
-" ______",
-" | ____| __ ___ ___ ",
-" | |__ | '__/ _ \\/ _ \\",
-" | __|| | | __/ __/",
-" | | | | | | |",
-" |_| |_| \\___|\\___|",
-" ____ _____ _____",
-" | _ \\ / ____| __ \\",
-" | |_) | (___ | | | |",
-" | _ < \\___ \\| | | |",
-" | |_) |____) | |__| |",
-" | | | |",
-" |____/|_____/|_____/"
-}
-
-orb_color = {
-" \027[31m``` \027[31;1m`\027[31m",
-" s` `.....---...\027[31;1m....--.``` -/\027[31m",
-" +o .--` \027[31;1m/y:` +.\027[31m",
-" yo`:. \027[31;1m:o `+-\027[31m",
-" y/ \027[31;1m-/` -o/\027[31m",
-" .- \027[31;1m::/sy+:.\027[31m",
-" / \027[31;1m`-- /\027[31m",
-" `: \027[31;1m:`\027[31m",
-" `: \027[31;1m:`\027[31m",
-" / \027[31;1m/\027[31m",
-" .- \027[31;1m-.\027[31m",
-" -- \027[31;1m-.\027[31m",
-" `:` \027[31;1m`:`",
-" \027[31;1m.-- `--.",
-" .---.....----.\027[37m"
-}
-
-orb = {
-" ``` `",
-" s` `.....---.......--.``` -/",
-" +o .--` /y:` +.",
-" yo`:. :o `+-",
-" y/ -/` -o/",
-" .- ::/sy+:.",
-" / `-- /",
-" `: :`",
-" `: :`",
-" / /",
-" .- -.",
-" -- -.",
-" `:` `:`",
-" .-- `--.",
-" .---.....----."
-}
-
none = {""}
-- Module exports
@@ -205,42 +116,30 @@ drawer.branddefs = {
-- Indexed by valid values for loader_brand in loader.conf(5). Valid
-- keys are: graphic (table depicting graphic)
["fbsd"] = {
- graphic = fbsd_logo,
+ graphic = fbsd_brand,
},
["none"] = {
graphic = none,
},
}
+function drawer.addBrand(name, def)
+ drawer.branddefs[name] = def
+end
+
+function drawer.addLogo(name, def)
+ drawer.logodefs[name] = def
+end
+
drawer.logodefs = {
-- Indexed by valid values for loader_logo in loader.conf(5). Valid keys
-- are: requires_color (boolean), graphic (table depicting graphic), and
-- shift (table containing x and y).
- ["beastie"] = {
- requires_color = true,
- graphic = beastie_color,
- },
- ["beastiebw"] = {
- graphic = beastie,
- },
- ["fbsdbw"] = {
- graphic = fbsd_logo_v,
- shift = {x = 5, y = 4},
- },
- ["orb"] = {
- requires_color = true,
- graphic = orb_color,
- shift = {x = 2, y = 4},
- },
- ["orbbw"] = {
- graphic = orb,
- shift = {x = 2, y = 4},
- },
["tribute"] = {
- graphic = fbsd_logo,
+ graphic = fbsd_brand,
},
["tributebw"] = {
- graphic = fbsd_logo,
+ graphic = fbsd_brand,
},
["none"] = {
graphic = none,
@@ -413,10 +312,8 @@ function drawer.drawbrand()
local y = tonumber(loader.getenv("loader_brand_y")) or
drawer.brand_position.y
- local graphic = drawer.branddefs[loader.getenv("loader_brand")]
- if graphic == nil then
- graphic = fbsd_logo
- end
+ local graphic = drawer.branddefs[loader.getenv("loader_brand")] or
+ fbsd_brand
x = x + drawer.shift.x
y = y + drawer.shift.y
@@ -432,16 +329,15 @@ function drawer.drawlogo()
local logo = loader.getenv("loader_logo")
local colored = color.isEnabled()
- -- Lookup
- local logodef = drawer.logodefs[logo]
+ local logodef = getLogodef(logo)
if logodef == nil or logodef.graphic == nil or
(not colored and logodef.requires_color) then
-- Choose a sensible default
if colored then
- logodef = drawer.logodefs["orb"]
+ logodef = getLogodef("orb")
else
- logodef = drawer.logodefs["orbbw"]
+ logodef = getLogodef("orbbw")
end
end
Added: head/stand/lua/logo-beastie.lua
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/stand/lua/logo-beastie.lua Sun Apr 1 01:07:15 2018 (r331859)
@@ -0,0 +1,60 @@
+--
+-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+--
+-- Copyright (c) 2018 Kyle Evans <kevans at FreeBSD.org>
+-- All rights reserved.
+--
+-- Redistribution and use in source and binary forms, with or without
+-- modification, are permitted provided that the following conditions
+-- are met:
+-- 1. Redistributions of source code must retain the above copyright
+-- notice, this list of conditions and the following disclaimer.
+-- 2. Redistributions in binary form must reproduce the above copyright
+-- notice, this list of conditions and the following disclaimer in the
+-- documentation and/or other materials provided with the distribution.
+--
+-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+-- SUCH DAMAGE.
+--
+-- $FreeBSD$
+--
+
+local drawer = require("drawer")
+
+local beastie_color = {
+" \027[31m, ,",
+" /( )`",
+" \\ \\___ / |",
+" /- \027[37m_\027[31m `-/ '",
+" (\027[37m/\\/ \\\027[31m \\ /\\",
+" \027[37m/ / |\027[31m ` \\",
+" \027[34mO O \027[37m) \027[31m/ |",
+" \027[37m`-^--'\027[31m`< '",
+" (_.) _ ) /",
+" `.___/` /",
+" `-----' /",
+" \027[33m<----.\027[31m __ / __ \\",
+" \027[33m<----|====\027[31mO)))\027[33m==\027[31m) \\) /\027[33m====|",
+" \027[33m<----'\027[31m `--' `.__,' \\",
+" | |",
+" \\ / /\\",
+" \027[36m______\027[31m( (_ / \\______/",
+" \027[36m,' ,-----' |",
+" `--{__________)\027[37m"
+}
+
+drawer.addLogo("beastie", {
+ requires_color = true,
+ graphic = beastie_color,
+})
+
+return true
Added: head/stand/lua/logo-beastiebw.lua
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/stand/lua/logo-beastiebw.lua Sun Apr 1 01:07:15 2018 (r331859)
@@ -0,0 +1,59 @@
+--
+-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+--
+-- Copyright (c) 2018 Kyle Evans <kevans at FreeBSD.org>
+-- All rights reserved.
+--
+-- Redistribution and use in source and binary forms, with or without
+-- modification, are permitted provided that the following conditions
+-- are met:
+-- 1. Redistributions of source code must retain the above copyright
+-- notice, this list of conditions and the following disclaimer.
+-- 2. Redistributions in binary form must reproduce the above copyright
+-- notice, this list of conditions and the following disclaimer in the
+-- documentation and/or other materials provided with the distribution.
+--
+-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+-- SUCH DAMAGE.
+--
+-- $FreeBSD$
+--
+
+local drawer = require("drawer")
+
+local beastiebw = {
+" , ,",
+" /( )`",
+" \\ \\___ / |",
+" /- _ `-/ '",
+" (/\\/ \\ \\ /\\",
+" / / | ` \\",
+" O O ) / |",
+" `-^--'`< '",
+" (_.) _ ) /",
+" `.___/` /",
+" `-----' /",
+" <----. __ / __ \\",
+" <----|====O)))==) \\) /====|",
+" <----' `--' `.__,' \\",
+" | |",
+" \\ / /\\",
+" ______( (_ / \\______/",
+" ,' ,-----' |",
+" `--{__________)"
+}
+
+drawer.addLogo("beastiebw", {
+ graphic = beastiebw,
+})
+
+return true
Added: head/stand/lua/logo-fbsdbw.lua
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/stand/lua/logo-fbsdbw.lua Sun Apr 1 01:07:15 2018 (r331859)
@@ -0,0 +1,54 @@
+--
+-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+--
+-- Copyright (c) 2018 Kyle Evans <kevans at FreeBSD.org>
+-- All rights reserved.
+--
+-- Redistribution and use in source and binary forms, with or without
+-- modification, are permitted provided that the following conditions
+-- are met:
+-- 1. Redistributions of source code must retain the above copyright
+-- notice, this list of conditions and the following disclaimer.
+-- 2. Redistributions in binary form must reproduce the above copyright
+-- notice, this list of conditions and the following disclaimer in the
+-- documentation and/or other materials provided with the distribution.
+--
+-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+-- SUCH DAMAGE.
+--
+-- $FreeBSD$
+--
+
+local drawer = require("drawer")
+
+local fbsd_logo = {
+" ______",
+" | ____| __ ___ ___ ",
+" | |__ | '__/ _ \\/ _ \\",
+" | __|| | | __/ __/",
+" | | | | | | |",
+" |_| |_| \\___|\\___|",
+" ____ _____ _____",
+" | _ \\ / ____| __ \\",
+" | |_) | (___ | | | |",
+" | _ < \\___ \\| | | |",
+" | |_) |____) | |__| |",
+" | | | |",
+" |____/|_____/|_____/"
+}
+
+drawer.addLogo("fbsdbw", {
+ graphic = fbsd_logo,
+ shift = {x = 5, y = 4},
+})
+
+return true
Added: head/stand/lua/logo-orb.lua
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/stand/lua/logo-orb.lua Sun Apr 1 01:07:15 2018 (r331859)
@@ -0,0 +1,57 @@
+--
+-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+--
+-- Copyright (c) 2018 Kyle Evans <kevans at FreeBSD.org>
+-- All rights reserved.
+--
+-- Redistribution and use in source and binary forms, with or without
+-- modification, are permitted provided that the following conditions
+-- are met:
+-- 1. Redistributions of source code must retain the above copyright
+-- notice, this list of conditions and the following disclaimer.
+-- 2. Redistributions in binary form must reproduce the above copyright
+-- notice, this list of conditions and the following disclaimer in the
+-- documentation and/or other materials provided with the distribution.
+--
+-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+-- SUCH DAMAGE.
+--
+-- $FreeBSD$
+--
+
+local drawer = require("drawer")
+
+local orb_color = {
+" \027[31m``` \027[31;1m`\027[31m",
+" s` `.....---...\027[31;1m....--.``` -/\027[31m",
+" +o .--` \027[31;1m/y:` +.\027[31m",
+" yo`:. \027[31;1m:o `+-\027[31m",
+" y/ \027[31;1m-/` -o/\027[31m",
+" .- \027[31;1m::/sy+:.\027[31m",
+" / \027[31;1m`-- /\027[31m",
+" `: \027[31;1m:`\027[31m",
+" `: \027[31;1m:`\027[31m",
+" / \027[31;1m/\027[31m",
+" .- \027[31;1m-.\027[31m",
+" -- \027[31;1m-.\027[31m",
+" `:` \027[31;1m`:`",
+" \027[31;1m.-- `--.",
+" .---.....----.\027[37m"
+}
+
+drawer.addLogo("orb", {
+ requires_color = true,
+ graphic = orb_color,
+ shift = {x = 2, y = 4},
+})
+
+return true
Added: head/stand/lua/logo-orbbw.lua
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/stand/lua/logo-orbbw.lua Sun Apr 1 01:07:15 2018 (r331859)
@@ -0,0 +1,56 @@
+--
+-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+--
+-- Copyright (c) 2018 Kyle Evans <kevans at FreeBSD.org>
+-- All rights reserved.
+--
+-- Redistribution and use in source and binary forms, with or without
+-- modification, are permitted provided that the following conditions
+-- are met:
+-- 1. Redistributions of source code must retain the above copyright
+-- notice, this list of conditions and the following disclaimer.
+-- 2. Redistributions in binary form must reproduce the above copyright
+-- notice, this list of conditions and the following disclaimer in the
+-- documentation and/or other materials provided with the distribution.
+--
+-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+-- SUCH DAMAGE.
+--
+-- $FreeBSD$
+--
+
+local drawer = require("drawer")
+
+local orbbw = {
+" ``` `",
+" s` `.....---.......--.``` -/",
+" +o .--` /y:` +.",
+" yo`:. :o `+-",
+" y/ -/` -o/",
+" .- ::/sy+:.",
+" / `-- /",
+" `: :`",
+" `: :`",
+" / /",
+" .- -.",
+" -- -.",
+" `:` `:`",
+" .-- `--.",
+" .---.....----."
+}
+
+drawer.addLogo("orbbw", {
+ graphic = orbbw,
+ shift = {x = 2, y = 4},
+})
+
+return true
More information about the svn-src-head
mailing list