Remplacement de kopano-cli par kopano-admin car kopano-cli est abandonné

This commit is contained in:
root 2020-07-16 22:13:11 +02:00
parent ce3251d183
commit 036bf197cf
2 changed files with 28 additions and 28 deletions

View File

@ -1,24 +1,24 @@
#!/bin/bash
CSV_FILE="$1"
if [ -z "$CSV_FILE" ] ; then
if [ -z "${CSV_FILE}" ] ; then
echo No CSV file supplied... Exiting
exit 1
fi
cat $CSV_FILE | grep -v '^#' | while read line ; do
MAIL=`echo $line | awk -F';' '{ print $1 }'`
USERNAME="$MAIL"
cat ${CSV_FILE} | grep -v '^#' | while read line ; do
MAIL=`echo ${line} | awk -F';' '{ print $1 }'`
USERNAME="${MAIL}"
if kopano-cli --user=$USERNAME > /dev/null 2>&1 ; then
if kopano-cli --user=$USERNAME | awk '/^Features/' | grep imap > /dev/null 2>&1 ; then
echo imap already activated for $USERNAME
if kopano-admin --details ${USERNAME} > /dev/null 2>&1 ; then
if kopano-admin --details ${USERNAME} | awk '/PR_EC_ENABLED_FEATURES/' | grep imap > /dev/null 2>&1 ; then
echo imap already activated for ${USERNAME}
else
echo Activating imap for $USERNAME
/usr/sbin/kopano-cli --user $USERNAME --add-feature imap
echo Activating imap for ${USERNAME}
/usr/sbin/kopano-admin -u ${USERNAME} --enable-feature imap
fi
else
echo $USERNAME does not exist
echo ${USERNAME} does not exist
fi
done

View File

@ -1,33 +1,33 @@
#!/bin/bash
CSV_FILE="$1"
if [ -z "$CSV_FILE" ] ; then
if [ -z "${CSV_FILE}" ] ; then
echo No CSV file supplied... Exiting
exit 1
fi
cat $CSV_FILE | grep -v '^#' | while read line ; do
MAIL=`echo $line | awk -F';' '{ print $1 }'`
USERNAME="$MAIL"
PASSWORD=`echo $line | awk -F';' '{ print $3 }'`
FULL_NAME=`echo $line | awk -F';' '{ print $2 }'`
cat ${CSV_FILE} | grep -v '^#' | while read line ; do
MAIL=`echo ${line} | awk -F';' '{ print $1 }'`
USERNAME="${MAIL}"
PASSWORD=`echo ${line} | awk -F';' '{ print $3 }'`
FULL_NAME=`echo ${line} | awk -F';' '{ print $2 }'`
if kopano-cli --user=$USERNAME > /dev/null 2>&1 ; then
echo $USERNAME already exist
if kopano-admin --details ${USERNAME} > /dev/null 2>&1 ; then
echo ${USERNAME} already exist
else
TEMP_SH=`mktemp /tmp/create_mailbox.XXXX`
cat > $TEMP_SH << EOF
cat > ${TEMP_SH} << EOF
#!/bin/sh
echo creating $USERNAME
/usr/sbin/kopano-cli --create \
--user '$USERNAME' \
--password '$PASSWORD' \
--email '$MAIL' \
--fullname '$FULL_NAME' \
--admin-level 0 \
--lang '$LANG'
echo creating ${USERNAME}
/usr/sbin/kopano-admin \
-c '${USERNAME}' \
-p '${PASSWORD}' \
-e '${MAIL}' \
-f '${FULL_NAME}' \
-a no \
--lang '${LANG}'
EOF
sh $TEMP_SH && rm $TEMP_SH
sh ${TEMP_SH} && rm ${TEMP_SH}
fi
done