From 81cbbef81e44cc4bd1f3440c40a524667be698c3 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Wed, 8 May 2013 11:57:10 +0100 Subject: Make bootloader installation for disk images optional --- writeexts.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/writeexts.py b/writeexts.py index af48b375..23b876ae 100755 --- a/writeexts.py +++ b/writeexts.py @@ -65,7 +65,8 @@ class WriteExtension(cliapp.Application): self.create_factory(mp, temp_root) self.create_fstab(mp) self.create_factory_run(mp) - self.install_extlinux(mp) + if self.bootloader_is_wanted(): + self.install_extlinux(mp) except BaseException, e: sys.stderr.write('Error creating disk image') self.unmount(mp) @@ -212,3 +213,21 @@ class WriteExtension(cliapp.Application): return s.split(':') else: return [] + + def bootloader_is_wanted(self): + '''Does the user request a bootloader? + + The user may set $BOOTLOADER to yes, no, or auto. If not + set, auto is the default and means that the bootloader will + be installed on x86-32 and x86-64, but not otherwise. + + ''' + + value = os.environ.get('BOOTLOADER', 'auto') + if value == 'auto': + if os.uname()[-1] in ['x86_32', 'x86_64']: + value = 'yes' + else: + value = 'no' + + return value == 'yes' -- cgit v1.2.1