Added hide items sections
This commit is contained in:
parent
a9461311bc
commit
949efa4de6
3 changed files with 35 additions and 0 deletions
|
|
@ -101,6 +101,12 @@ if __name__ == '__main__':
|
|||
)
|
||||
|
||||
# Hide items
|
||||
try_and_print(
|
||||
message='Hiding items...',
|
||||
function=hide_items,
|
||||
ufd_dev=ufd_dev,
|
||||
items=ITEMS_HIDDEN,
|
||||
)
|
||||
|
||||
# Done
|
||||
if not args['--force']:
|
||||
|
|
|
|||
|
|
@ -175,6 +175,20 @@ def get_user_name():
|
|||
return user
|
||||
|
||||
|
||||
def hide_items(ufd_dev, items):
|
||||
"""Set FAT32 hidden flag for items."""
|
||||
# pylint: disable=invalid-name
|
||||
with open('/root/.mtoolsrc', 'w') as f:
|
||||
f.write('drive U: file="{}"\n'.format(
|
||||
find_first_partition(ufd_dev)))
|
||||
f.write('mtools_skip_check=1\n')
|
||||
|
||||
# Hide items
|
||||
for item in items:
|
||||
cmd = ['yes | mattrib +h "U:/{}"'.format(item)]
|
||||
run_program(cmd, check=False, shell=True)
|
||||
|
||||
|
||||
def install_syslinux(ufd_dev, use_mbr):
|
||||
"""Install Syslinux to UFD."""
|
||||
cmd = [
|
||||
|
|
|
|||
|
|
@ -95,6 +95,21 @@ ITEMS = {
|
|||
('/sources/boot.wim', '/sources/'),
|
||||
),
|
||||
}
|
||||
ITEMS_HIDDEN = (
|
||||
# Linux (all versions)
|
||||
'arch',
|
||||
'arch_minimal',
|
||||
'dgpu',
|
||||
'EFI',
|
||||
'isolinux',
|
||||
# WinPE
|
||||
'boot',
|
||||
'bootmgr',
|
||||
'bootmgr.efi',
|
||||
'en-us',
|
||||
'images',
|
||||
'sources',
|
||||
)
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("This file is not meant to be called directly.")
|
||||
|
|
|
|||
Loading…
Reference in a new issue