From 185e4bbd0e80c8096dd5472f359ee82f847070c0 Mon Sep 17 00:00:00 2001 From: Kload Date: Sun, 7 Jul 2013 09:38:18 +0200 Subject: [PATCH] Enter password at prompt automaticaly --- yunohost_tools.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/yunohost_tools.py b/yunohost_tools.py index f076af2e..3853b59f 100644 --- a/yunohost_tools.py +++ b/yunohost_tools.py @@ -33,7 +33,7 @@ from yunohost import YunoHostError, YunoHostLDAP, validate, colorize, get_requir from yunohost_domain import domain_add from yunohost_dyndns import dyndns_subscribe -def tools_ldapinit(): +def tools_ldapinit(password=None): """ YunoHost LDAP initialization @@ -78,10 +78,9 @@ def tools_ldapinit(): os.system('chmod 600 /etc/smbldap-tools/smbldap_bind.conf') os.system('smbpasswd -w yunohost') sid = subprocess.check_output(['net', 'getlocalsid']).strip().split(':')[1][1:] - os.system('echo \'SID="'+ sid +'"\' >> /etc/smbldap-tools/smbldap.conf') - #os.system('smbldap-populate -e /tmp/samba-ldap.ldif') - os.system('smbldap-populate') - # TODO: change root domain password + os.system('echo \'SID="'+ sid +'"\' >> /etc/smbldap-tools/smbldap.conf') + if password is not None: + os.system('echo "'+ password +'\n'+ password +'" | smbldap-populate') win_msg(_("LDAP has been successfully initialized")) @@ -253,7 +252,7 @@ def tools_postinstall(domain, password, dyndns=False): raise YunoHostError(17, _("There were a problem during CA creation")) # Initialize YunoHost LDAP base - tools_ldapinit() + tools_ldapinit(password) # New domain config tools_maindomain(old_domain='yunohost.org', new_domain=domain)