linuxinstaller/libreticmenu/PythonActions.py

14 lines
336 B
Python
Raw Normal View History

2024-10-06 23:44:04 +02:00
import socket
import subprocess
def getHostName():
return socket.gethostname()
def getDomain():
domainname = subprocess.check_output(['domainname', '-d'], text=True).rstrip()
return domainname
def setFQDN(fqdn):
result = subprocess.run(['hostnamectl', 'hostname', fqdn], check=True)
return result.returncode == 0