summaryrefslogtreecommitdiff
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
commit81cbbef81e44cc4bd1f3440c40a524667be698c3 (patch)
tree78a53eb5adfa90329b7199c58b353732fd19affd
parent2fa5a589912f660ddc2a08024eb511479042e29e (diff)
downloaddefinitions-81cbbef81e44cc4bd1f3440c40a524667be698c3.tar.gz
Make bootloader installation for disk images optional
-rwxr-xr-xwriteexts.py21
1 files changed, 20 insertions, 1 deletions
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'