From 66920372d0c9f4aa078319dd57d5a5b261e753fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Mon, 4 Apr 2016 12:30:09 +0200 Subject: [PATCH] [fix] Correct ldap_email_attr and test config at installation --- conf/config.json | 2 +- scripts/_common.sh | 6 +++--- scripts/install | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/conf/config.json b/conf/config.json index 209c11b..7926ff2 100644 --- a/conf/config.json +++ b/conf/config.json @@ -15,7 +15,7 @@ "ldap_base": "dc=yunohost,dc=org", "ldap_base_groups": "dc=yunohost,dc=org", "ldap_base_users": "dc=yunohost,dc=org", - "ldap_email_attribute": "mail", + "ldap_email_attr": "mail", "ldap_expert_username_attr": "uid", "ldap_quota_attr": "mailQuota", "ldap_user_display_name": "cn", diff --git a/scripts/_common.sh b/scripts/_common.sh index c8d48f0..48562fa 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -55,10 +55,10 @@ exec_as() { shift 1 if [[ $USER = $(whoami) ]]; then - eval $@ + eval "$@" else # use sudo twice to be root and be allowed to use another user - sudo sudo -u "$USER" $@ + sudo sudo -u "$USER" "$@" fi } @@ -70,5 +70,5 @@ exec_occ() { shift 2 (cd "$WORKDIR" && exec_as "$AS_USER" \ - php occ --no-interaction --quiet --no-ansi $@) + php occ --no-interaction --quiet --no-ansi "$@") } diff --git a/scripts/install b/scripts/install index 2e48c2a..f634d0d 100755 --- a/scripts/install +++ b/scripts/install @@ -107,14 +107,15 @@ _exec_occ ldap:create-empty-config _exec_occ config:import "$oc_conf" sudo rm -f "$oc_conf" +# Check LDAP configuratio to see if everything worked well +_exec_occ ldap:test-config \'\' \ + || die "An error occured during LDAP configuration" + # Set the user as admin and delete admin user ynh_mysql_connect_as $dbuser $dbpass $dbname \ <<< "INSERT INTO oc_group_user VALUES ('admin','$admin');" _exec_occ user:delete admin -## Needed for Jessie/PHP5.6 compatibility -#sudo sed -i "s/;always_populate_raw/always_populate_raw/" /etc/php5/cli/php.ini - # Iterate over users to extend their home folder permissions - for the external # storage plugin usage - and create relevant ownCloud directories for u in $(ynh_user_list); do