Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
Fixes bug with deployment script because readlink -f is not available…
Browse files Browse the repository at this point in the history
… on macOS.

PiperOrigin-RevId: 214482814
  • Loading branch information
waltermeyer authored and Copybara Service committed Sep 25, 2018
1 parent 4b6be70 commit f48fe1c
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions loaner/deployments/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,30 @@ auth login"
function goto_loaner_dir() {
info_message "Going to the loaner directory..."
# Resolve current directory of the script and any symbolic links
DEPLOY_PATH="$(dirname "$(readlink -f "${0}")")"
# cd to the 'loaner/loaner/' directory.
cd "${DEPLOY_PATH}" && cd ..
if [[ "${PLATFORM}" == "${_MAC}" ]]; then
local pwd=$(pwd -P)
case "${pwd}" in
*/loaner/loaner)
;;
*/loaner/loaner/*)
cd "${pwd%%/loaner/loaner/*}/loaner/loaner"
;;
*/loaner)
cd "${pwd%%/loaner/*}/loaner"
;;
*/loaner/*)
cd "${pwd%%/loaner/*}/loaner"
;;
*)
error_message "This script must be run within the loaner directory."
;;
esac
else
DEPLOY_PATH="$(dirname "$(readlink -f "${0}")")"
# cd to the 'loaner/loaner/' directory.
cd "${DEPLOY_PATH}" && cd ..
fi


# Make sure we are in the loaner directory.
if [[ ${PWD##*/} != "loaner" ]]; then
Expand Down

0 comments on commit f48fe1c

Please sign in to comment.