Fix duplicate Syslinux entries (2)
authorTomáš Virtus <nechtom@gmail.com>
Wed, 19 Feb 2020 14:14:30 +0000 (15:14 +0100)
committerTomáš Virtus <nechtom@gmail.com>
Wed, 19 Feb 2020 14:14:30 +0000 (15:14 +0100)
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.

grml2usb

index 5a94e10..6cf456a 100755 (executable)
--- 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