Skip to content

Commit c04e50d

Browse files
authored
fix broken links + allow script to be run in any directory (#6222)
* fix broken link * allow script to be run from any directory
1 parent 64fc93b commit c04e50d

File tree

1 file changed

+6
-12
lines changed
  • code-samples/eventing/bookstore-sample-app/start

1 file changed

+6
-12
lines changed

code-samples/eventing/bookstore-sample-app/start/setup.sh

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
2+
3+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
24

35
# Prompt the user to start the installation process
46
echo "🚀 Shortcut: This script will install Knative, and deploy the bookstore's frontend and backend on your cluster"
57

6-
# Validate that the user is in the correct directory /start
7-
if [ "${PWD##*/}" != "start" ]; then
8-
echo "⚠️ Please run this script in the /start directory. Exiting..."
9-
exit
10-
fi
11-
echo "✅ You are in the correct directory: /start"
128
read -p "🛑 Press ENTER to continue or Ctrl+C to abort..."
139

1410
# Install Knative Serving
@@ -40,7 +36,7 @@ echo "✅ Knative In-Memory Channel and Broker installed successfully."
4036
if ! command -v func &> /dev/null
4137
then
4238
echo ""
43-
echo "⚠️ Knative CLI 'func' not found. Please install the Knative CLI by following the instructions at https://knative.dev/docs/admin/install/kn-cli/."
39+
echo "⚠️ Knative CLI 'func' not found. Please install the Knative CLI by following the instructions at https://knative.dev/docs/functions/install-func"
4440
exit
4541
fi
4642

@@ -57,8 +53,7 @@ echo "📚 Installing the Sample Bookstore Frontend"
5753
read -p "🛑 Press ENTER to continue..."
5854

5955
# Install the front end first
60-
cd frontend
61-
kubectl apply -f config
56+
kubectl apply -f "${SCRIPT_DIR}/frontend/config"
6257

6358
# Wait for the frontend to be ready
6459
echo ""
@@ -76,8 +71,7 @@ echo ""
7671
echo "📚 Installing the Sample Bookstore Backend (node-server)"
7772

7873
# Install the node-server
79-
cd ../node-server
80-
kubectl apply -f config/100-deployment.yaml
74+
kubectl apply -f "${SCRIPT_DIR}/node-server/config/100-deployment.yaml"
8175

8276
# Wait for the backend to be ready
8377
echo ""

0 commit comments

Comments
 (0)