190
190
'bs=512', 'count=62', 'seek=1', 'conv=sync'])
192
192
if syslinux_legacy and find_on_path('syslinux-legacy'):
193
syslinux_var = "syslinux-legacy"
193
194
syslinux_exe = "syslinux-legacy"
194
195
syslinux_bin = "/usr/lib/syslinux-legacy/mbr.bin"
197
syslinux_var = "syslinux"
196
198
syslinux_exe = "syslinux"
197
199
syslinux_bin = "/usr/lib/syslinux/mbr/mbr.bin"
198
200
if not os.path.exists(syslinux_bin):
199
201
syslinux_bin = "/usr/lib/syslinux/mbr.bin"
203
target_mounts = obj.get_filesystem().get_cached_property('MountPoints').get_bytestring_array()
204
if len(target_mounts) > 0:
205
target_mnt = target_mounts[0]
206
squashfs_img = os.path.join(target_mnt, 'casper',
207
'filesystem.squashfs')
208
if os.path.exists(squashfs_img):
209
# Mount the squashfs so we are possible to install
210
# syslinux & mbr.bin from it.
211
squashfs_mnt = self.MountISO(squashfs_img)
214
os.path.join(squashfs_mnt, 'usr', 'lib',
215
syslinux_var, 'mbr.bin'),
216
os.path.join(squashfs_mnt, 'usr', 'lib',
217
syslinux_var, 'mbr', 'mbr.bin'),
218
os.path.join(squashfs_mnt, 'usr', 'lib',
219
syslinux_var.upper(), 'mbr.bin'),
221
if os.path.exists(mbrbin):
222
syslinux_exe = os.path.join(squashfs_mnt, 'usr',
224
syslinux_bin = mbrbin
200
226
popen([syslinux_exe, '-f', device])
201
227
# Write the syslinux MBR.
202
228
popen(['dd', 'if=%s' % syslinux_bin, 'of=%s' % parent_file,
203
229
'bs=446', 'count=1', 'conv=sync'])
231
self.UnmountFile(squashfs_mnt)
205
233
part = obj.get_partition()