fix: make setup.sh download both deployment types under curl|bash

The interactive deployment-type prompt read from stdin, which is the script
pipe (not the terminal) when piped to bash, so it was silently skipped and
only Docker scripts were downloaded. setup.sh is now non-interactive by
default and downloads BOTH deployment types (docker/ + native/) so the native
option is always available; DEPLOYMENT_TYPE=docker|native restricts to one.
Also guard clear and drop the broken overwrite confirmation.
This commit is contained in:
Sechpoint Admin 2026-08-01 08:45:29 +01:00
parent aa3d716f61
commit 537beed957
3 changed files with 62 additions and 74 deletions

View file

@ -43,13 +43,13 @@ A comprehensive solution for deploying Wallarm filtering nodes on virtual machin
### 1. Download the Scripts
Use the wrapper script to download all necessary tools. You will be asked to select the deployment type (`docker` or `native`):
Use the wrapper script to download all necessary tools. By default it downloads **both** deployment types (`docker` and `native`), so you can choose later:
```bash
curl -fsSL "https://git.sechpoint.app/customer-engineering/wallarm/raw/branch/main/setup.sh" | bash
```
To select non-interactively (e.g. for automation):
To download only one type (e.g. for automation):
```bash
DEPLOYMENT_TYPE=native curl -fsSL "https://git.sechpoint.app/customer-engineering/wallarm/raw/branch/main/setup.sh" | bash

View file

@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to date-based versioning (YYYY-MM.x).
## [2026-08.1] - 2026-08-01
### Fixed
- **setup.sh interactive prompt broken under `curl ... | bash`**: the deployment-type prompt and overwrite confirmation read from stdin, which is the script pipe (not the terminal) when piped to bash — the prompt was silently skipped and only Docker scripts were downloaded. setup.sh is now **non-interactive by default and downloads BOTH deployment types** (`docker/` + `native/`), so the native option is always available. Use `DEPLOYMENT_TYPE=docker|native` to download only one type.
### Added
- **Native deployment type**: Wallarm filtering node can now be deployed directly on the OS **without Docker**
- `native/wallarm-ct-check.sh` Preflight validation for native deployment (no Docker artifact checks)
@ -31,7 +34,7 @@ and this project adheres to date-based versioning (YYYY-MM.x).
- `common/` shared library
- **Artifact URLs** updated to the `docker/` prefix (`/docker/binaries/...`, `/docker/images/...`)
- **Docker scripts** refactored to source `common/wallarm-lib.sh` (removed duplicated helper functions; behavior preserved)
- **setup.sh** now prompts for a deployment type (`docker` or `native`), downloads the matching scripts into `docker/` or `native/` (native now includes `wallarm-native.sh`); supports `DEPLOYMENT_TYPE=native` for non-interactive use
- **setup.sh** downloads the shared library and scripts per deployment type into `docker/`/`native/` (native includes `wallarm-native.sh`); supports `DEPLOYMENT_TYPE=docker|native` to download only one type
- **README.md** rewritten to document both deployment types, the new structure, the unified manager, and native-specific usage
### Notes

127
setup.sh
View file

@ -5,12 +5,17 @@
# Downloads all necessary Wallarm deployment scripts from the Git repository
# and makes them executable.
#
# The repository supports two deployment types:
# By default BOTH deployment types are downloaded, so you can choose later:
# 1. docker - Wallarm filtering node as a Docker container
# 2. native - Wallarm filtering node installed directly on the OS (no Docker)
#
# To download only one type (e.g. for automation or smaller downloads):
# DEPLOYMENT_TYPE=docker curl -fsSL ".../setup.sh" | bash
# DEPLOYMENT_TYPE=native curl -fsSL ".../setup.sh" | bash
#
# Usage: curl -fsSL "https://git.sechpoint.app/customer-engineering/wallarm/raw/branch/main/setup.sh" | bash
# DEPLOYMENT_TYPE=native curl -fsSL ".../setup.sh" | bash (non-interactive)
# NOTE: This script is non-interactive on purpose - it must work when piped to
# bash (stdin is then the script pipe, not the terminal).
# ==============================================================================
set -euo pipefail
@ -45,10 +50,8 @@ NATIVE_SCRIPTS=(
# Detect download command
if command -v curl >/dev/null 2>&1; then
DOWNLOAD_CMD="curl -fL -O"
DOWNLOAD_NAME="curl"
elif command -v wget >/dev/null 2>&1; then
DOWNLOAD_CMD="wget -q"
DOWNLOAD_NAME="wget"
else
echo -e "${RED}${BOLD}ERROR:${NC} Neither curl nor wget is installed."
@ -56,25 +59,6 @@ else
exit 1
fi
# Select the deployment type (interactive or via DEPLOYMENT_TYPE env var)
select_deployment_type() {
if [[ "${DEPLOYMENT_TYPE:-}" =~ ^(docker|native)$ ]]; then
DEPLOY_TYPE="$DEPLOYMENT_TYPE"
echo -e "${GREEN}Deployment type: $DEPLOY_TYPE${NC}"
return 0
fi
echo -e "${CYAN}${BOLD}Select the deployment type:${NC}"
echo -e " 1. ${YELLOW}docker${NC} - Wallarm filtering node as a Docker container (LXC-optimized)"
echo -e " 2. ${YELLOW}native${NC} - Wallarm filtering node installed directly on the OS (no Docker)"
read -r -p "$(echo -e "${YELLOW}Enter choice [1/2] (default: docker): ${NC}")" choice
case "${choice:-1}" in
1|docker) DEPLOY_TYPE="docker" ;;
2|native) DEPLOY_TYPE="native" ;;
*) DEPLOY_TYPE="docker" ;;
esac
}
download_file() {
local url="$1"
local dest="$2"
@ -82,7 +66,7 @@ download_file() {
echo -e "${YELLOW}Downloading ${description}...${NC}"
if [ "$DOWNLOAD_NAME" = "curl" ]; then
curl -fL "$url" -o "$dest"
curl -fsSL "$url" -o "$dest"
else
wget -q "$url" -O "$dest"
fi
@ -97,8 +81,25 @@ download_file() {
fi
}
download_deployment_type() {
local type="$1"
local scripts
case "$type" in
native) scripts=("${NATIVE_SCRIPTS[@]}") ;;
docker) scripts=("${DOCKER_SCRIPTS[@]}") ;;
*) err "Unknown deployment type: $type"; exit 1 ;;
esac
mkdir -p "$type"
for script in "${scripts[@]}"; do
download_file "${GIT_BASE}${type}/${script}" "${type}/${script}" "$type/$script"
done
}
# Main
clear
clear 2>/dev/null || true
echo -e "${BLUE}${BOLD}"
echo "╔══════════════════════════════════════════════════════════════╗"
echo "║ WALLARM DEPLOYMENT SETUP SCRIPT ║"
@ -106,59 +107,43 @@ echo "║ Downloads all necessary deployment tools ║"
echo "╚══════════════════════════════════════════════════════════════╝${NC}"
echo
# Select deployment type
select_deployment_type
# Determine target directories
COMMON_DIR="common"
TARGET_DIR="$DEPLOY_TYPE"
echo -e "${BLUE}Target directory: ${TARGET_DIR}/${NC}"
# Check for existing scripts
if ls "$TARGET_DIR"/wallarm-ct-*.sh 2>/dev/null | grep -q .; then
echo -e "${YELLOW}Existing $DEPLOY_TYPE Wallarm scripts found.${NC}"
echo -e "${YELLOW}Do you want to re-download all? (y/N)${NC}"
read -r answer
if [[ ! "$answer" =~ ^[Yy]$ ]]; then
echo -e "${BLUE}Exiting without changes.${NC}"
exit 0
fi
# Decide which deployment type(s) to download
DEPLOY_TYPES=()
if [[ "${DEPLOYMENT_TYPE:-}" =~ ^(docker|native)$ ]]; then
DEPLOY_TYPES+=("$DEPLOYMENT_TYPE")
echo -e "${GREEN}Downloading only deployment type: $DEPLOYMENT_TYPE${NC}"
else
DEPLOY_TYPES+=("docker" "native")
echo -e "${CYAN}Downloading BOTH deployment types (docker + native).${NC}"
echo -e "${YELLOW}To download only one type, re-run with: DEPLOYMENT_TYPE=docker or DEPLOYMENT_TYPE=native${NC}"
fi
echo
# Select the script list for the chosen deployment type
case "$DEPLOY_TYPE" in
native) SCRIPTS=("${NATIVE_SCRIPTS[@]}") ;;
*) SCRIPTS=("${DOCKER_SCRIPTS[@]}") ;;
esac
# Download shared library (required by all deployment scripts)
mkdir -p "common"
download_file "${GIT_BASE}common/wallarm-lib.sh" "common/wallarm-lib.sh" "shared library (common/wallarm-lib.sh)"
# Create target directories
mkdir -p "$TARGET_DIR" "$COMMON_DIR"
# Download shared library
download_file "${GIT_BASE}common/wallarm-lib.sh" "${COMMON_DIR}/wallarm-lib.sh" "shared library (${COMMON_DIR}/wallarm-lib.sh)"
# Download the deployment type scripts
for script in "${SCRIPTS[@]}"; do
download_file "${GIT_BASE}${TARGET_DIR}/${script}" "${TARGET_DIR}/${script}" "$DEPLOY_TYPE/$script"
# Download the selected deployment type(s)
for type in "${DEPLOY_TYPES[@]}"; do
download_deployment_type "$type"
done
echo
echo -e "${GREEN}${BOLD}All $DEPLOY_TYPE scripts downloaded successfully!${NC}"
echo -e "${GREEN}${BOLD}Setup complete - all requested scripts downloaded!${NC}"
echo
if [ "$DEPLOY_TYPE" = "native" ]; then
echo -e "${CYAN}Next steps:${NC}"
echo -e " 1. Run the preflight check: ${YELLOW}./native/wallarm-ct-check.sh${NC}"
echo -e " 2. Deploy a Wallarm node: ${YELLOW}./native/wallarm-ct-deploy.sh${NC}"
echo -e " 3. Unified node manager: ${YELLOW}./native/wallarm-native.sh --preflight${NC} (then --install)"
echo -e " 4. Reconfigure existing node: ${YELLOW}./native/wallarm-ct-reconfigure.sh${NC}"
echo -e " 5. Uninstall a node: ${YELLOW}./native/wallarm-ct-uninstall.sh${NC}"
else
echo -e "${CYAN}Next steps:${NC}"
echo -e " 1. Run the preflight check: ${YELLOW}./docker/wallarm-ct-check.sh${NC}"
echo -e " 2. Deploy a Wallarm node: ${YELLOW}./docker/wallarm-ct-deploy.sh${NC}"
echo -e " 3. Reconfigure existing node: ${YELLOW}./docker/wallarm-ct-reconfigure.sh${NC}"
echo -e " 4. Uninstall a node: ${YELLOW}./docker/wallarm-ct-uninstall.sh${NC}"
fi
echo -e "${CYAN}Next steps:${NC}"
echo -e " Docker deployment:"
echo -e " 1. Run the preflight check: ${YELLOW}./docker/wallarm-ct-check.sh${NC}"
echo -e " 2. Deploy a Wallarm node: ${YELLOW}./docker/wallarm-ct-deploy.sh${NC}"
echo -e " 3. Reconfigure existing node: ${YELLOW}./docker/wallarm-ct-reconfigure.sh${NC}"
echo -e " 4. Uninstall a node: ${YELLOW}./docker/wallarm-ct-uninstall.sh${NC}"
echo
echo -e " Native deployment (no Docker):"
echo -e " 1. Run the preflight check: ${YELLOW}./native/wallarm-ct-check.sh${NC}"
echo -e " 2. Deploy a Wallarm node: ${YELLOW}./native/wallarm-ct-deploy.sh${NC}"
echo -e " 3. Unified node manager: ${YELLOW}./native/wallarm-native.sh --preflight${NC} (then --install)"
echo -e " 4. Reconfigure existing node: ${YELLOW}./native/wallarm-ct-reconfigure.sh${NC}"
echo -e " 5. Uninstall a node: ${YELLOW}./native/wallarm-ct-uninstall.sh${NC}"
echo
echo -e "${YELLOW}Note: Some scripts require sudo. Run them with: sudo ./<script>${NC}"
echo -e "${YELLOW}Make sure you have the required information ready (see documentation).${NC}"