From 10fa8fd271263c2fdc3dafe6324e7cd71a0bcb1c Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Sun, 14 Apr 2013 15:13:30 +0000 Subject: Check if bootenv is created --- install | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'install') diff --git a/install b/install index 1a69261..f4afd8c 100755 --- a/install +++ b/install @@ -754,22 +754,26 @@ def configure_bootenv(): def cleanup(destroy_bootenv=False): + global bootenv + global rootdir progress = ProgressMessage(screen, title='Cleaning up', width=50) - umount_in_bootenv() - call(['umount', rootdir], stdout=PIPE, stderr=PIPE) - if destroy_bootenv: - progress.text='Destroying "{}", please wait ...'.format(bootenv) - call(['zfs', 'destroy', '-r', bootenv], stdout=PIPE, stderr=PIPE) - else: - progress.text = 'Adjusting boot environment "{}" ...'.format(bootenv) - call(['zfs', 'destroy', '-r', bootenv + '@empty'], stdout=PIPE, stderr=PIPE) - call(['zfs', 'set', 'canmount=noauto', bootenv], stdout=PIPE, stderr=PIPE) - call(['zfs', 'set', 'mountpoint=/', bootenv], stdout=PIPE, stderr=PIPE) + if bootenv: + umount_in_bootenv() + call(['umount', rootdir], stdout=PIPE, stderr=PIPE) + if destroy_bootenv: + progress.text='Destroying "{}", please wait ...'.format(bootenv) + call(['zfs', 'destroy', '-r', bootenv], stdout=PIPE, stderr=PIPE) + else: + progress.text = 'Adjusting boot environment "{}" ...'.format(bootenv) + call(['zfs', 'destroy', '-r', bootenv + '@empty'], stdout=PIPE, stderr=PIPE) + call(['zfs', 'set', 'canmount=noauto', bootenv], stdout=PIPE, stderr=PIPE) + call(['zfs', 'set', 'mountpoint=/', bootenv], stdout=PIPE, stderr=PIPE) - try: - os.rmdir(rootdir) - except: - pass + try: + os.rmdir(rootdir) + except: + pass + bootenv = None progress.text = 'Exporting ZFS pools ...' for pool in imported_zpools: -- cgit v1.2.3