'''Wizard Kit: Settings - UFD'''
# pylint: disable=C0326,E0611
# vim: sts=2 sw=2 ts=2

from collections import OrderedDict
from settings.main import KIT_NAME_FULL,KIT_NAME_SHORT

# General
DOCSTRING = '''WizardKit: Build UFD

Usage:
  build-ufd [options] --ufd-device PATH --linux PATH
            [--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

  -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 (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'},
  })

# Definitions: Boot entries
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 = {
  # Directory:            extension
  '/arch/boot/syslinux':  'cfg',
  '/EFI/boot':            'conf',
  }

# Definitions: Sources and Destinations
## 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',                     '/'),
    ('/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/'),
    ('/arch/pkglist.x86_64.txt',      '/arch_minimal/'),
    ('/arch/x86_64',                  '/arch_minimal/'),
    ),
  'Main Kit': (
    ('/',                             '/{}/'.format(KIT_NAME_FULL)),
    ),
  '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/'),
    ),
  }
ITEMS_HIDDEN = (
  # ESET
  'casper',
  # HDClone
  'bootenv',
  'kernel.map',
  # Linux (all versions)
  'arch',
  'arch_minimal',
  'dgpu',
  'EFI',
  'isolinux',
  # Main Kit
  '{}/.bin'.format(KIT_NAME_FULL),
  '{}/.cbin'.format(KIT_NAME_FULL),
  # WinPE
  'boot',
  'bootmgr',
  'bootmgr.efi',
  'en-us',
  'images',
  'sources',
  )

if __name__ == '__main__':
  print("This file is not meant to be called directly.")
