diff options
-rwxr-xr-x | bin/vmdebootstrap | 29 | ||||
-rw-r--r-- | vmdebootstrap/uefi.py | 28 |
2 files changed, 30 insertions, 27 deletions
diff --git a/bin/vmdebootstrap b/bin/vmdebootstrap index 1c77373..352ea0a 100755 --- a/bin/vmdebootstrap +++ b/bin/vmdebootstrap @@ -211,33 +211,8 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth raise cliapp.AppException( '%s is not a valid Debian or Ubuntu suite or codename.' % self.settings['distribution']) - if not self.settings['use-uefi'] and self.settings['esp-size'] != 5242880: - raise cliapp.AppException( - 'You must specify use-uefi for esp-size to have effect') - if self.settings['arch'] in arch_table and\ - arch_table[self.settings['arch']]['exclusive'] and\ - not self.settings['use-uefi']: - raise cliapp.AppException( - 'Only UEFI is supported on %s' % self.settings['arch']) - elif self.settings['use-uefi'] and self.settings['arch'] not in arch_table: - raise cliapp.AppException( - '%s is not a supported UEFI architecture' % self.settings['arch']) - if self.settings['use-uefi'] and ( - self.settings['bootsize'] or - self.settings['bootoffset']): - raise cliapp.AppException( - 'A separate boot partition is not supported with UEFI') - - if self.settings['use-uefi'] and not self.settings['grub']: - raise cliapp.AppException( - 'UEFI without Grub is not supported.') - - # wheezy (which became oldstable on 04/25/2015) only had amd64 uefi - if distro.was_oldstable(datetime.date(2015, 4, 26)): - if self.settings['arch'] != 'amd64': - raise cliapp.AppException( - 'Only amd64 supports UEFI in Wheezy') - + uefi = self.handlers[Uefi.name] + uefi.check_settings() if os.geteuid() != 0: sys.exit("You need to have root privileges to run this script.") self.start_ops() diff --git a/vmdebootstrap/uefi.py b/vmdebootstrap/uefi.py index 08da7c7..147405a 100644 --- a/vmdebootstrap/uefi.py +++ b/vmdebootstrap/uefi.py @@ -44,6 +44,34 @@ class Uefi(Base): super(Uefi, self).__init__() self.bootdir = None + def check_settings(self): + if not self.settings['use-uefi'] and self.settings['esp-size'] != 5242880: + raise cliapp.AppException( + 'You must specify use-uefi for esp-size to have effect') + if self.settings['arch'] in arch_table and\ + arch_table[self.settings['arch']]['exclusive'] and\ + not self.settings['use-uefi']: + raise cliapp.AppException( + 'Only UEFI is supported on %s' % self.settings['arch']) + elif self.settings['use-uefi'] and self.settings['arch'] not in arch_table: + raise cliapp.AppException( + '%s is not a supported UEFI architecture' % self.settings['arch']) + if self.settings['use-uefi'] and ( + self.settings['bootsize'] or + self.settings['bootoffset']): + raise cliapp.AppException( + 'A separate boot partition is not supported with UEFI') + + if self.settings['use-uefi'] and not self.settings['grub']: + raise cliapp.AppException( + 'UEFI without Grub is not supported.') + + # wheezy (which became oldstable on 04/25/2015) only had amd64 uefi + if distro.was_oldstable(datetime.date(2015, 4, 26)): + if self.settings['arch'] != 'amd64' and self.settings['use-uefi']: + raise cliapp.AppException( + 'Only amd64 supports UEFI in Wheezy') + def efi_packages(self): packages = [] if not self.settings['use-uefi'] or\ |