diff --git a/root/etc/e-smith/templates/etc/e-smith/sql/init/ownclouddb b/root/etc/e-smith/templates/etc/e-smith/sql/init/ownclouddb index d95b4e5..65e7926 100644 --- a/root/etc/e-smith/templates/etc/e-smith/sql/init/ownclouddb +++ b/root/etc/e-smith/templates/etc/e-smith/sql/init/ownclouddb @@ -54,27 +54,29 @@ wget -O /dev/null --no-check-certificate https://$SystemName.$DomainName/ownclou USE $db; -REPLACE INTO appconfig (appid, configkey, configvalue) VALUES -('user_ldap', 'ldap_base', '$ldapBase'), -('user_ldap', 'ldap_base_groups', 'ou=Groups,$ldapBase'), -('user_ldap', 'ldap_base_users', 'ou=Users,$ldapBase'); - - -INSERT IGNORE INTO appconfig (appid, configkey, configvalue) VALUES -('user_ldap', 'enabled', 'yes'), -('user_ldap', 'ldap_cache_ttl', '1'), -('user_ldap', 'ldap_display_name', 'uid'), -('user_ldap', 'ldap_email_attr', 'mail'), -('user_ldap', 'ldap_group_display_name', 'cn'), -('user_ldap', 'ldap_group_filter', 'objectClass=mailboxRelatedObject'), -('user_ldap', 'ldap_group_member_assoc_attribute', 'memberUid'), -('user_ldap', 'ldap_host', '127.0.0.1'), -('user_ldap', 'ldap_login_filter', 'uid=%uid'), -('user_ldap', 'ldap_userlist_filter', 'objectClass=sambaSamAccount'), -('user_ldap', 'ldap_uuid_attribute', 'entryuuid'), -('user_ldap', 'types', 'authentication'); - -UPDATE IGNORE group_user group_user SET uid='admin' where uid='owncloud'; +ALTER IGNORE TABLE appconfig ADD UNIQUE KEY (appid,configKey); + +INSERT INTO appconfig (appid,configKey,configValue) VALUES ('user_ldap','ldap_base','$ldapBase') ON DUPLICATE KEY UPDATE configValue='$ldapBase'; +INSERT INTO appconfig (appid,configKey,configValue) VALUES ('user_ldap','ldap_base_users','ou=Users,$ldapBase') ON DUPLICATE KEY UPDATE configValue='ou=Users,$ldapBase'; +INSERT INTO appconfig (appid,configKey,configValue) VALUES ('user_ldap','ldap_base_groups','ou=Groups,$ldapBase') ON DUPLICATE KEY UPDATE configValue='ou=Groups,$ldapBase'; + +INSERT INTO appconfig (appid,configKey,configValue) VALUES ('user_ldap','enabled','yes') ON DUPLICATE KEY UPDATE configValue=configValue; +INSERT INTO appconfig (appid,configKey,configValue) VALUES ('user_ldap','ldap_cache_ttl','1') ON DUPLICATE KEY UPDATE configValue=configValue; +INSERT INTO appconfig (appid,configKey,configValue) VALUES ('user_ldap','ldap_email_attr','mail') ON DUPLICATE KEY UPDATE configValue=configValue; +INSERT INTO appconfig (appid,configKey,configValue) VALUES ('user_ldap','ldap_group_display_name','cn') ON DUPLICATE KEY UPDATE configValue=configValue; +INSERT INTO appconfig (appid,configKey,configValue) VALUES ('user_ldap','ldap_user_display_name','cn') ON DUPLICATE KEY UPDATE configValue=configValue; +INSERT INTO appconfig (appid,configKey,configValue) VALUES ('user_ldap','ldap_group_filter','objectClass=mailboxRelatedObject') ON DUPLICATE KEY UPDATE configValue=configValue; +INSERT INTO appconfig (appid,configKey,configValue) VALUES ('user_ldap','ldap_group_member_assoc_attribute','memberUid') ON DUPLICATE KEY UPDATE configValue=configValue; +INSERT INTO appconfig (appid,configKey,configValue) VALUES ('user_ldap','ldap_host','127.0.0.1') ON DUPLICATE KEY UPDATE configValue=configValue; +INSERT INTO appconfig (appid,configKey,configValue) VALUES ('user_ldap','ldap_tls','0') ON DUPLICATE KEY UPDATE configValue=configValue; +INSERT INTO appconfig (appid,configKey,configValue) VALUES ('user_ldap','ldap_login_filter','uid=%uid') ON DUPLICATE KEY UPDATE configValue=configValue; +INSERT INTO appconfig (appid,configKey,configValue) VALUES ('user_ldap','user_ldaplist_filter','objectClass=sambaSamAccount') ON DUPLICATE KEY UPDATE configValue=configValue; +INSERT INTO appconfig (appid,configKey,configValue) VALUES ('user_ldap','ldap_uuid_attribute','entryuuid') ON DUPLICATE KEY UPDATE configValue=configValue; +INSERT INTO appconfig (appid,configKey,configValue) VALUES ('user_ldap','types','authentication') ON DUPLICATE KEY UPDATE configValue=configValue; + +ALTER TABLE appconfig DROP INDEX appid; + +UPDATE IGNORE group_user SET uid='admin' where uid='owncloud'; DELETE FROM users where uid='owncloud';