mirror of
https://github.com/StevenBlack/hosts.git
synced 2024-07-14 00:00:34 +02:00
Host file now lists 127.0.0.1 localhost, 0.0.0.0 the others.
This commit is contained in:
parent
a89a3e2577
commit
4998b31f24
@ -164,6 +164,7 @@ def removeDups(mergeFile):
|
|||||||
mergeFile.seek(0) # reset file pointer
|
mergeFile.seek(0) # reset file pointer
|
||||||
|
|
||||||
hostnames = set()
|
hostnames = set()
|
||||||
|
hostnames.add("localhost")
|
||||||
for line in mergeFile.readlines():
|
for line in mergeFile.readlines():
|
||||||
if line[0].startswith("#") or re.match(r'^\s*$', line[0]):
|
if line[0].startswith("#") or re.match(r'^\s*$', line[0]):
|
||||||
finalFile.write(line) #maintain the comments for readability
|
finalFile.write(line) #maintain the comments for readability
|
||||||
@ -218,6 +219,9 @@ def writeOpeningHeader(finalFile):
|
|||||||
finalFile.write('#\n')
|
finalFile.write('#\n')
|
||||||
finalFile.write('# Merging these sources produced ' + str(numberOfRules) + ' unique entries\n')
|
finalFile.write('# Merging these sources produced ' + str(numberOfRules) + ' unique entries\n')
|
||||||
finalFile.write('# ===============================================================\n')
|
finalFile.write('# ===============================================================\n')
|
||||||
|
finalFile.write('\n')
|
||||||
|
finalFile.write('127.0.0.1 localhost\n')
|
||||||
|
finalFile.write('\n')
|
||||||
finalFile.write(fileContents)
|
finalFile.write(fileContents)
|
||||||
|
|
||||||
def updateReadme(numberOfRules):
|
def updateReadme(numberOfRules):
|
||||||
|
Loading…
Reference in New Issue
Block a user