core.lua (322a2dddba49d04539cc130cd2264a00db45c20d) | core.lua (04af422907599825aa89cce0399932835d414103) |
---|---|
1-- 2-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3-- 4-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org> 5-- Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org> 6-- All rights reserved. 7-- 8-- Redistribution and use in source and binary forms, with or without --- 40 unchanged lines hidden (view full) --- 49core.KEYSTR_ESCAPE = "\027" 50 51core.MENU_RETURN = "return" 52core.MENU_ENTRY = "entry" 53core.MENU_SEPARATOR = "separator" 54core.MENU_SUBMENU = "submenu" 55core.MENU_CAROUSEL_ENTRY = "carousel_entry" 56 | 1-- 2-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3-- 4-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org> 5-- Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org> 6-- All rights reserved. 7-- 8-- Redistribution and use in source and binary forms, with or without --- 40 unchanged lines hidden (view full) --- 49core.KEYSTR_ESCAPE = "\027" 50 51core.MENU_RETURN = "return" 52core.MENU_ENTRY = "entry" 53core.MENU_SEPARATOR = "separator" 54core.MENU_SUBMENU = "submenu" 55core.MENU_CAROUSEL_ENTRY = "carousel_entry" 56 |
57function core.setVerbose(b) 58 if b == nil then 59 b = not core.verbose | 57function core.setVerbose(verbose) 58 if verbose == nil then 59 verbose = not core.verbose |
60 end 61 | 60 end 61 |
62 if b then | 62 if verbose then |
63 loader.setenv("boot_verbose", "YES") 64 else 65 loader.unsetenv("boot_verbose") 66 end | 63 loader.setenv("boot_verbose", "YES") 64 else 65 loader.unsetenv("boot_verbose") 66 end |
67 core.verbose = b | 67 core.verbose = verbose |
68end 69 | 68end 69 |
70function core.setSingleUser(b) 71 if b == nil then 72 b = not core.su | 70function core.setSingleUser(single_user) 71 if single_user == nil then 72 single_user = not core.su |
73 end 74 | 73 end 74 |
75 if b then | 75 if single_user then |
76 loader.setenv("boot_single", "YES") 77 else 78 loader.unsetenv("boot_single") 79 end | 76 loader.setenv("boot_single", "YES") 77 else 78 loader.unsetenv("boot_single") 79 end |
80 core.su = b | 80 core.su = single_user |
81end 82 | 81end 82 |
83function core.getACPIPresent(checkingSystemDefaults) | 83function core.getACPIPresent(checking_system_defaults) |
84 local c = loader.getenv("hint.acpi.0.rsdp") 85 86 if c ~= nil then | 84 local c = loader.getenv("hint.acpi.0.rsdp") 85 86 if c ~= nil then |
87 if checkingSystemDefaults then | 87 if checking_system_defaults then |
88 return true 89 end 90 -- Otherwise, respect disabled if it's set 91 c = loader.getenv("hint.acpi.0.disabled") 92 return c == nil or tonumber(c) ~= 1 93 end 94 return false 95end 96 | 88 return true 89 end 90 -- Otherwise, respect disabled if it's set 91 c = loader.getenv("hint.acpi.0.disabled") 92 return c == nil or tonumber(c) ~= 1 93 end 94 return false 95end 96 |
97function core.setACPI(b) 98 if b == nil then 99 b = not core.acpi | 97function core.setACPI(acpi) 98 if acpi == nil then 99 acpi = not core.acpi |
100 end 101 | 100 end 101 |
102 if b then | 102 if acpi then |
103 loader.setenv("acpi_load", "YES") 104 loader.setenv("hint.acpi.0.disabled", "0") 105 loader.unsetenv("loader.acpi_disabled_by_user") 106 else 107 loader.unsetenv("acpi_load") 108 loader.setenv("hint.acpi.0.disabled", "1") 109 loader.setenv("loader.acpi_disabled_by_user", "1") 110 end | 103 loader.setenv("acpi_load", "YES") 104 loader.setenv("hint.acpi.0.disabled", "0") 105 loader.unsetenv("loader.acpi_disabled_by_user") 106 else 107 loader.unsetenv("acpi_load") 108 loader.setenv("hint.acpi.0.disabled", "1") 109 loader.setenv("loader.acpi_disabled_by_user", "1") 110 end |
111 core.acpi = b | 111 core.acpi = acpi |
112end 113 | 112end 113 |
114function core.setSafeMode(b) 115 if b == nil then 116 b = not core.sm | 114function core.setSafeMode(safe_mode) 115 if safe_mode == nil then 116 safe_mode = not core.sm |
117 end | 117 end |
118 if b then | 118 if safe_mode then |
119 loader.setenv("kern.smp.disabled", "1") 120 loader.setenv("hw.ata.ata_dma", "0") 121 loader.setenv("hw.ata.atapi_dma", "0") 122 loader.setenv("hw.ata.wc", "0") 123 loader.setenv("hw.eisa_slots", "0") 124 loader.setenv("kern.eventtimer.periodic", "1") 125 loader.setenv("kern.geom.part.check_integrity", "0") 126 else 127 loader.unsetenv("kern.smp.disabled") 128 loader.unsetenv("hw.ata.ata_dma") 129 loader.unsetenv("hw.ata.atapi_dma") 130 loader.unsetenv("hw.ata.wc") 131 loader.unsetenv("hw.eisa_slots") 132 loader.unsetenv("kern.eventtimer.periodic") 133 loader.unsetenv("kern.geom.part.check_integrity") 134 end | 119 loader.setenv("kern.smp.disabled", "1") 120 loader.setenv("hw.ata.ata_dma", "0") 121 loader.setenv("hw.ata.atapi_dma", "0") 122 loader.setenv("hw.ata.wc", "0") 123 loader.setenv("hw.eisa_slots", "0") 124 loader.setenv("kern.eventtimer.periodic", "1") 125 loader.setenv("kern.geom.part.check_integrity", "0") 126 else 127 loader.unsetenv("kern.smp.disabled") 128 loader.unsetenv("hw.ata.ata_dma") 129 loader.unsetenv("hw.ata.atapi_dma") 130 loader.unsetenv("hw.ata.wc") 131 loader.unsetenv("hw.eisa_slots") 132 loader.unsetenv("kern.eventtimer.periodic") 133 loader.unsetenv("kern.geom.part.check_integrity") 134 end |
135 core.sm = b | 135 core.sm = safe_mode |
136end 137 138function core.kernelList() 139 local k = loader.getenv("kernel") 140 local v = loader.getenv("kernels") 141 local autodetect = loader.getenv("kernels_autodetect") or "" 142 143 local kernels = {} --- 188 unchanged lines hidden --- | 136end 137 138function core.kernelList() 139 local k = loader.getenv("kernel") 140 local v = loader.getenv("kernels") 141 local autodetect = loader.getenv("kernels_autodetect") or "" 142 143 local kernels = {} --- 188 unchanged lines hidden --- |