mirror of
https://github.com/KDE/kde-linux.git
synced 2026-08-04 11:12:32 -04:00
27 lines
784 B
Python
Executable File
27 lines
784 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
# SPDX-FileCopyrightText: 2025 Hadi Chokr <hadichokr@icloud.com>
|
|
|
|
import os
|
|
import sys
|
|
|
|
def replace_lines_in_place(lines):
|
|
for i, line in enumerate(lines):
|
|
if not line.startswith("hosts: "):
|
|
continue
|
|
|
|
lines[i] = line.replace("mymachines", "mymachines mdns_minimal [NOTFOUND=return]", 1)
|
|
return
|
|
raise RuntimeError("Expected modification but no changes were made.")
|
|
|
|
def modify_nsswitch():
|
|
with open("/usr/share/factory/etc/nsswitch.conf", "r+") as file:
|
|
lines = file.readlines()
|
|
replace_lines_in_place(lines)
|
|
file.seek(0)
|
|
file.writelines(lines)
|
|
|
|
if __name__ == "__main__":
|
|
modify_nsswitch()
|