Added ufd settings

This commit is contained in:
2Shirt 2020-01-07 23:21:18 -07:00
parent 142ad75744
commit 8b9672313a
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
3 changed files with 39 additions and 42 deletions

View file

@ -5,3 +5,4 @@ from wk.cfg import hw
from wk.cfg import log from wk.cfg import log
from wk.cfg import main from wk.cfg import main
from wk.cfg import net from wk.cfg import net
from wk.cfg import ufd

View file

@ -1,40 +1,15 @@
'''Wizard Kit: Settings - UFD''' """WizardKit: Config - UFD"""
# pylint: disable=C0326,E0611 # pylint: disable=bad-whitespace
# vim: sts=2 sw=2 ts=2 # vim: sts=2 sw=2 ts=2
from collections import OrderedDict from collections import OrderedDict
from settings.main import KIT_NAME_FULL,KIT_NAME_SHORT
from wk.cfg.main import KIT_NAME_FULL
# General # General
DOCSTRING = '''WizardKit: Build UFD SOURCES = OrderedDict({
Usage:
build-ufd [options] --ufd-device PATH --linux PATH
[--linux-minimal PATH]
[--main-kit PATH]
[--winpe PATH]
[--extra-dir PATH]
build-ufd (-h | --help)
Options:
-d PATH, --linux-dgpu PATH
-e PATH, --extra-dir PATH
-k PATH, --main-kit PATH
-l PATH, --linux PATH
-m PATH, --linux-minimal PATH
-u PATH, --ufd-device PATH
-w PATH, --winpe PATH
-h --help Show this page
-M --use-mbr Use real MBR instead of GPT w/ Protective MBR
-F --force Bypass all confirmation messages. USE WITH EXTREME CAUTION!
-U --update Don't format device, just update
'''
ISO_LABEL = '{}_LINUX'.format(KIT_NAME_SHORT)
UFD_LABEL = '{}_UFD'.format(KIT_NAME_SHORT)
UFD_SOURCES = OrderedDict({
'Linux': {'Arg': '--linux', 'Type': 'ISO'}, 'Linux': {'Arg': '--linux', 'Type': 'ISO'},
'Linux (dGPU)': {'Arg': '--linux-dgpu', 'Type': 'ISO'},
'Linux (Minimal)': {'Arg': '--linux-minimal', 'Type': 'ISO'}, 'Linux (Minimal)': {'Arg': '--linux-minimal', 'Type': 'ISO'},
'WinPE': {'Arg': '--winpe', 'Type': 'ISO'}, 'WinPE': {'Arg': '--winpe', 'Type': 'ISO'},
'Main Kit': {'Arg': '--main-kit', 'Type': 'KIT'}, 'Main Kit': {'Arg': '--main-kit', 'Type': 'KIT'},
@ -45,7 +20,6 @@ UFD_SOURCES = OrderedDict({
BOOT_ENTRIES = { BOOT_ENTRIES = {
# Path to check: Comment to remove # Path to check: Comment to remove
'/arch_minimal': 'UFD-MINIMAL', '/arch_minimal': 'UFD-MINIMAL',
'/dgpu': 'UFD-DGPU',
'/sources/boot.wim': 'UFD-WINPE', '/sources/boot.wim': 'UFD-WINPE',
} }
BOOT_FILES = { BOOT_FILES = {
@ -67,12 +41,6 @@ ITEMS = {
('/EFI/boot', '/EFI/'), ('/EFI/boot', '/EFI/'),
('/EFI/memtest86', '/EFI/'), ('/EFI/memtest86', '/EFI/'),
), ),
'Linux (dGPU)': (
('/arch/boot/x86_64/archiso.img', '/dgpu/'),
('/arch/boot/x86_64/vmlinuz', '/dgpu/'),
('/arch/pkglist.x86_64.txt', '/dgpu/'),
('/arch/x86_64', '/dgpu/'),
),
'Linux (Minimal)': ( 'Linux (Minimal)': (
('/arch/boot/x86_64/archiso.img', '/arch_minimal/'), ('/arch/boot/x86_64/archiso.img', '/arch_minimal/'),
('/arch/boot/x86_64/vmlinuz', '/arch_minimal/'), ('/arch/boot/x86_64/vmlinuz', '/arch_minimal/'),
@ -80,7 +48,7 @@ ITEMS = {
('/arch/x86_64', '/arch_minimal/'), ('/arch/x86_64', '/arch_minimal/'),
), ),
'Main Kit': ( 'Main Kit': (
('/', '/{}/'.format(KIT_NAME_FULL)), ('/', f'/{KIT_NAME_FULL}/'),
), ),
'WinPE': ( 'WinPE': (
('/bootmgr', '/'), ('/bootmgr', '/'),
@ -99,12 +67,11 @@ ITEMS_HIDDEN = (
# Linux (all versions) # Linux (all versions)
'arch', 'arch',
'arch_minimal', 'arch_minimal',
'dgpu',
'EFI', 'EFI',
'isolinux', 'isolinux',
# Main Kit # Main Kit
'{}/.bin'.format(KIT_NAME_FULL), f'{KIT_NAME_FULL}/.bin',
'{}/.cbin'.format(KIT_NAME_FULL), f'{KIT_NAME_FULL}/.cbin',
# WinPE # WinPE
'boot', 'boot',
'bootmgr', 'bootmgr',
@ -114,5 +81,6 @@ ITEMS_HIDDEN = (
'sources', 'sources',
) )
if __name__ == '__main__': if __name__ == '__main__':
print("This file is not meant to be called directly.") print("This file is not meant to be called directly.")

View file

@ -1,6 +1,7 @@
"""WizardKit: UFD Functions""" """WizardKit: UFD Functions"""
# vim: sts=2 sw=2 ts=2 # vim: sts=2 sw=2 ts=2
# TODO: Replace some lsblk usage with hw_obj? # TODO: Replace some lsblk usage with hw_obj?
# TODO: Reduce imports if possible
# TODO: Needs testing # TODO: Needs testing
import logging import logging
@ -10,12 +11,39 @@ import shutil
from collections import OrderedDict from collections import OrderedDict
from wk import io, std from wk import io, std
from wk.cfg.main import KIT_NAME_SHORT
from wk.cfg.ufd import BOOT_ENTRIES, BOOT_FILES, ITEMS, ITEMS_HIDDEN, SOURCES
from wk.exe import run_program from wk.exe import run_program
from wk.os import linux from wk.os import linux
# STATIC VARIABLES # STATIC VARIABLES
DOCSTRING = '''WizardKit: Build UFD
Usage:
build-ufd [options] --ufd-device PATH --linux PATH
[--linux-minimal PATH]
[--main-kit PATH]
[--winpe PATH]
[--extra-dir PATH]
build-ufd (-h | --help)
Options:
-e PATH, --extra-dir PATH
-k PATH, --main-kit PATH
-l PATH, --linux PATH
-m PATH, --linux-minimal PATH
-u PATH, --ufd-device PATH
-w PATH, --winpe PATH
-h --help Show this page
-M --use-mbr Use real MBR instead of GPT w/ Protective MBR
-F --force Bypass all confirmation messages. USE WITH EXTREME CAUTION!
-U --update Don't format device, just update
'''
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
ISO_LABEL = f'{KIT_NAME_SHORT}_LINUX'
UFD_LABEL = f'{KIT_NAME_SHORT}_UFD'
# Functions # Functions