Remove the arch dir when updating the UFD

This commit is contained in:
2Shirt 2019-04-16 00:23:58 -07:00
parent 949efa4de6
commit cd4ea75862
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 17 additions and 2 deletions

View file

@ -53,8 +53,15 @@ if __name__ == '__main__':
if not args['--force']:
confirm_selections(args)
# Format and partition device
if not args['--update']:
# Prep UFD
if args['--update']:
# Remove arch folder
try_and_print(
message='Removing Linux...',
function=remove_arch,
)
else:
# Format and partition
prep_device(ufd_dev, UFD_LABEL, use_mbr=args['--use-mbr'])
# Mount UFD

View file

@ -327,6 +327,14 @@ def recursive_copy(source, dest, overwrite=False):
raise FileExistsError('Refusing to delete file: {}'.format(dest))
def remove_arch():
"""Remove arch dir from UFD.
This ensures a clean installation to the UFD and resets the boot files
"""
shutil.rmtree(find_path('/mnt/UFD/arch'))
def running_as_root():
"""Check if running with effective UID of 0, returns bool."""
return os.geteuid() == 0