Author: kevans
Date: Tue Feb 20 05:06:11 2018
New Revision: 329627
URL: https://svnweb.freebsd.org/changeset/base/329627

Log:
  stand/lua: Refactor brands into drawer.branddefs

Modified:
  head/stand/lua/drawer.lua

Modified: head/stand/lua/drawer.lua
==============================================================================
--- head/stand/lua/drawer.lua   Tue Feb 20 04:56:03 2018        (r329626)
+++ head/stand/lua/drawer.lua   Tue Feb 20 05:06:11 2018        (r329627)
@@ -171,6 +171,15 @@ orb = {
 
 none = {""};
 
+drawer.branddefs = {
+       ["fbsd"] = {
+               graphic = fbsd_logo,
+       },
+       ["none"] = {
+               graphic = none,
+       },
+};
+
 drawer.logodefs = {
        -- Indexed by valid values for loader_logo in loader.conf(5). Valid keys
        -- are: requires_color (boolean), logo (table depicting graphic), and
@@ -315,9 +324,11 @@ function drawer.drawbrand()
        local y = tonumber(loader.getenv("loader_brand_y")) or
            drawer.brand_position.y;
 
-       local logo = load("return " .. 
tostring(loader.getenv("loader_brand")))() or
-           fbsd_logo;
-       drawer.draw(x, y, logo);
+       local graphic = drawer.branddefs[loader.getenv("loader_brand")];
+       if (graphic == nil) then
+               graphic = fbsd_logo;
+       end
+       drawer.draw(x, y, graphic);
 end
 
 function shift_brand_text(shift)
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to