@@ -91,6 +91,7 @@ def get_defaults():
9191 "commonexclusions" : ["hulu.com" ],
9292 "blacklistfile" : path_join_robust (BASEDIR_PATH , "blacklist" ),
9393 "whitelistfile" : path_join_robust (BASEDIR_PATH , "whitelist" ),
94+ "addsystemhostname" : True ,
9495 }
9596
9697
@@ -229,6 +230,14 @@ def main():
229230 default = path_join_robust (BASEDIR_PATH , "blacklist" ),
230231 help = "Blacklist file to use while generating hosts files." ,
231232 )
233+ parser .add_argument (
234+ "--dont-add-system-hostname" ,
235+ "-d" ,
236+ dest = "addsystemhostname" ,
237+ default = True ,
238+ action = "store_false" ,
239+ help = "Don't add the current system hostname while generating hosts files." ,
240+ )
232241
233242 global settings
234243
@@ -327,6 +336,7 @@ def main():
327336 outputsubfolder = outputsubfolder ,
328337 skipstatichosts = skipstatichosts ,
329338 nounifiedhosts = nounifiedhosts ,
339+ addsystemhostname = settings ["addsystemhostname" ],
330340 )
331341 finalfile .close ()
332342
@@ -1272,6 +1282,7 @@ def write_opening_header(finalfile, **headerparams):
12721282 3) outputsubfolder
12731283 4) skipstatichosts
12741284 5) nounifiedhosts
1285+ 6) hostfilename
12751286 """
12761287
12771288 finalfile .seek (0 ) # Reset file pointer.
@@ -1389,7 +1400,7 @@ def write_opening_header(finalfile, **headerparams):
13891400 write_data (finalfile , "ff02::3 ip6-allhosts\n " )
13901401 write_data (finalfile , "0.0.0.0 0.0.0.0\n " )
13911402
1392- if platform .system () == "Linux" :
1403+ if platform .system () == "Linux" and "addsystemhostname" in headerparams . keys () and headerparams [ "addsystemhostname" ] :
13931404 write_data (finalfile , "127.0.1.1 " + socket .gethostname () + "\n " )
13941405 write_data (finalfile , "127.0.0.53 " + socket .gethostname () + "\n " )
13951406
0 commit comments