Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: bash version checks vary between 3+ or 5+
  • Loading branch information
lloydchang committed Dec 2, 2024
commit 9deab2281507716c640019a56c05bc721885734f
14 changes: 8 additions & 6 deletions scripts/codespaces_create_and_start_containers.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
#!/bin/bash

# Check Bash version (adjust version as needed)
if [[ ! $(bash --version | head -n1 | awk '{print $3}' | cut -d'.' -f1-2) =~ ^5\. ]]; then
echo "Error: Requires Bash version 5 or higher." >&2
exit 1
fi

# Purpose: In GitHub Codespaces, automates the setup of Docker containers,
# preparation of Ansible inventory, and modification of tasks for testing.
# Usage: ./scripts/codespaces_create_and_start_containers.sh
Expand All @@ -16,6 +10,14 @@ set -u # Treat unset variables as an error and exit immediately
set -o pipefail # Return the exit status of the last command in a pipeline that failed
set -x # Print each command before executing it (useful for debugging)

cd $(dirname $0)

# Check Bash version (adjust version as needed)
if [[ ! $(bash --version | head -n1 | awk '{print $4}' | cut -d'.' -f1-2) =~ ^5\. ]]; then
echo "Error: Requires Bash version 5 or higher." >&2
exit 1
fi

# Step 1: Initialization

if [ ! -f hosts.ini ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
#!/bin/bash

# Check Bash version (adjust version as needed)
if [[ ! $(bash --version | head -n1 | awk '{print $3}' | cut -d'.' -f1-2) =~ ^5\. ]]; then
echo "Error: Requires Bash version 5 or higher." >&2
exit 1
fi

# Purpose: In GitHub Codespaces, start hackingBuddyGPT against a container
# Usage: ./scripts/codespaces_start_hackingbuddygpt_against_a_container.sh

Expand All @@ -15,6 +9,14 @@ set -u # Treat unset variables as an error and exit immediately
set -o pipefail # Return the exit status of the last command in a pipeline that failed
set -x # Print each command before executing it (useful for debugging)

cd $(dirname $0)

# Check Bash version (adjust version as needed)
if [[ ! $(bash --version | head -n1 | awk '{print $4}' | cut -d'.' -f1-2) =~ ^5\. ]]; then
echo "Error: Requires Bash version 5 or higher." >&2
exit 1
fi

# Step 1: Install prerequisites

# setup virtual python environment
Expand Down
16 changes: 9 additions & 7 deletions scripts/mac_create_and_start_containers.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
#!/opt/homebrew/bin/bash

# Enable strict error handling
set -e
set -u
set -o pipefail
set -x

cd $(dirname $0)

# Check Bash version (adjust version as needed)
if [[ ! $(/opt/homebrew/bin/bash --version | head -n1 | awk '{print $3}' | cut -d'.' -f1-2) =~ ^5\. ]]; then
if [[ ! $(/opt/homebrew/bin/bash --version | head -n1 | awk '{print $4}' | cut -d'.' -f1-2) =~ ^5\. ]]; then
echo "Error: Requires Bash version 5 or higher." >&2
exit 1
fi

# Purpose: Automates the setup of docker containers for local testing on Mac.
# Usage: ./scripts/mac_create_and_start_containers.sh

# Enable strict error handling
set -e
set -u
set -o pipefail
set -x

# Step 1: Initialization

if [ ! -f hosts.ini ]; then
Expand Down
14 changes: 8 additions & 6 deletions scripts/mac_start_hackingbuddygpt_against_a_container.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
#!/bin/bash

# Check Bash version (adjust version as needed)
if [[ ! $(bash --version | head -n1 | awk '{print $3}' | cut -d'.' -f1-2) =~ ^3\. ]]; then
echo "Error: Requires Bash version 3 or higher." >&2
exit 1
fi

# Purpose: On a Mac, start hackingBuddyGPT against a container
# Usage: ./scripts/mac_start_hackingbuddygpt_against_a_container.sh

Expand All @@ -15,6 +9,14 @@ set -u # Treat unset variables as an error and exit immediately
set -o pipefail # Return the exit status of the last command in a pipeline that failed
set -x # Print each command before executing it (useful for debugging)

cd $(dirname $0)

# Check Bash version (adjust version as needed)
if [[ ! $(bash --version | head -n1 | awk '{print $4}' | cut -d'.' -f1-2) =~ ^3\. ]]; then
echo "Error: Requires Bash version 3 or higher." >&2
exit 1
fi

# Step 1: Install prerequisites

# setup virtual python environment
Expand Down