summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-05-09 13:45:02 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-05-09 13:45:02 +0000
commit782d30d41f491ae43e1e6040466519b9b231dabd (patch)
tree48a1c26e0a6c03e07de36884ee557b5e54a34a19
parent4cd3a4060146a37cdef216ee4dc346c0f7229f8c (diff)
parentfbfcdcedf7b7e69f3d340b92785b3b4355e3f543 (diff)
downloaddefinitions-782d30d41f491ae43e1e6040466519b9b231dabd.tar.gz
Merge branch 'liw/fix-rawdisk-on-arm'
Reviewed-By: Jonathan Maw (on irc)
-rwxr-xr-xwriteexts.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/writeexts.py b/writeexts.py
index 2cdba86f..ed8f7ba6 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)
@@ -228,3 +229,25 @@ 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.
+
+ '''
+
+ def is_x86(arch):
+ return (arch == 'x86_64' or
+ (arch.startswith('i') and arch.endswith('86')))
+
+ value = os.environ.get('BOOTLOADER', 'auto')
+ if value == 'auto':
+ if ix_x86(os.uname()[-1]):
+ value = 'yes'
+ else:
+ value = 'no'
+
+ return value == 'yes'