deploy.sh 1018 B

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