From 8b9672313aeb697fec22a8b287a7668b7e2d2ef4 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Tue, 7 Jan 2020 23:21:18 -0700 Subject: [PATCH] Added ufd settings --- scripts/wk/cfg/__init__.py | 1 + scripts/{wk.prev/settings => wk/cfg}/ufd.py | 52 ++++----------------- scripts/wk/kit/ufd.py | 28 +++++++++++ 3 files changed, 39 insertions(+), 42 deletions(-) rename scripts/{wk.prev/settings => wk/cfg}/ufd.py (61%) diff --git a/scripts/wk/cfg/__init__.py b/scripts/wk/cfg/__init__.py index d86f7245..23ca608f 100644 --- a/scripts/wk/cfg/__init__.py +++ b/scripts/wk/cfg/__init__.py @@ -5,3 +5,4 @@ from wk.cfg import hw from wk.cfg import log from wk.cfg import main from wk.cfg import net +from wk.cfg import ufd diff --git a/scripts/wk.prev/settings/ufd.py b/scripts/wk/cfg/ufd.py similarity index 61% rename from scripts/wk.prev/settings/ufd.py rename to scripts/wk/cfg/ufd.py index b157e392..a22f0db7 100644 --- a/scripts/wk.prev/settings/ufd.py +++ b/scripts/wk/cfg/ufd.py @@ -1,40 +1,15 @@ -'''Wizard Kit: Settings - UFD''' -# pylint: disable=C0326,E0611 +"""WizardKit: Config - UFD""" +# pylint: disable=bad-whitespace # vim: sts=2 sw=2 ts=2 from collections import OrderedDict -from settings.main import KIT_NAME_FULL,KIT_NAME_SHORT + +from wk.cfg.main import KIT_NAME_FULL + # General -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: - -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({ +SOURCES = OrderedDict({ 'Linux': {'Arg': '--linux', 'Type': 'ISO'}, - 'Linux (dGPU)': {'Arg': '--linux-dgpu', 'Type': 'ISO'}, 'Linux (Minimal)': {'Arg': '--linux-minimal', 'Type': 'ISO'}, 'WinPE': {'Arg': '--winpe', 'Type': 'ISO'}, 'Main Kit': {'Arg': '--main-kit', 'Type': 'KIT'}, @@ -45,7 +20,6 @@ UFD_SOURCES = OrderedDict({ BOOT_ENTRIES = { # Path to check: Comment to remove '/arch_minimal': 'UFD-MINIMAL', - '/dgpu': 'UFD-DGPU', '/sources/boot.wim': 'UFD-WINPE', } BOOT_FILES = { @@ -67,12 +41,6 @@ ITEMS = { ('/EFI/boot', '/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)': ( ('/arch/boot/x86_64/archiso.img', '/arch_minimal/'), ('/arch/boot/x86_64/vmlinuz', '/arch_minimal/'), @@ -80,7 +48,7 @@ ITEMS = { ('/arch/x86_64', '/arch_minimal/'), ), 'Main Kit': ( - ('/', '/{}/'.format(KIT_NAME_FULL)), + ('/', f'/{KIT_NAME_FULL}/'), ), 'WinPE': ( ('/bootmgr', '/'), @@ -99,12 +67,11 @@ ITEMS_HIDDEN = ( # Linux (all versions) 'arch', 'arch_minimal', - 'dgpu', 'EFI', 'isolinux', # Main Kit - '{}/.bin'.format(KIT_NAME_FULL), - '{}/.cbin'.format(KIT_NAME_FULL), + f'{KIT_NAME_FULL}/.bin', + f'{KIT_NAME_FULL}/.cbin', # WinPE 'boot', 'bootmgr', @@ -114,5 +81,6 @@ ITEMS_HIDDEN = ( 'sources', ) + if __name__ == '__main__': print("This file is not meant to be called directly.") diff --git a/scripts/wk/kit/ufd.py b/scripts/wk/kit/ufd.py index 0d83b3d0..d5040299 100644 --- a/scripts/wk/kit/ufd.py +++ b/scripts/wk/kit/ufd.py @@ -1,6 +1,7 @@ """WizardKit: UFD Functions""" # vim: sts=2 sw=2 ts=2 # TODO: Replace some lsblk usage with hw_obj? +# TODO: Reduce imports if possible # TODO: Needs testing import logging @@ -10,12 +11,39 @@ import shutil from collections import OrderedDict 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.os import linux # 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__) +ISO_LABEL = f'{KIT_NAME_SHORT}_LINUX' +UFD_LABEL = f'{KIT_NAME_SHORT}_UFD' # Functions