Forcing to create the configuration file

This commit is contained in:
clamsawd 2015-11-06 17:44:24 +01:00
parent 363a101026
commit b930ce5fe9
2 changed files with 7 additions and 29 deletions

View File

@ -55,18 +55,13 @@ if os.path.exists(".ip2e"):
if os.path.isfile("ip2e-conf.py"): if os.path.isfile("ip2e-conf.py"):
print ("ip2e-conf.py exists") print ("ip2e-conf.py exists")
else: else:
print ("ip2e-conf.py created") ClearScreen()
ip2ecf=open('ip2e-conf.py','w') print ("")
ip2ecf.close() print ("The configuration file doesn't exist")
ip2ecf=open('ip2e-conf.py','a') print ("")
ip2ecf.write('# sample configuration file of ip2e\n') print ("You can create it if you run 'ip2e-config.py'")
ip2ecf.write('\n') print ("")
ip2ecf.write('FromEmail="ip2e@daemon"\n') exit(0)
ip2ecf.write('FromEmailUser="unknown"\n')
ip2ecf.write('FromEmailPass="password-here"\n')
ip2ecf.write('SmtpFromEmail="smtp.email.com"\n')
ip2ecf.write('ToEmail="unknown@email.com"\n')
ip2ecf.close()
#Check if exists 'current-ip.py' #Check if exists 'current-ip.py'
if os.path.isfile("current-ip.py"): if os.path.isfile("current-ip.py"):

View File

@ -47,23 +47,6 @@ if not os.path.exists(".ip2e"):
if os.path.exists(".ip2e"): if os.path.exists(".ip2e"):
os.chdir(".ip2e") os.chdir(".ip2e")
#Check if exists 'ip2e-conf.py'
if os.path.isfile("ip2e-conf.py"):
print ("ip2e-conf.py exists")
else:
print ("ip2e-conf.py created")
ip2ecf=open('ip2e-conf.py','w')
ip2ecf.close()
ip2ecf=open('ip2e-conf.py','a')
ip2ecf.write('# sample configuration file of ip2e\n')
ip2ecf.write('\n')
ip2ecf.write('FromEmail="ip2e@daemon"\n')
ip2ecf.write('FromEmailUser="unknown"\n')
ip2ecf.write('FromEmailPass="password-here"\n')
ip2ecf.write('SmtpFromEmail="smtp.email.com"\n')
ip2ecf.write('ToEmail="unknown@email.com"\n')
ip2ecf.close()
#See the log file #See the log file
if os.path.isfile("ip2e.log"): if os.path.isfile("ip2e.log"):
print ("ip2e.log exists") print ("ip2e.log exists")