SHA256
30 lines
796 B
Bash
Executable File
30 lines
796 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$SCRIPT_DIR"
|
|
|
|
CONFIG_FILE="${1:-prepare.multi.json}"
|
|
VENV_DIR="$SCRIPT_DIR/.venv"
|
|
PYTHON_BIN="$VENV_DIR/bin/python"
|
|
PIP_BIN="$VENV_DIR/bin/pip"
|
|
|
|
if [[ ! -f "$CONFIG_FILE" ]]; then
|
|
echo "ERROR: config not found: $CONFIG_FILE" >&2
|
|
echo "Copy prepare.multi.example.json to prepare.multi.json first." >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! -f keys/arweave-wallet.json ]]; then
|
|
echo "ERROR: Arweave wallet not found: keys/arweave-wallet.json" >&2
|
|
echo "Put the private JWK there. The file is ignored by git." >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! -x "$PYTHON_BIN" ]]; then
|
|
python3 -m venv "$VENV_DIR"
|
|
"$PIP_BIN" install -r requirements.txt
|
|
fi
|
|
|
|
"$PYTHON_BIN" prepare/prepare_all_channels.py --config "$CONFIG_FILE"
|