summaryrefslogtreecommitdiff
path: root/morphlib/writeexts.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-05-08 11:57:10 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-05-08 11:57:10 +0100
commitaf8631ec28ff9e060ae54f06db75a06ac872936b (patch)
treecf65e62985ab03a23e6ca24375eecda7d8930c5c /morphlib/writeexts.py
parent007c3cf1aedba2991383d57e947c11514a9ad29b (diff)
downloadmorph-af8631ec28ff9e060ae54f06db75a06ac872936b.tar.gz
Make bootloader installation for disk images optional
Diffstat (limited to 'morphlib/writeexts.py')
-rwxr-xr-xmorphlib/writeexts.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/morphlib/writeexts.py b/morphlib/writeexts.py
index af48b375..23b876ae 100755
--- a/morphlib/writeexts.py
+++ b/morphlib/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'