summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTails developers <tails@boum.org>2014-06-13 15:14:50 +0000
committerTails developers <tails@boum.org>2014-06-13 18:05:07 +0000
commitb28a8a32389685f932e584b7fabec9a9b35a5e42 (patch)
treecd8efe50a5c69ef0f16e4963c27ef61d585b6879
parent76865cae6b74e64379025ebe0b713f7e58d55a94 (diff)
Install the bootloader using the syslinux binary found on the target device, once the Live OS has been extracted/copied there.
This is about Tails#7345: running syslinux creates ldlinux.sys, whose version must match the one of *.c32. On clone'n'{install,upgrade}, we don't care much: /usr/bin/syslinux and $TARGET/utils/linux/syslinux are the same binary, as the latter was copied from the former at ISO build time. But, when performing an "Upgrade from ISO", it does matter, as these two binaries may very well be different. Accordingly: 1. Stop overwriting the COM32R modules provided in the ISO, with the (possibly older ones) that are in the system running Tails Installer. 2. When installing the syslinux MBR to the target drive, use the one found on the target device, once the Live OS has been extracted/copied there.
-rwxr-xr-xliveusb/creator.py40
1 files changed, 16 insertions, 24 deletions
diff --git a/liveusb/creator.py b/liveusb/creator.py
index ce808c1..2f4e240 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -945,19 +945,6 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
LiveUSBCreator.install_bootloader(self)
self.log.info(_("Installing bootloader..."))
- # Syslinux doesn't guarantee the API for its com32 modules (#492370)
- for com32mod in ('vesamenu.c32', 'menu.c32'):
- copied = False
- for path in ('/usr/share', '/usr/lib'):
- com32path = os.path.join(path, 'syslinux', com32mod)
- if os.path.isfile(com32path):
- self.log.debug('Copying %s on to stick' % com32path)
- shutil.copyfile(com32path, os.path.join(syslinux_path, com32mod))
- copied = True
- break
- if copied:
- break
-
# Don't prompt about overwriting files from mtools (#491234)
for ldlinux in [self.get_liveos_file_path(p, 'ldlinux.sys')
for p in ('syslinux', '')]:
@@ -966,16 +953,26 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
self.log.debug(_("Removing %(file)s") % {'file': ldlinux})
os.unlink(ldlinux)
+ # XXX: broken now that we use the syslinux binary from the
+ # ISO, but installing on extN is not supported for Tails
+ # anyway, and likely we've broken it in various other ways
+ # already anyway.
if self.drive['fstype'] in self.ext_fstypes:
shutil.move(os.path.join(syslinux_path, "syslinux.cfg"),
os.path.join(syslinux_path, "extlinux.conf"))
self.popen("extlinux -i '%s'" % syslinux_path)
else: # FAT
+ iso_syslinux = self.get_liveos_file_path('utils', 'linux', 'syslinux')
+ tmpdir = tempfile.mkdtemp
+ tmp_syslinux = os.path.join(tmpdir, 'syslinux')
+ shutil.copy(iso_syslinux, tmp_syslinux)
self.flush_buffers()
self.unmount_device()
- self.popen('syslinux %s -d %s %s' % (
+ self.popen('%s %s -d %s %s' % (
+ tmp_syslinux,
' '.join(self.syslinux_options()),
'syslinux', self.drive['device']))
+ shutil.rmtree(tmpdir)
def get_free_bytes(self, device=None):
""" Return the number of available bytes on our device """
@@ -1112,19 +1109,14 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
return self.get_mbr() == '0000'
def _get_mbr_bin(self):
- mbr = None
- for mbr_bin in ('/usr/lib/syslinux/mbr/gptmbr.bin',
- '/usr/lib/SYSLINUX/gptmbr.bin',
- '/usr/lib/syslinux/gptmbr.bin',
- '/usr/share/syslinux/gptmbr.bin'):
- if os.path.exists(mbr_bin):
- mbr = mbr_bin
- return mbr
+ # We install syslinux' gptmbr.bin as mbr.bin there, for
+ # compatibility with paths used by Tuxboot and possibly others
+ return self.get_liveos_file_path('utils', 'mbr', 'mbr.bin')
def mbr_matches_syslinux_bin(self):
"""
- Return whether or not the MBR on the drive matches the system's
- syslinux gptmbr.bin
+ Return whether or not the MBR on the drive matches the syslinux'
+ gptmbr.bin found in the system being installed
"""
mbr_bin = open(self._get_mbr_bin(), 'rb')
mbr = ''.join(['%02X' % ord(x) for x in mbr_bin.read(2)])