Skip to content

Commit

Permalink
Merge branch 'rtalur-hack-macos' into rtalur-custom-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
raghavendra-talur committed Aug 21, 2024
2 parents 92f83a0 + 1071b4f commit 1c5627b
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions hack/check-drenv-prereqs.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
#!/bin/bash
set -e

if ! groups "$USER" | grep -qw libvirt; then
echo "Error: User is not part of the libvirt group."
exit 1
os=$(uname -s)

if [[ "$os" == "Linux" ]]
then
if ! groups "$USER" | grep -qw libvirt; then
echo "Error: User is not part of the libvirt group."
exit 1
fi
fi

commands=("minikube" "kubectl" "clusteradm" "subctl" "velero" "helm" "virtctl"
"virt-host-validate" "kustomize" "mc")
"kustomize" "mc")

linux_only_commands=("virt-host-validate")

for cmd in "${commands[@]}"; do
if ! command -v "$cmd" &> /dev/null; then
Expand All @@ -16,9 +23,23 @@ for cmd in "${commands[@]}"; do
fi
done

if ! virt-host-validate qemu -q; then
echo "Error: 'virt-host-validate qemu' did not return 0."
exit 1

if [[ "$os" == "Linux" ]]
then
for cmd in "${linux_only_commands[@]}"; do
if ! command -v "$cmd" &> /dev/null; then
echo "Error: $cmd could not be found in PATH."
exit 1
fi
done
fi

if [[ "$os" == "Linux" ]]
then
if ! virt-host-validate qemu -q; then
echo "Error: 'virt-host-validate qemu' did not return 0."
exit 1
fi
fi

echo "All prerequisites met for drenv"

0 comments on commit 1c5627b

Please sign in to comment.