Commits

Zhang Huangbin committed 18bcb9b

Fix incorrect value of storageBaseDirectory in tools/create_mail_user_*.

Comments (0)

Files changed (2)

iRedMail/tools/create_mail_user_MySQL.sh

 # Time stamp, will be appended in maildir.
 DATE="$(date +%Y.%m.%d.%H.%M.%S)"
 
+STORAGE_BASE="$(dirname ${STORAGE_BASE_DIRECTORY})"
+STORAGE_NODE="$(basename ${STORAGE_BASE_DIRECTORY})"
+
 # Path to SQL template file.
 SQL="output.sql"
 echo '' > ${SQL}
 
         cat >> ${SQL} <<EOF
 INSERT INTO mailbox (username, password, name, storagebasedirectory,storagenode, maildir, quota, domain, active, local_part, created)
-    VALUES ('${mail}', '${CRYPT_PASSWD}', '${username}', '${STORAGE_BASE_DIRECTORY}','${STORAGE_NODE}', '${maildir}', '${DEFAULT_QUOTA}', '${DOMAIN}', '1','${username}', NOW());
+    VALUES ('${mail}', '${CRYPT_PASSWD}', '${username}', '${STORAGE_BASE}','${STORAGE_NODE}', '${maildir}', '${DEFAULT_QUOTA}', '${DOMAIN}', '1','${username}', NOW());
 INSERT INTO alias (address, goto, domain, created, active) VALUES ('${mail}', '${mail}','${DOMAIN}', NOW(), 1);
 EOF
     done

iRedMail/tools/create_mail_user_OpenLDAP.sh

 # Time stamp, will be appended in maildir.
 DATE="$(date +%Y.%m.%d.%H.%M.%S)"
 
-STORAGE_NODE="$(echo ${STORAGE_BASE_DIRECTORY} | tr '/' ' ' | awk '{print $NF}')"
+STORAGE_BASE="$(dirname ${STORAGE_BASE_DIRECTORY})"
+STORAGE_NODE="$(basename ${STORAGE_BASE_DIRECTORY})"
 
 add_new_domain()
 {
 objectClass: amavisAccount
 objectClass: mailUser
 objectClass: top
-storageBaseDirectory: ${STORAGE_BASE_DIRECTORY}
+accountStatus: active
+storageBaseDirectory: ${STORAGE_BASE}
 homeDirectory: ${STORAGE_BASE_DIRECTORY}/${maildir}
-accountStatus: active
 mailMessageStore: ${STORAGE_NODE}/${maildir}
 mail: ${MAIL}
 mailQuota: ${QUOTA}