+XORG_CONF_HEADER = "# Automatically generated by grml-x."
+def check_old_xorg_conf(filename, overwrite):
+ # True: no problem, we can create/overwrite the config file
+ # False: pre-existing config file, and we are not to overwrite it
+ if overwrite: return True
+ if not os.path.exists(filename): return True
+ try:
+ f = file(filename, 'r')
+ lines = f.readlines()
+ f.close()
+ return (not XORG_CONF_HEADER in lines)
+ except IOError:
+ return False
+