Skip to content

Commit ef9c5c1

Browse files
committed
allow script to be run from any directory
1 parent c4025bc commit ef9c5c1

File tree

1 file changed

+5
-11
lines changed
  • code-samples/eventing/bookstore-sample-app/start

1 file changed

+5
-11
lines changed

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

Lines changed: 5 additions & 11 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
@@ -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)