Postinstall bugfixes

This commit is contained in:
root 2013-10-26 20:56:26 +00:00
parent 3321103498
commit 6893a51514
2 changed files with 61 additions and 59 deletions

View file

@ -83,8 +83,7 @@ def main():
try: try:
with open('/etc/yunohost/installed') as f: pass with open('/etc/yunohost/installed') as f: pass
except IOError: except IOError:
admin_password_provided = True postinstall = True
admin_password = "yunohost"
if len(sys.argv) < 3 or sys.argv[1] != 'tools' or sys.argv[2] != 'postinstall': if len(sys.argv) < 3 or sys.argv[1] != 'tools' or sys.argv[2] != 'postinstall':
raise YunoHostError(17, _("YunoHost is not correctly installed, please execute 'yunohost tools postinstall'")) raise YunoHostError(17, _("YunoHost is not correctly installed, please execute 'yunohost tools postinstall'"))
@ -101,7 +100,9 @@ def main():
admin_password = f.read() admin_password = f.read()
admin_password_provided = True admin_password_provided = True
except IOError: pass except IOError: pass
if admin_password_provided: if postinstall:
result = args.func(**args_dict)
elif admin_password_provided:
with YunoHostLDAP(password=admin_password): with YunoHostLDAP(password=admin_password):
result = args.func(**args_dict) result = args.func(**args_dict)
elif os.isatty(1) and write_ldap: elif os.isatty(1) and write_ldap:

View file

@ -207,7 +207,6 @@ def tools_postinstall(domain, password, dyndns=False):
password -- YunoHost admin password password -- YunoHost admin password
""" """
with YunoHostLDAP(password='yunohost') as yldap:
try: try:
with open('/etc/yunohost/installed') as f: pass with open('/etc/yunohost/installed') as f: pass
except IOError: except IOError:
@ -244,7 +243,7 @@ def tools_postinstall(domain, password, dyndns=False):
os.system('hostname yunohost.yunohost.org') os.system('hostname yunohost.yunohost.org')
# Samba sh*t fix # Samba sh*t fix
if os.system('net getlocalsid') != 0: if os.system('net getlocalsid > /dev/null') != 0:
os.system('apt-get install --reinstall -y -qq samba yunohost-config-samba') os.system('apt-get install --reinstall -y -qq samba yunohost-config-samba')
os.system('smbpasswd -w yunohost') os.system('smbpasswd -w yunohost')
@ -265,6 +264,8 @@ def tools_postinstall(domain, password, dyndns=False):
if os.system(command) != 0: if os.system(command) != 0:
raise YunoHostError(17, _("There were a problem during CA creation")) raise YunoHostError(17, _("There were a problem during CA creation"))
with YunoHostLDAP(password='yunohost') as yldap:
# Initialize YunoHost LDAP base # Initialize YunoHost LDAP base
tools_ldapinit(password) tools_ldapinit(password)