|
@@ -9,40 +9,26 @@ form_dir="$1"
|
|
|
|
|
|
SCRIPTDIR=$(readlink -f "${BASH_SOURCE[0]%/*}")
|
|
|
|
|
|
-declare -a contacts
|
|
|
-update_members(){
|
|
|
- name="${contacts[$1-1]}"
|
|
|
- email="${2}"
|
|
|
- MEMBERS["$email"]="${name}"
|
|
|
-}
|
|
|
+cd "${WD}"
|
|
|
+
|
|
|
+awk -F ":" -- \
|
|
|
+ '/Name:/ { print substr($2,2) } /Email:/ { print substr($2,2) }' \
|
|
|
+ $(find ${form_dir} -type f -name "*.txt") \
|
|
|
+> signup
|
|
|
+
|
|
|
update_signup(){
|
|
|
- name="${contacts[$1-1]}"
|
|
|
- email="${2}"
|
|
|
- for key in "${!MEMBERS[@]}"; do
|
|
|
- [ "${key}" == "${email}" ] && return
|
|
|
- done
|
|
|
- SIGNUP["$email"]="${name}"
|
|
|
+ name="${signup[$1-1]}"
|
|
|
+ email="${2}"
|
|
|
+ SIGNUP["$email"]="${name}"
|
|
|
}
|
|
|
-for group in cropswap cropswap-members; do
|
|
|
- declare -A MEMBERS=()
|
|
|
- # Define an array of contacts (name and email pairs)
|
|
|
- #
|
|
|
- # Reads files in $form_dir with structure like
|
|
|
- #
|
|
|
- # Name: Som E. Name
|
|
|
- # Email: address@example.com
|
|
|
- mapfile -t -c 2 -C update_members contacts < <("${SCRIPTDIR}/gdbm-iter.py" "/var/mail/maildrop/${group}@shandan.one/mlist")
|
|
|
- unset contacts
|
|
|
|
|
|
+for group in cropswap{,-members}; do
|
|
|
declare -A SIGNUP=()
|
|
|
- mapfile -t -c 2 -C update_signup contacts < <(find ${form_dir} -type f -name "*.txt" -exec awk -F ":" '
|
|
|
-/Name:/ { print substr($2,2) }
|
|
|
-/Email:/ { print substr($2,2) }
|
|
|
-' {} \;)
|
|
|
+ mapfile -t -c 2 -C update_signup signup < <("${SCRIPTDIR}/cropswap-register-new.py" "${group}@shandan.one" < signup)
|
|
|
|
|
|
for email in "${!SIGNUP[@]}"; do
|
|
|
set -x
|
|
|
- "${SCRIPTDIR}/cropswap-register.sh" "${group}@shandan.one" "${SIGNUP["$email"]}" "$email" NONE
|
|
|
+ "${SCRIPTDIR}/cropswap-register.sh" "${group}@shandan.one" "${signup["$email"]}" "$email" NONE
|
|
|
set +x
|
|
|
done
|
|
|
done
|