Merge pull request #319 from shinji-s/devel

Fix exception from opening utf-8 encoded text file
pull/320/head
multibootusb 6 years ago committed by GitHub
commit ef7d1a1d89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -367,7 +367,8 @@ def update_distro_cfg_files(iso_link, usb_disk, distro, persistence=0):
return
log("Probing '%s'!" % fname)
theme_file = os.path.join(dir_, fname)
with open(theme_file, 'r') as f:
updated = False
with open(theme_file, 'r', encoding='utf-8') as f:
lines = []
pattern = re.compile(r'^desktop-image\s*:\s*(.*)$')
for line in f.readlines():
@ -375,12 +376,14 @@ def update_distro_cfg_files(iso_link, usb_disk, distro, persistence=0):
m = pattern.match(line)
if m and m.group(1).startswith(('/', '"/')):
log("Updating '%s'" % line)
updated = True
partial_path = m.group(1).strip('"').lstrip('/')
line = 'desktop-image: "%s/%s"' % \
(install_dir_for_grub, partial_path)
lines.append(line)
with open(theme_file, 'w') as f:
f.write('\n'.join(lines))
if updated:
with open(theme_file, 'w') as f:
f.write('\n'.join(lines))
visitor_callbacks = [
# Ensure that isolinux.cfg file is copied as syslinux.cfg

Loading…
Cancel
Save