From: Tomáš Virtus Date: Wed, 19 Feb 2020 14:14:30 +0000 (+0100) Subject: Fix duplicate Syslinux entries (2) X-Git-Tag: v0.18.0~9^2 X-Git-Url: https://git.grml.org/?p=grml2usb.git;a=commitdiff_plain;h=480b9746fc91e73c929a0b70b58472ed5cce6f1b Fix duplicate Syslinux entries (2) Commit f0e3c936 changed open mode to "r+", but this mode does not create missing files. Revert open mode back to "a+" and add seek to beginning of the file. --- diff --git a/grml2usb b/grml2usb index 5a94e10..6cf456a 100755 --- a/grml2usb +++ b/grml2usb @@ -1323,7 +1323,8 @@ def add_entry_if_not_present(filename, entry): @filename: name of the file @entry: data to write to the file """ - data = open(filename, "r+") + data = open(filename, "a+") + data.seek(0) for line in data: if line == entry: break