Added support for ESET SysRescue and HDClone

This commit is contained in:
2Shirt 2019-04-20 20:15:28 -07:00
parent a0db819a76
commit 60bfa373e2
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 31 additions and 5 deletions

View file

@ -60,16 +60,16 @@ def confirm_selections(args):
def copy_source(source, items, overwrite=False): def copy_source(source, items, overwrite=False):
"""Copy source items to /mnt/UFD.""" """Copy source items to /mnt/UFD."""
is_iso = source.name.lower().endswith('.iso') is_image = source.is_file()
# Mount source if necessary # Mount source if necessary
if is_iso: if is_image:
mount(source, '/mnt/Source') mount(source, '/mnt/Source')
# Copy items # Copy items
for i_source, i_dest in items: for i_source, i_dest in items:
i_source = '{}{}'.format( i_source = '{}{}'.format(
'/mnt/Source' if is_iso else source, '/mnt/Source' if is_image else source,
i_source, i_source,
) )
i_dest = '/mnt/UFD{}'.format(i_dest) i_dest = '/mnt/UFD{}'.format(i_dest)
@ -80,7 +80,7 @@ def copy_source(source, items, overwrite=False):
pass pass
# Unmount source if necessary # Unmount source if necessary
if is_iso: if is_image:
unmount('/mnt/Source') unmount('/mnt/Source')
@ -199,6 +199,8 @@ def is_valid_path(path_obj, path_type):
valid_path = path_obj.is_dir() valid_path = path_obj.is_dir()
elif path_type == 'KIT': elif path_type == 'KIT':
valid_path = path_obj.is_dir() and path_obj.joinpath('.bin').exists() valid_path = path_obj.is_dir() and path_obj.joinpath('.bin').exists()
elif path_type == 'IMG':
valid_path = path_obj.is_file() and path_obj.suffix.lower() == '.img'
elif path_type == 'ISO': elif path_type == 'ISO':
valid_path = path_obj.is_file() and path_obj.suffix.lower() == '.iso' valid_path = path_obj.is_file() and path_obj.suffix.lower() == '.iso'
elif path_type == 'UFD': elif path_type == 'UFD':
@ -399,7 +401,7 @@ def update_boot_entries(boot_entries, boot_files, iso_label, ufd_label):
'sed', 'sed',
'--in-place', '--in-place',
'--regexp-extended', '--regexp-extended',
's/{}/{}/'.format(iso_label, ufd_label), 's/(eSysRescueLiveCD|{})/{}/'.format(iso_label, ufd_label),
*configs, *configs,
] ]
run_program(cmd) run_program(cmd)

View file

@ -13,15 +13,19 @@ Usage:
[--linux-minimal PATH] [--linux-minimal PATH]
[--main-kit PATH] [--main-kit PATH]
[--winpe PATH] [--winpe PATH]
[--eset PATH]
[--hdclone PATH]
[--extra-dir PATH] [--extra-dir PATH]
build-ufd (-h | --help) build-ufd (-h | --help)
Options: Options:
-c PATH, --hdclone PATH
-d PATH, --linux-dgpu PATH -d PATH, --linux-dgpu PATH
-e PATH, --extra-dir PATH -e PATH, --extra-dir PATH
-k PATH, --main-kit PATH -k PATH, --main-kit PATH
-l PATH, --linux PATH -l PATH, --linux PATH
-m PATH, --linux-minimal PATH -m PATH, --linux-minimal PATH
-s PATH, --eset PATH
-u PATH, --ufd-device PATH -u PATH, --ufd-device PATH
-w PATH, --winpe PATH -w PATH, --winpe PATH
@ -37,6 +41,8 @@ UFD_SOURCES = OrderedDict({
'Linux (dGPU)': {'Arg': '--linux-dgpu', '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'},
'ESET SysRescue': {'Arg': '--eset', 'Type': 'IMG'},
'HDClone': {'Arg': '--hdclone', 'Type': 'IMG'},
'Main Kit': {'Arg': '--main-kit', 'Type': 'KIT'}, 'Main Kit': {'Arg': '--main-kit', 'Type': 'KIT'},
'Extra Dir': {'Arg': '--extra-dir', 'Type': 'DIR'}, 'Extra Dir': {'Arg': '--extra-dir', 'Type': 'DIR'},
}) })
@ -45,7 +51,9 @@ 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',
'/casper': 'UFD-ESET',
'/dgpu': 'UFD-DGPU', '/dgpu': 'UFD-DGPU',
'/kernel.map': 'UFD-HDCLONE',
'/sources/boot.wim': 'UFD-WINPE', '/sources/boot.wim': 'UFD-WINPE',
} }
BOOT_FILES = { BOOT_FILES = {
@ -58,9 +66,20 @@ BOOT_FILES = {
## NOTES: Paths are relative to the root of the ISO/UFD ## NOTES: Paths are relative to the root of the ISO/UFD
## Sources use rsync's trailing slash syntax ## Sources use rsync's trailing slash syntax
ITEMS = { ITEMS = {
'ESET SysRescue': (
('/boot/grub/', '/boot/grub/'),
('/capser/', '/casper/'),
('/EFI/boot/', '/EFI/ESET/'),
),
'Extra Dir': ( 'Extra Dir': (
('/', '/'), ('/', '/'),
), ),
'HDClone': (
('/bootenv', '/'),
('/kernel.map', '/'),
('/EFI/boot/', '/EFI/HDClone/'),
('/hdclone.iso', '/sources/'),
),
'Linux': ( 'Linux': (
('/arch', '/'), ('/arch', '/'),
('/isolinux', '/'), ('/isolinux', '/'),
@ -96,6 +115,11 @@ ITEMS = {
), ),
} }
ITEMS_HIDDEN = ( ITEMS_HIDDEN = (
# ESET
'casper',
# HDClone
'bootenv',
'kernel.map',
# Linux (all versions) # Linux (all versions)
'arch', 'arch',
'arch_minimal', 'arch_minimal',