zaraf2kopano ldap-script
-
Hi!
I used your script (look below) from https://documentation.kopano.io/kopano_migration_manual/zcp_migration.html and everything works fine!
The only problem is, that the selection hook (kopanAccount=1) ist NOT checkt like zarafaAccount=1.
That doesn’t matter for 10 Users but for 500… Just a little irritating!!Regards
Rainer#!/bin/bash LDAP_HOST="localhost" LDAP_USER="cn=root,dc=kopano,dc=com" LDAP_PASSWORD="ThisIsMySecretPassword" LDAP_LDIF="/tmp/zarafa2kopano.ldif" grep ^attributetype /usr/share/doc/packages/zarafa/zarafa.schema -A1 | grep NAME | sed -e 's#.*NAME..##g' -e 's#.$##' | while read line; do new_attrib="`echo $line | sed 's#zarafa#kopano#'`" ldapsearch -o ldif-wrap=no -LLL -x $line=* dn $line | sed "s#$line: \(.*\)#changetype: modify\nadd: $new_attrib\n$new_attrib: \1\n-\ndelete: $line\n$line: \1\n-#" >> "$LDAP_LDIF".step2_attribute_data done # We now have the LDIF, we now need to extend the objects with the new objectClass. grep ^dn "$LDAP_LDIF".step2_attribute_data | sort | uniq | sed 's#dn: ##' | while read dn; do ldapsearch -o ldif-wrap=no -LLL -x -s base -b "$dn" objectclass | egrep '(^dn|zarafa)' | sed -e '/^objectClass/ s#zarafa#kopano#' | sed 's#objectClass:\(.*\)#changetype: modify\nadd: objectClass\nobjectClass:\1\n#'; done >> "$LDAP_LDIF".step1_objectclass_extend ldapmodify -h "$LDAP_HOST" -D "$LDAP_USER" -w "$LDAP_PASSWORD" -f "$LDAP_LDIF".step1_objectclass_extend # We are done with the LDIF, now lets do it. ldapmodify -h "$LDAP_HOST" -D "$LDAP_USER" -w "$LDAP_PASSWORD" -f "$LDAP_LDIF".step2_attribute_data grep ^dn "$LDAP_LDIF".step2_attribute_data | sort | uniq | sed 's#dn: ##' | while read dn; do ldapsearch -o ldif-wrap=no -LLL -x -s base -b "$dn" objectclass | egrep '(^dn|zarafa)' | sed 's#objectClass:\(.*\)#changetype: modify\ndelete: objectClass\nobjectClass:\1\n#'; done >> "$LDAP_LDIF".step3_objectclass_remove ldapmodify -h "$LDAP_HOST" -D "$LDAP_USER" -w "$LDAP_PASSWORD" -f "$LDAP_LDIF".step3_objectclass_remove # Clean up rm -f "$LDAP_LDIF.step1_objectclass_extend" rm -f "$LDAP_LDIF.step2_attribute_data" rm -f "$LDAP_LDIF.step3_objectclass_remove"
-
Hi @rseir,
as far as I can see the script you posted is identical to the one in the wiki. What is your question exactly?
-
After running the script (of course adapted) everything but the Checkbox for kopanoAccount=1 Attribute was ok!
So you have to edit each user to klick the selection hook!
Not funny with 100 and more accounts!Regards Rainer
-
@rseir said in zaraf2kopano ldap-script:
So you have to edit each user to klick the selection hook
What is a “selection hook”?
@rseir said in zaraf2kopano ldap-script:
everything but the Checkbox for kopanoAccount=1 Attribute was ok
then what did it show?
The beauty of a bash script such as the one above is that you can easily dissect what it does. For example when removing the last three
rm
commands you can see which ldap files he was importing. so you could for example comment all theldapmodify
commands, have a look at the generated ldif files. fix whatever you think is necessary in them (this can then for example also be done withsed
& co) and the run theldapmodify
commands separately.No need edit account manually after import (and no need for exclamation marks after each sentence).
-
The Checkbox was empty!
Everything else worked fine! -
@rseir said in zaraf2kopano ldap-script:
The Checkbox was empty
kopanoAccount=1
is not really a checkbox, it’s a simplevariable=value
paring. In your source data this should have beenzarafaAccount=1
.I still do not understand what your question/intent is.
-
I think, Rainer means the checkbox is unchecked. “Die Checkbox ist nicht abgehakt”
-
Yes! Indeed!
Variable, checkbox or whatever!
Seems to be excluded from migration…