Skip to content

Commit 81d149c

Browse files
authored
Add check for existing CF CLI installation
Added a check to see if CF CLI is already installed in PATH before attempting to install it.
1 parent a9d0b6a commit 81d149c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scripts/.util/tools.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,17 @@ function util::tools::cf::install() {
148148
exit 1
149149
esac
150150

151+
# Check if cf is already available in PATH (e.g., from system/Docker image)
152+
if command -v cf &> /dev/null; then
153+
util::print::title "CF CLI already installed (using system version)"
154+
cf version
155+
return 0
156+
fi
157+
151158
if [[ ! -f "${dir}/cf" ]]; then
152159
util::print::title "Installing cf"
153160

154-
curl "https://packages.cloudfoundry.org/stable?release=${os}-binary&version=6.49.0&source=github-rel" \
161+
curl "https://packages.cloudfoundry.org/stable?release=${os}-binary&source=github-rel" \
155162
--silent \
156163
--location \
157164
--output /tmp/cf.tar.gz

0 commit comments

Comments
 (0)