From 2ddfe6f54d56c2a7bfbdb292c03814dab4da563a Mon Sep 17 00:00:00 2001 From: Nodeify Date: Tue, 5 Nov 2024 09:55:44 -0800 Subject: [PATCH] Update check-deps.sh --- scripts/check-deps.sh | 72 +++++++++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 20 deletions(-) diff --git a/scripts/check-deps.sh b/scripts/check-deps.sh index 00c51a8..fab998b 100755 --- a/scripts/check-deps.sh +++ b/scripts/check-deps.sh @@ -22,25 +22,56 @@ error() { check_command() { local cmd=$1 if ! command -v "$cmd" &> /dev/null; then - if [ "$cmd" = "talosctl" ]; then - echo "" - log "talosctl not found. Installation instructions:" - echo "" - echo "Please visit: https://www.talos.dev/v1.8/talos-guides/install/talosctl/" - echo "" - echo "Quick installation methods:" - echo "" - echo "1. Using curl (Linux/macOS):" - echo " curl -Lo /usr/local/bin/talosctl https://github.com/siderolabs/talos/releases/latest/download/talosctl-\$(uname -s | tr \"[:upper:]\" \"[:lower:]\")-amd64" - echo " chmod +x /usr/local/bin/talosctl" - echo "" - echo "2. Using Homebrew (macOS):" - echo " brew install siderlabs/talos/talosctl" - echo "" - error "$cmd is not installed and is required" - else - error "$cmd is not installed and is required" - fi + case "$cmd" in + "talosctl") + echo "" + log "talosctl not found. Installation instructions:" + echo "" + echo "Please visit: https://www.talos.dev/v1.8/talos-guides/install/talosctl/" + echo "" + echo "Quick installation methods:" + echo "" + echo "1. Using curl (Linux/macOS):" + echo " curl -Lo /usr/local/bin/talosctl https://github.com/siderolabs/talos/releases/latest/download/talosctl-\$(uname -s | tr \"[:upper:]\" \"[:lower:]\")-amd64" + echo " chmod +x /usr/local/bin/talosctl" + echo "" + echo "2. Using Homebrew (macOS):" + echo " brew install siderlabs/talos/talosctl" + ;; + "kubectl") + echo "" + log "kubectl not found. Installation instructions:" + echo "" + echo "Please visit: https://kubernetes.io/docs/tasks/tools/" + echo "" + echo "Quick installation methods:" + echo "" + echo "1. Using curl (Linux):" + echo " curl -LO \"https://dl.k8s.io/release/\$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl\"" + echo " chmod +x kubectl" + echo " sudo mv kubectl /usr/local/bin/" + echo "" + echo "2. Using Homebrew (macOS):" + echo " brew install kubectl" + echo "" + echo "3. Using package manager (Ubuntu/Debian):" + echo " sudo apt-get update && sudo apt-get install -y kubectl" + ;; + "yq") + echo "" + log "yq not found. Installation instructions:" + echo "" + echo "Quick installation methods:" + echo "" + echo "1. Using wget (Linux):" + echo " wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq" + echo " chmod +x /usr/local/bin/yq" + echo "" + echo "2. Using Homebrew (macOS):" + echo " brew install yq" + ;; + esac + error "$cmd is not installed and is required" else log "$cmd is installed ($(command -v "$cmd"))" fi @@ -55,8 +86,9 @@ main() { check_command git check_command yq check_command talosctl + check_command kubectl log "All dependencies are satisfied" } -main "$@" \ No newline at end of file +main "$@"