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

master
root 2 years ago
parent ce3251d183
commit 036bf197cf
  1. 20
      kopano/active_imap.sh
  2. 36
      kopano/create_mailbox.sh

@ -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

@ -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

Loading…
Cancel
Save