You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.4 KiB

2 years ago
2 years ago
  1. #!/bin/bash
  2. RCODE=$?
  3. echo "Importation des comptes :"
  4. PASSWORDS="passwords"
  5. ACCOUNT_DETAILS="account_details"
  6. USERS="accounts/users.txt"
  7. for i in `cat $USERS`
  8. do
  9. givenName=$(grep givenName: $ACCOUNT_DETAILS/$i.txt | cut -d ":" -f2)
  10. displayName=$(grep displayName: $ACCOUNT_DETAILS/$i.txt | cut -d ":" -f2)
  11. shadowpass=$(cat $PASSWORDS/$i.shadow)
  12. zmprov ca $i "TeMpPa55^()" cn "$givenName" displayName "$displayName" givenName "$givenName"
  13. zmprov ma $i userPassword "$shadowpass"
  14. done
  15. echo
  16. echo "Importation des listes de diffusion :"
  17. for lists in `cat distribution_lists/distribution_lists.txt`; do zmprov cdl $lists ; echo "$lists -- done " ; done
  18. cd distribution_lists
  19. for list in `cat distribution_lists.txt`
  20. do
  21. for mbmr in `grep -v '#' ./$list.txt | grep '@'`
  22. do
  23. zmprov adlm $list $mbmr
  24. echo " $mbmr has been added to $list"
  25. done
  26. done
  27. cd ..
  28. echo
  29. echo "Importation des aliases :"
  30. cd aliases
  31. for user in `cat ../accounts/users.txt`
  32. do
  33. echo $user
  34. if [ -f "./$user.txt" ]; then
  35. for alias in `grep '@' ./$user.txt`
  36. do
  37. zmprov aaa $user $alias
  38. echo "$user ALIAS $alias - Restored"
  39. done
  40. fi
  41. done
  42. cd ..
  43. echo
  44. if [ $RCODE -eq 1 ]; then
  45. echo "erreur dans l'import'"
  46. exit 1;
  47. fi
  48. if [ $RCODE -eq 0 ]; then
  49. echo "Import terminée !!!!"
  50. echo "Passez à l'export des data sur serveur source"
  51. exit;
  52. fi