Last active
March 2, 2026 06:40
-
-
Save ralvares/b70644568b627ee767ded632ac443e7b to your computer and use it in GitHub Desktop.
set webterminal for acs demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # 1. Check Storage Status | |
| STORAGE_INFO=$(wtoctl get storage 2>/dev/null) | |
| if [[ ! "$STORAGE_INFO" =~ "mounted" ]]; then | |
| echo "--- No persistent storage detected. Provisioning 500Mi... ---" | |
| wtoctl set storage | |
| echo "!!! Terminal is restarting. Re-run this script in the next session !!!" | |
| exit 0 | |
| fi | |
| # 2. Workspace Setup | |
| STORAGE_PATH="/home/user/storage" | |
| cd "$STORAGE_PATH" || { echo "Failed to enter storage directory"; exit 1; } | |
| # 3. Clone Repository | |
| if [ ! -d "security-demos" ]; then | |
| echo "--- Cloning security-demos repo... ---" | |
| git clone https://github.com/ralvares/security-demos/ | |
| else | |
| echo "--- security-demos already exists. Pulling latest... ---" | |
| cd security-demos && git pull && cd .. | |
| fi | |
| # 4. Download and Install roxctl | |
| if [ ! -f "./roxctl" ]; then | |
| echo "--- Downloading roxctl... ---" | |
| curl -L https://mirror.openshift.com/pub/rhacs/assets/latest/bin/Linux/roxctl -o roxctl | |
| chmod +x roxctl | |
| else | |
| echo "--- roxctl already exists ---" | |
| fi | |
| # 5. Set Environment and Aliases | |
| export ROX_ENDPOINT=central.stackrox:443 | |
| # Check for API Token | |
| if [ -z "$ROX_API_TOKEN" ]; then | |
| echo "" | |
| echo "****************************************************" | |
| echo "WARNING: ROX_API_TOKEN is not set!" | |
| echo "Please run: export ROX_API_TOKEN=<your-token>" | |
| echo "****************************************************" | |
| echo "" | |
| fi | |
| # Source the aliases | |
| ALIAS_FILE="/home/user/storage/security-demos/operators/rhacs/alias.sh" | |
| if [ -f "$ALIAS_FILE" ]; then | |
| echo "--- Sourcing RHACS aliases ---" | |
| source "$ALIAS_FILE" | |
| else | |
| echo "--- Warning: alias.sh not found at $ALIAS_FILE ---" | |
| fi | |
| echo "--- Setup Complete! Current Directory: $(pwd) ---" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment