39 lines
952 B
Bash
39 lines
952 B
Bash
|
|
#!/bin/bash
|
||
|
|
# Parmanode compatibility wrapper
|
||
|
|
# Allows running Parmanode scripts directly while wrapping them in container isolation
|
||
|
|
|
||
|
|
set -e
|
||
|
|
|
||
|
|
SCRIPT_PATH="$1"
|
||
|
|
MODULE_NAME="${2:-$(basename "$SCRIPT_PATH" .sh)}"
|
||
|
|
|
||
|
|
if [ -z "$SCRIPT_PATH" ]; then
|
||
|
|
echo "Usage: $0 <script-path> [module-name]"
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
if [ ! -f "$SCRIPT_PATH" ]; then
|
||
|
|
echo "Error: Script not found: $SCRIPT_PATH"
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
echo "🔧 Running Parmanode script in container: $SCRIPT_PATH"
|
||
|
|
|
||
|
|
# Create temporary container to run the script
|
||
|
|
CONTAINER_NAME="parmanode-${MODULE_NAME}-$$"
|
||
|
|
|
||
|
|
# Run script in Alpine container with necessary volumes
|
||
|
|
podman run --rm \
|
||
|
|
--name "$CONTAINER_NAME" \
|
||
|
|
--volume "$SCRIPT_PATH:/script.sh:ro" \
|
||
|
|
--volume "/var/lib/archipelago:/data:rw" \
|
||
|
|
--network host \
|
||
|
|
alpine:latest \
|
||
|
|
sh -c "
|
||
|
|
apk add --no-cache bash curl wget || true
|
||
|
|
chmod +x /script.sh
|
||
|
|
/script.sh
|
||
|
|
"
|
||
|
|
|
||
|
|
echo "✅ Parmanode script completed"
|