diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-05-09 13:45:02 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-05-09 13:45:02 +0000 |
commit | 090ce8ee2e08d29bbcb55310df1bea9e4226e11f (patch) | |
tree | 5f0af87de7403437d012040fe9666c6fd2d13190 /morphlib/writeexts.py | |
parent | be72eb1771b0d83bf3a48ac2e59255dc8644e665 (diff) | |
parent | b4db5cdc3a24166954739dac29c78e541b908613 (diff) | |
download | morph-090ce8ee2e08d29bbcb55310df1bea9e4226e11f.tar.gz |
Merge branch 'liw/fix-rawdisk-on-arm'
Reviewed-By: Jonathan Maw (on irc)
Diffstat (limited to 'morphlib/writeexts.py')
-rwxr-xr-x | morphlib/writeexts.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/morphlib/writeexts.py b/morphlib/writeexts.py index 2cdba86f..ed8f7ba6 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) @@ -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' |