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.

28 lines
777 B

  1. #!/bin/bash
  2. set -e
  3. OPTS=(
  4. host
  5. port
  6. connection-security
  7. auth-method
  8. )
  9. for var in "${OPTS[@]}"; do
  10. value=$(options-get "$var") && relation-set "$var" "$value" || exit 1
  11. case "$var:$value" in
  12. auth-method:password)
  13. login=$(options-get "login") || {
  14. err "${WHITE}login${NORMAL} value is required when ${WHITE}auth-method${NORMAL} is set to \"password\""
  15. exit 1
  16. }
  17. password=$(options-get "password") || {
  18. err "${WHITE}password${NORMAL} value is required when ${WHITE}auth-method${NORMAL} is set to \"password\""
  19. exit 1
  20. }
  21. relation-set login "$login"
  22. relation-set password "$password"
  23. ;;
  24. esac
  25. done