Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion download-launch-agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ fi
echo "Setting up CircleCI Runner directories"
sudo mkdir -p /var/opt/circleci /opt/circleci

# Find appropriate hash cmd
if hash shasum 2>/dev/null; then
echo "found shasum command"
alias SHACMD="shasum -a256"
elif hash sha256sum 2>/dev/null; then
echo "found sha256sum command"
alias SHACMD="sha256sum"
else
echo "shasum command not found"
exit 1
fi

# Downloading launch agent
echo "Using CircleCI Launch Agent version ${agent_version}"
echo "Downloading and verifying CircleCI Launch Agent Binary"
Expand All @@ -24,5 +36,5 @@ curl --compressed -L "${base_url}/${agent_version}/${file}" -o "${file}"

# Verifying download
echo "Verifying CircleCI Launch Agent download"
grep "${file}" checksums.txt | sha256sum --check && chmod +x "${file}"
grep "${file}" checksums.txt | SHACMD --check && chmod +x "${file}"
sudo cp "${file}" "/opt/circleci/circleci-launch-agent" || echo "Invalid checksum for CircleCI Launch Agent, please try download again"