44 lines
891 B

  1. #!/bin/bash
  2. ## Load action gets a first argument a FILE/DIRECTORY/URL holding the necessary files.
  3. ##
  4. ##
  5. if [ -z "$SERVICE_DATASTORE" ]; then
  6. echo "This script is meant to be run through 'compose' to work properly." >&2
  7. exit 1
  8. fi
  9. usage="$exname [-h|--help] SOURCE"
  10. while [ "$1" ]; do
  11. case "$1" in
  12. "--help"|"-h")
  13. print_usage
  14. exit 0
  15. ;;
  16. *)
  17. [ -z "$SOURCE" ] && { SOURCE=$1 ; shift ; continue ; }
  18. err "Unexpected argument '$1'."
  19. exit 1
  20. ;;
  21. esac
  22. shift
  23. done
  24. if [ -z "$SOURCE" ]; then
  25. err "You must provide a source file as first argument."
  26. print_usage
  27. exit 1
  28. fi
  29. include parse
  30. include pretty
  31. set -e
  32. DOMAIN=$(relation-get domain)
  33. run_service_action "$RELATION_TARGET_SERVICE" load "$SOURCE" "$DOMAIN" "$@"
  34. info "Correctly deployed '$SOURCE' towards domain '$DOMAIN'"