deploy.sh 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #! /bin/bash
  2. set -euo
  3. hostTerm=$1
  4. company=$2
  5. username=$3
  6. password=$4
  7. target="$5.zip"
  8. title=$6
  9. auth="$company.$username:$password"
  10. hostPreFix="http://"
  11. host=""
  12. dfs="/app/matrix/$5"
  13. # AppStore
  14. fileName="/matrix/m3appstore/appStoreAuto.js"
  15. fileForm="input={\"action\": \"c\",\"param\":{ \"name\": \"$target\", \"title\": \"$title\", \"version\": \"v0.5\", \"author\": \"wecise\", \"dfs\": \"$dfs\" }}"
  16. if [[ $hostTerm =~ $hostPreFix ]]
  17. then
  18. host=$hostTerm
  19. else
  20. host="http://$hostTerm"
  21. fi
  22. echo
  23. echo '应用发布开始**********************************************************************'
  24. echo
  25. echo '发布地址:'${host}
  26. echo
  27. echo '发布租户:'${company}
  28. echo
  29. curl --location -u "${auth}" -X POST "$host/fs/import?depth=3&issys=true" --form "uploadfile=@${target}" | python -m json.tool
  30. curl -u "${auth}" -X POST "$host/script/exec/js?filepath=${fileName}" -F "${fileForm}" -F "isfile=true" | python -m json.tool
  31. echo
  32. rm -rf ${target}
  33. echo '应用发布结束**********************************************************************';