From 1caecd5e35819f08b10df1faeb57fe115082c7d4 Mon Sep 17 00:00:00 2001 From: Paolo Asperti Date: Mon, 6 May 2019 22:14:45 +0200 Subject: [PATCH] typo fix --- libreschool-client | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libreschool-client b/libreschool-client index 82cef8e..ecbc072 100755 --- a/libreschool-client +++ b/libreschool-client @@ -27,15 +27,15 @@ def update_config_file(config): config.write(configfile) def set_new_hostname(hostname, domainname, oldhostname): + if os.path.isfile('/etc/hosts'): + f1=open('/etc/hosts','r').read() + m1=f1.replace(oldhostname,hostname) + m2=m1.replace(oldhostname+'.'+domainname, hostname+'.'+domainname) + f2=open('/etc/hosts','w') + f2.write(m2) os.system("hostname -b "+hostname) with open('/etc/hostname', 'w') as hostnamefile: hostnamefile.write(hostname) - if not os.path.isfile('/etc/hosts'): - f1=open('/etc/hosts','r').read() - m=f1.replace(oldhostname,hostname) - m=m.replace(oldhostname+'.'+domainname, hostname+'.'+domainname) - f2=open('/etc/hosts','w') - f2.write(m) return config = configparser.ConfigParser()