Split build-ufd file to match other scripts
This commit is contained in:
parent
639a338cca
commit
575126eaa2
3 changed files with 154 additions and 62 deletions
|
|
@ -2,88 +2,73 @@
|
|||
#
|
||||
## Wizard Kit: UFD build tool
|
||||
|
||||
# Init
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Init
|
||||
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
|
||||
|
||||
from docopt import docopt
|
||||
from functions.common import *
|
||||
|
||||
from functions.ufd import *
|
||||
from settings.ufd import *
|
||||
init_global_vars()
|
||||
set_log_file('Build UFD ({Date-Time}).log'.format(**global_vars['Env']))
|
||||
|
||||
|
||||
# STATIC VARIABLES
|
||||
DOCSTRING = '''Build UFD.
|
||||
|
||||
Usage:
|
||||
build-ufd [options] --ufd-device PATH --linux-iso PATH
|
||||
[--linux-minimal-iso PATH]
|
||||
[--main-kit PATH]
|
||||
[--winpe-iso PATH]
|
||||
[--extra-dir PATH]
|
||||
build-ufd (-h | --help)
|
||||
|
||||
Options:
|
||||
-e PATH, --extra-dir PATH
|
||||
-k PATH, --main-kit PATH
|
||||
-l PATH, --linux-iso PATH
|
||||
-m PATH, --linux-minimal-iso PATH
|
||||
-u PATH, --ufd-device PATH
|
||||
-w PATH, --winpe-iso PATH
|
||||
|
||||
-d --debug Enable debug mode
|
||||
-h --help Show this page
|
||||
-v --verbose Enable verbose mode
|
||||
-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)
|
||||
|
||||
|
||||
# Functions
|
||||
def get_full_path(item):
|
||||
"""Get full path to item, returns str."""
|
||||
#TODO
|
||||
pass
|
||||
|
||||
|
||||
def is_block_device(item):
|
||||
"""Verify item is a block device, returns bool."""
|
||||
#TODO
|
||||
pass
|
||||
|
||||
|
||||
def is_valid_main_kit(path):
|
||||
"""Verify path contains the main kit, returns bool."""
|
||||
|
||||
|
||||
# Main section
|
||||
if __name__ == '__main__':
|
||||
args = docopt(DOCSTRING)
|
||||
try:
|
||||
args = docopt(DOCSTRING)
|
||||
sources = ()
|
||||
|
||||
# Verify selections
|
||||
# Verify selections
|
||||
## UFD
|
||||
try:
|
||||
ufd_dev = get_full_path(args['--ufd-device'])
|
||||
if not is_block_device(ufd_dev):
|
||||
print_error('Invalid UFD device: {}'.format(ufd_dev))
|
||||
abort()
|
||||
except Exception:
|
||||
# TODO Catch FileNotFound exception and abort accordingly
|
||||
raise
|
||||
## Sources
|
||||
for label, source in UFD_SOURCES:
|
||||
if args[source]:
|
||||
try:
|
||||
sources.append((label, get_full_path(source)))
|
||||
except Exception:
|
||||
# TODO Catch FileNotFound exception and abort accordingly
|
||||
raise
|
||||
|
||||
# Show selections
|
||||
# Show selections
|
||||
# TODO FIXME
|
||||
print_standard('UFD: {}'.format(ufd_dev))
|
||||
print_standard('Sources:')
|
||||
for s in sources:
|
||||
print_standard(' {}: {}'.format(*s))
|
||||
|
||||
# Double-check if formating device
|
||||
# Double-check if formating device
|
||||
|
||||
# Format and partition device
|
||||
# Format and partition device
|
||||
|
||||
# Mount sources
|
||||
# Copy sources
|
||||
|
||||
# Copy sources
|
||||
# Update boot entries
|
||||
|
||||
# Update boot entries
|
||||
# Install syslinux
|
||||
|
||||
# Install syslinux
|
||||
# Hide items
|
||||
|
||||
# Hide items
|
||||
# Unmount sources
|
||||
|
||||
# Unmount sources
|
||||
# Done
|
||||
if not args['--force']:
|
||||
print_standard('\nDone.')
|
||||
pause('Press Enter to exit...')
|
||||
exit_script()
|
||||
except SystemExit:
|
||||
pass
|
||||
except:
|
||||
major_exception()
|
||||
|
||||
|
||||
# vim: sts=2 sw=2 ts=2
|
||||
|
|
|
|||
27
.bin/Scripts/functions/ufd.py
Normal file
27
.bin/Scripts/functions/ufd.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# Wizard Kit: Functions - UFD
|
||||
|
||||
from functions.common import *
|
||||
|
||||
|
||||
def get_full_path(item):
|
||||
"""Get full path to item, returns str."""
|
||||
#TODO
|
||||
pass
|
||||
|
||||
|
||||
def is_block_device(item):
|
||||
"""Verify item is a block device, returns bool."""
|
||||
#TODO
|
||||
pass
|
||||
|
||||
|
||||
def is_valid_main_kit(path):
|
||||
"""Verify path contains the main kit, returns bool."""
|
||||
#TODO
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("This file is not meant to be called directly.")
|
||||
|
||||
# vim: sts=2 sw=2 ts=2
|
||||
80
.bin/Scripts/settings/ufd.py
Normal file
80
.bin/Scripts/settings/ufd.py
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
# Wizard Kit: Settings - UFD
|
||||
|
||||
from settings.main import *
|
||||
|
||||
# General
|
||||
DOCSTRING = '''WizardKit: Build UFD
|
||||
|
||||
Usage:
|
||||
build-ufd [options] --ufd-device PATH --linux-iso PATH
|
||||
[--linux-minimal-iso PATH]
|
||||
[--main-kit PATH]
|
||||
[--winpe-iso PATH]
|
||||
[--extra-dir PATH]
|
||||
build-ufd (-h | --help)
|
||||
|
||||
Options:
|
||||
-e PATH, --extra-dir PATH
|
||||
-k PATH, --main-kit PATH
|
||||
-l PATH, --linux-iso PATH
|
||||
-m PATH, --linux-minimal-iso PATH
|
||||
-u PATH, --ufd-device PATH
|
||||
-w PATH, --winpe-iso PATH
|
||||
|
||||
-d --debug Enable debug mode
|
||||
-h --help Show this page
|
||||
-v --verbose Enable verbose mode
|
||||
-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 = (
|
||||
# NOTE: Using tuple of tuples to ensure copy order
|
||||
('Linux', '--linux-iso'),
|
||||
('Linux (Minimal)', '--linux-minimal-iso'),
|
||||
('WinPE', '--winpe-iso'),
|
||||
('Main Kit', '--main-kit'),
|
||||
('Extras', '--extra-dir'),
|
||||
)
|
||||
|
||||
# Definitions: Boot entries
|
||||
## NOTE: if key path exists uncomment #value# lines
|
||||
BOOT_ENTRIES = {
|
||||
'arch_minimal': 'MINIMAL',
|
||||
'sources/boot.wim': 'WINPE',
|
||||
}
|
||||
|
||||
# Definitions: Sources and Destinations
|
||||
## NOTES: Paths are relative to the root of the ISO/UFD
|
||||
## Sources use rsync's trailing slash syntax
|
||||
ITEMS_LINUX_FULL = (
|
||||
('/arch', '/'),
|
||||
('/isolinux', '/'),
|
||||
('/EFI/boot', '/EFI/'),
|
||||
('/EFI/memtest86', '/EFI/'),
|
||||
)
|
||||
ITEMS_LINUX_MINIMAL = (
|
||||
('/arch/boot/archiso.img', '/arch_minimal/'),
|
||||
('/arch/boot/vmlinuz', '/arch_minimal/'),
|
||||
('/arch/pkglist.x86_64.txt', '/arch_minimal/'),
|
||||
('/arch/x86_64', '/arch_minimal/'),
|
||||
)
|
||||
ITEMS_WINPE = (
|
||||
('/bootmgr', '/'),
|
||||
('/bootmgr.efi', '/'),
|
||||
('/en_us', '/'),
|
||||
('/Boot/', '/boot/'),
|
||||
('/EFI/Boot/', '/EFI/Microsoft/'),
|
||||
('/EFI/Microsoft/', '/EFI/Microsoft/'),
|
||||
('/Boot/BCD', '/sources/'),
|
||||
('/Boot/boot.sdi', '/sources/'),
|
||||
('/bootmgr', '/sources/'),
|
||||
('/sources/boot.wim', '/sources/'),
|
||||
)
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("This file is not meant to be called directly.")
|
||||
|
||||
# vim: sts=2 sw=2 ts=2
|
||||
Loading…
Reference in a new issue