Скрипт bash, который у меня есть, используется для передачи приложений в приложение Hockey для отправки его тестировщикам.У меня возникла проблема с этим кодом сценария bash:
#!/bin/bash
# locations of various tools
CURL=curl
SERVER_ENDPOINT=https://rink.hockeyapp.net/api/2/
# Put your HockeyApp APP_TOKEN here. Find it in your HockeyApp account settings.
APP_TOKEN=0343e6b12808457581147d56fb5ad4bd
# ipa required, "file data of the .ipa for iOS, .app.zip for OS X, or .apk file for Android
IPA=$2
# dsym optional,file data of the .dSYM.zip file (iOS and OS X) or mapping.txt (Android);
# note that the extension has to be .dsym.zip (caseinsensitive) for iOS and OS X and the file nam
DSYM=""
# notes optional, release notes as Textile or Markdown (after 5k characters note are truncated)
NOTES=$3
# echo $NOTES
# notes_type optional, ntype of release notes:
# 0 for Textile
# 1 for Markdown
NOTES_TYPE=""
# optional, notify testers (can only be set with fullaccess tokens):
# 0 to not notify testers
# 1 to notify all testers that can install this app
# 2 Notify all testers
NOTIFY=$4
echo $NOTIFY
# status optional, download status (can only be set with fullaccess tokens):
# 1 to not allow users to download the version
# 2 to make the version available for download
STATUS="2"
# strategy optional, replace or add build with same build number
# add to add the build as a new build to even if it has the same build number (default)
# replace to replace to a build with the same build number
STRATEGY="replace"
# tags optional, restrict download to commaseparated list of tags
TAGS=""
# teams optional, restrict download to commaseparated list of team IDs; example:
# 12,23,42 with 12, 23, and 42 being the database IDs of your teams
TEAMS=""
# users optional, restrict download to commaseparated list of user IDs; example:
# 1224,5678 with 1224 and 5678 being the database IDs of your users
USERS=""
# mandatory optional, set version as mandatory:
# 0 for not mandatory
# 1 for mandatory
MANDATORY=""
# release_type optional, set the release type of the app:
# 2 for alpha
# 0 for beta [default]
# 1 for store
# 3 for enterprise
RELEASE_TYPE=""
# private optional, set to true to enable the private download page (default is true)
PRIVATE=""
# owner_id optional, set to the ID of your organization
OWNER_ID=""
# commit_sha optional, set to the git commit sha for this build
COMMIT_SHA=""
# build_server_url optional, set to the URL of the build job on your build server
BUILD_SERVER_URL=""
# repository_url optional, set to your source repository
REPOSITORY_URL=""
usage() {
echo "Usage: hockeyappuploader.sh IPA"
echo
}
verify_tools() {
# Windows users: this script requires curl. If not installed please get from http://cygwin
# Check 'curl' tool
"${CURL}" help
>/dev/null
if [ $? ne 0 ]; then
echo "Could not run curl tool, please check settings"
exit 1
fi
}
verify_settings() {
if [ z "${APP_TOKEN}" ]; then
usage
echo "Please update APP_TOKEN with your private API key, as noted in the Settings"
exit 1
fi
}
# if [ $# ne 1 ];then
# usage
# exit 1
# fi
# before even going on, make sure all tools work
verify_tools
verify_settings
if [ ! f "${IPA}" ]; then
usage
echo "Can't find file: ${IPA}"
exit 2
fi
/bin/echo n "Uploading ${IPA} to HockeyApp.. "
JSON=$( "${CURL}" \s
${SERVER_ENDPOINT}/apps/upload \H
"XHockeyAppToken: ${APP_TOKEN}" \F
"ipa=@${IPA}" \F
"dsym=@${DSYM}" \F
"notes=${NOTES}" \F
"notes_type=${NOTES_TYPE}" \F
"notify=${NOTIFY}" \F
"status=${STATUS}" \F
"strategy=${STRATEGY}" \F
"tags=${TAGS}" \F
"teams=${TEAMS}" \F
"users=${USERS}" \F
"mandatory=${MANDATORY}" \F
"release_type=${RELEASE_TYPE}" \F
"private=${PRIVATE}" \F
"owner_id=${OWNER_ID}" \F
"commit_sha=${COMMIT_SHA}" \F
"build_server_url=${BUILD_SERVER_URL}" \F
"repository_url=${REPOSITORY_URL}" \)
URL=$( echo ${JSON} | sed 's/\\\//\//g' | sed n 's/.*"public_url"\s*:\s*"\([^"]*\)".*/\1/p' )
if [ z "$URL" ]; then
echo "FAILED!"
echo
echo "Build uploaded, but no reply from server! Please contact support."
exit 1
fi
echo "OK!"
echo
echo "Build was successfully uploaded to HockeyApp and is available at:"
echo ${URL}
Получение следующих ошибок:
curl: (6) Could not resolve host: H
curl: (3) Port number ended with 'e'
curl: (6) Could not resolve host: F
curl: (3) Illegal characters found in URL
curl: (6) Could not resolve host: F
curl: (7) Failed to connect to port 80: Connection refused
curl: (6) Could not resolve host: F
curl: (6) Could not resolve host: notes=2
curl: (6) Could not resolve host: F
curl: (6) Could not resolve host: notes_type=0
curl: (6) Could not resolve host: F
curl: (6) Could not resolve host: notify=
curl: (6) Could not resolve host: F
curl: (6) Could not resolve host: status=2
curl: (6) Could not resolve host: F
curl: (6) Could not resolve host: strategy=replace
curl: (6) Could not resolve host: F
curl: (6) Could not resolve host: tags=
curl: (6) Could not resolve host: F
curl: (6) Could not resolve host: teams=
curl: (6) Could not resolve host: F
curl: (6) Could not resolve host: users=
curl: (6) Could not resolve host: F
curl: (6) Could not resolve host: mandatory=
curl: (6) Could not resolve host: F
curl: (6) Could not resolve host: release_type=
curl: (6) Could not resolve host: F
curl: (6) Could not resolve host: private=
curl: (6) Could not resolve host: F
curl: (6) Could not resolve host: owner_id=
curl: (6) Could not resolve host: F
curl: (6) Could not resolve host: commit_sha=
curl: (6) Could not resolve host: F
curl: (6) Could not resolve host: build_server_url=
curl: (6) Could not resolve host: F
curl: (6) Could not resolve host: repository_url=
curl: (6) Could not resolve host:
sed: s/.*"public_url"\s*:\s*"\([^"]*\)".*/\1/p: No such file or directory
curl: (6) Could not resolve host: help
./UploadFile.sh: line 71: [: ne: binary operator expected
./UploadFile.sh: line 76: [: z: unary operator expected
./UploadFile.sh: line 89: [: f: unary operator expected
./UploadFile.sh: line 97: [: z: unary operator expected
Следующие ошибки могут быть вызваны этими строками кода:
curl: (6) Не удалось разрешить хост: help:
"${CURL}" help
>/dev/null
строка 71:
if [ $? ne 0 ]; then
строка 76:
if [ z "${APP_TOKEN}" ]; then
строка89:
if [ ! f "${IPA}" ]; then
строка 97:
${SERVER_ENDPOINT}/apps/upload \H
Любая помощь будет принята с благодарностью.