This commit is contained in:
root 2012-10-25 19:52:59 +02:00
parent 91ce44d6d0
commit 7648b641e2
2 changed files with 16 additions and 15 deletions

View file

@ -125,7 +125,7 @@ def get_required_args(args, required_args, password=False):
else: else:
raise Exception #FIX raise Exception #FIX
# Password # Password
if not 'password' in args and password and 'password' in required_args: if 'password' not in args and password and 'password' in required_args:
if os.isatty(1): if os.isatty(1):
args['password'] = getpass.getpass(colorize(required_args['password'] + ': ', 'cyan')) args['password'] = getpass.getpass(colorize(required_args['password'] + ': ', 'cyan'))
pwd2 = getpass.getpass(colorize('Retype ' + required_args['password'][0].lower() + required_args['password'][1:] + ': ', 'cyan')) pwd2 = getpass.getpass(colorize('Retype ' + required_args['password'][0].lower() + required_args['password'][1:] + ': ', 'cyan'))

View file

@ -163,24 +163,25 @@ def tools_postinstall(args, connections):
dict dict
""" """
with get_required_args(args, {'domain' : _('Main domain name'), 'password' : _('New admin password') }, True) as args: args = get_required_args(args, {'domain' : _('Main domain name'), 'password' : _('New admin password') }, True)
try: try:
with open('/usr/share/yunohost/yunohost-config/others/installed') as f: pass with open('/usr/share/yunohost/yunohost-config/others/installed') as f: pass
except IOError: except IOError:
print('Installing YunoHost') print('Installing YunoHost')
else: else:
raise YunoHostError(17, _("YunoHost is already installed")) raise YunoHostError(17, _("YunoHost is already installed"))
# Initialize YunoHost LDAP base # Initialize YunoHost LDAP base
tools_ldapinit(args, connections) tools_ldapinit(args, connections)
# Change LDAP admin password print(args)
tools_adminpw({ 'old' : 'yunohost', 'new' : args['password']}) # Change LDAP admin password
tools_adminpw({ 'old' : 'yunohost', 'new' : args['password']})
# New domain config # New domain config
tools_maindomain({ 'old' : 'yunohost.org', 'new' : args['domain']}) tools_maindomain({ 'old' : 'yunohost.org', 'new' : args['domain']})
os.system('touch /usr/share/yunohost/yunohost-config/others/installed') os.system('touch /usr/share/yunohost/yunohost-config/others/installed')
return { 'Success' : _("YunoHost has been successfully configured") } return { 'Success' : _("YunoHost has been successfully configured") }