mirror of
https://github.com/kyleneideck/BackgroundMusic
synced 2024-11-10 14:44:14 +00:00
Fix race condition in build script. Also avoid 'sudo -v' on Travis CI.
This commit is contained in:
parent
3eac1f5dab
commit
480d769c26
1 changed files with 31 additions and 22 deletions
|
@ -253,6 +253,22 @@ check_xcode() {
|
||||||
exit ${RETURN}
|
exit ${RETURN}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Expects CHECK_XCODE_TASK_PID to be set.
|
||||||
|
handle_check_xcode_result() {
|
||||||
|
# Wait for the Xcode checks to finish.
|
||||||
|
set +e
|
||||||
|
trap - ERR
|
||||||
|
wait ${CHECK_XCODE_TASK_PID}
|
||||||
|
CHECK_XCODE_TASK_STATUS=$?
|
||||||
|
trap 'error_handler ${LINENO}' ERR
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# If there was a problem with Xcode/xcodebuild, print the error message and exit.
|
||||||
|
if [[ ${CHECK_XCODE_TASK_STATUS} -ne 0 ]]; then
|
||||||
|
handle_check_xcode_failure ${CHECK_XCODE_TASK_STATUS}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
handle_check_xcode_failure() {
|
handle_check_xcode_failure() {
|
||||||
# No command line tools
|
# No command line tools
|
||||||
if [[ $1 -eq 1 ]] || [[ $1 -eq 3 ]]; then
|
if [[ $1 -eq 1 ]] || [[ $1 -eq 3 ]]; then
|
||||||
|
@ -375,32 +391,25 @@ CHECK_XCODE_TASK_PID=$!
|
||||||
|
|
||||||
read -p "Continue (y/N)? " CONTINUE_INSTALLATION
|
read -p "Continue (y/N)? " CONTINUE_INSTALLATION
|
||||||
|
|
||||||
if is_alive ${CHECK_XCODE_TASK_PID}; then
|
if [[ "${CONTINUE_INSTALLATION}" != "y" ]] && [[ "${CONTINUE_INSTALLATION}" != "Y" ]]; then
|
||||||
if [[ "${CONTINUE_INSTALLATION}" != "y" ]] && [[ "${CONTINUE_INSTALLATION}" != "Y" ]]; then
|
echo "Installation cancelled."
|
||||||
echo "Installation cancelled."
|
exit 0
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Update the user's sudo timestamp. (Prompts the user for their password.)
|
|
||||||
if ! sudo -v; then
|
|
||||||
echo "ERROR: This script must be run by a user with administrator (sudo) privileges." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Wait for the Xcode checks to finish.
|
# If the check_xcode process has already finished, we can check the result early.
|
||||||
set +e
|
if ! is_alive ${CHECK_XCODE_TASK_PID}; then
|
||||||
trap - ERR
|
handle_check_xcode_result
|
||||||
wait ${CHECK_XCODE_TASK_PID}
|
|
||||||
CHECK_XCODE_TASK_STATUS=$?
|
|
||||||
trap 'error_handler ${LINENO}' ERR
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# If there was a problem with Xcode/xcodebuild, print the error message and exit.
|
|
||||||
if [[ ${CHECK_XCODE_TASK_STATUS} -ne 0 ]]; then
|
|
||||||
handle_check_xcode_failure ${CHECK_XCODE_TASK_STATUS}
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Update the user's sudo timestamp. (Prompts the user for their password.)
|
||||||
|
# Don't call sudo -v if this is a Travis CI build.
|
||||||
|
if ([[ -z ${TRAVIS:-} ]] || [[ "${TRAVIS}" != true ]]) && ! sudo -v; then
|
||||||
|
echo "ERROR: This script must be run by a user with administrator (sudo) privileges." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
handle_check_xcode_result
|
||||||
|
|
||||||
log_debug_info
|
log_debug_info
|
||||||
|
|
||||||
# BGMDriver
|
# BGMDriver
|
||||||
|
|
Loading…
Reference in a new issue