summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTails developers <tails@boum.org>2014-06-24 09:30:35 +0000
committerTails developers <tails@boum.org>2014-06-24 09:30:35 +0000
commite7cc89830ca846228f3389740712f79b137dc0db (patch)
treeda593792e5fd27adbd2aa5339e6dd9e08b72b0d1
parent3262899cad630dc0e5fecd745a9035cc75d3a9f1 (diff)
parentf378c8aa79b5678f6882ab4169923aa2dbb5dd8d (diff)
Merge branch 'bugfix/7345-upgrade-from-iso-from-1.0-to-1.1'
-rw-r--r--liveusb/config.py3
-rwxr-xr-xliveusb/creator.py50
-rwxr-xr-xliveusb/gui.py33
3 files changed, 31 insertions, 55 deletions
diff --git a/liveusb/config.py b/liveusb/config.py
index 8ccaaf8..e3e1b40 100644
--- a/liveusb/config.py
+++ b/liveusb/config.py
@@ -12,7 +12,8 @@ default_config = {
'main_liveos_dir': 'live',
'running_liveos_mountpoint': '/lib/live/mount/medium',
'liveos_toplevel_files': [ 'autorun.bat', 'autorun.inf', 'boot', '.disk',
- 'doc', 'EFI', 'live', 'isolinux', 'syslinux', 'tmp' ],
+ 'doc', 'EFI', 'live', 'isolinux', 'syslinux',
+ 'tmp', 'utils' ],
'download': { 'enabled': False,
},
'persistence': { 'enabled': False,
diff --git a/liveusb/creator.py b/liveusb/creator.py
index 077d633..ad9a0ab 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -33,6 +33,7 @@ import signal
import time
import os
import re
+import stat
import sys
from StringIO import StringIO
@@ -470,6 +471,10 @@ class LiveUSBCreator(object):
'outfile': outfile,
'message': str(e)})
+ syslinux_path = self.get_liveos_file_path("syslinux")
+ _move_if_exists(self.get_liveos_file_path("isolinux"), syslinux_path)
+ _unlink_if_exists(os.path.join(syslinux_path, "isolinux.cfg"))
+
def delete_liveos(self):
""" Delete the files installed by the existing Live OS, after
chmod'ing them since Python for Windows is unable to delete
@@ -940,22 +945,6 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
""" Run syslinux to install the bootloader on our devices """
LiveUSBCreator.install_bootloader(self)
self.log.info(_("Installing bootloader..."))
- syslinux_path = self.get_liveos_file_path("syslinux")
- _move_if_exists(self.get_liveos_file_path("isolinux"), syslinux_path)
- _unlink_if_exists(os.path.join(syslinux_path, "isolinux.cfg"))
-
- # 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')
@@ -965,16 +954,28 @@ 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)
+ os.chmod(tmp_syslinux,
+ os.stat(tmp_syslinux).st_mode | stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH)
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 """
@@ -1111,19 +1112,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)])
diff --git a/liveusb/gui.py b/liveusb/gui.py
index 180f0b6..d2f89f8 100755
--- a/liveusb/gui.py
+++ b/liveusb/gui.py
@@ -238,9 +238,8 @@ class LiveUSBThread(QtCore.QThread):
self.live.create_persistent_overlay()
self.live.update_configs()
- if self.parent.opts.partition:
- self.live.reset_mbr()
- else:
+ self.live.reset_mbr()
+ if not self.parent.opts.partition:
self.live.update_system_partition_properties()
self.live.install_bootloader()
# self.live.bootable_partition()
@@ -359,7 +358,6 @@ class LiveUSBDialog(QtGui.QDialog, LiveUSBInterface):
self.connect_slots()
self.confirmed = False
self.delete_existing_liveos_confirmed = False
- self.mbr_reset_confirmed = False
# Intercept all liveusb INFO log messages, and display them in the gui
self.handler = LiveUSBLogHandler(lambda x: self.textEdit.append(x))
@@ -645,29 +643,10 @@ class LiveUSBDialog(QtGui.QDialog, LiveUSBInterface):
for signal_match in self.signals_connected:
signal_match.remove()
- # Unmount the device and check the MBR
- if self.live.blank_mbr():
- if self.opts.partition:
- self.mbr_reset_confirmed = True
- if not self.mbr_reset_confirmed:
- self.status(_("The Master Boot Record on your device is blank. "
- "Pressing 'Install Tails' again will reset the "
- "MBR on this device."))
- self.mbr_reset_confirmed = True
- self.enable_widgets(True)
- return
- if self.live.drive['mount']:
- self.live.dest = self.live.drive['mount']
- self.live.unmount_device()
- self.live.reset_mbr()
- elif not self.live.mbr_matches_syslinux_bin():
- if self.opts.reset_mbr:
- self.live.reset_mbr()
- else:
- self.live.log.warn(_("Warning: The Master Boot Record on your device "
- "does not match your system's syslinux MBR. If you "
- "have trouble booting this stick, try running the "
- "liveusb-creator with the --reset-mbr option."))
+ # Unmount the device if needed
+ if self.live.drive['mount']:
+ self.live.dest = self.live.drive['mount']
+ self.live.unmount_device()
if not self.opts.partition:
try: