fix broken links + allow script to be run in any directory (#6222)

* fix broken link

* allow script to be run from any directory
This commit is contained in:
Dave Protasowski 2025-02-12 12:24:51 -05:00 committed by GitHub
parent 64fc93b049
commit c04e50d907
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 12 deletions

View File

@ -1,14 +1,10 @@
#!/bin/bash #!/usr/bin/env bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# Prompt the user to start the installation process # Prompt the user to start the installation process
echo "🚀 Shortcut: This script will install Knative, and deploy the bookstore's frontend and backend on your cluster" echo "🚀 Shortcut: This script will install Knative, and deploy the bookstore's frontend and backend on your cluster"
# Validate that the user is in the correct directory /start
if [ "${PWD##*/}" != "start" ]; then
echo "⚠️ Please run this script in the /start directory. Exiting..."
exit
fi
echo "✅ You are in the correct directory: /start"
read -p "🛑 Press ENTER to continue or Ctrl+C to abort..." read -p "🛑 Press ENTER to continue or Ctrl+C to abort..."
# Install Knative Serving # Install Knative Serving
@ -40,7 +36,7 @@ echo "✅ Knative In-Memory Channel and Broker installed successfully."
if ! command -v func &> /dev/null if ! command -v func &> /dev/null
then then
echo "" echo ""
echo "⚠️ Knative CLI 'func' not found. Please install the Knative CLI by following the instructions at https://knative.dev/docs/admin/install/kn-cli/." echo "⚠️ Knative CLI 'func' not found. Please install the Knative CLI by following the instructions at https://knative.dev/docs/functions/install-func"
exit exit
fi fi
@ -57,8 +53,7 @@ echo "📚 Installing the Sample Bookstore Frontend"
read -p "🛑 Press ENTER to continue..." read -p "🛑 Press ENTER to continue..."
# Install the front end first # Install the front end first
cd frontend kubectl apply -f "${SCRIPT_DIR}/frontend/config"
kubectl apply -f config
# Wait for the frontend to be ready # Wait for the frontend to be ready
echo "" echo ""
@ -76,8 +71,7 @@ echo ""
echo "📚 Installing the Sample Bookstore Backend (node-server)" echo "📚 Installing the Sample Bookstore Backend (node-server)"
# Install the node-server # Install the node-server
cd ../node-server kubectl apply -f "${SCRIPT_DIR}/node-server/config/100-deployment.yaml"
kubectl apply -f config/100-deployment.yaml
# Wait for the backend to be ready # Wait for the backend to be ready
echo "" echo ""