Added hide items sections

This commit is contained in:
2Shirt 2019-04-16 00:16:05 -07:00
parent a9461311bc
commit 949efa4de6
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
3 changed files with 35 additions and 0 deletions

View file

@ -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']:

View file

@ -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 = [

View file

@ -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.")