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

View file

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