64 lines
1.4 KiB
Bash
Executable File
64 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
# Default values
|
|
INPUT=""
|
|
OUTPUT_DIR="."
|
|
SHEET="Genesis Allocation"
|
|
|
|
# Parse command line arguments
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
-i|--input)
|
|
INPUT="$2"
|
|
shift 2
|
|
;;
|
|
-d|--dir)
|
|
OUTPUT_DIR="$2"
|
|
shift 2
|
|
;;
|
|
-s|--sheet)
|
|
SHEET="$2"
|
|
shift 2
|
|
;;
|
|
*)
|
|
echo "Unknown option: $1"
|
|
echo "Usage: $0 -i|--input <input_url_or_path> [-d|--dir <output_directory>] [-s|--sheet <sheet_name>]"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Check if input is provided
|
|
if [ -z "$INPUT" ]; then
|
|
echo "Error: Input URL or path is required"
|
|
echo "Usage: $0 -i|--input <input_url_or_path> [-d|--dir <output_directory>] [-s|--sheet <sheet_name>]"
|
|
exit 1
|
|
fi
|
|
|
|
# Create output directory if it doesn't exist
|
|
mkdir -p "$OUTPUT_DIR"
|
|
|
|
venv_dir="$PWD/venv-lps-lock"
|
|
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
# Create venv if it doesn't exist
|
|
if [ ! -d "$venv_dir" ]; then
|
|
python3 -m venv "$venv_dir"
|
|
fi
|
|
|
|
# Activate venv and install dependencies
|
|
"$venv_dir/bin/pip" install --upgrade pip
|
|
"$venv_dir/bin/pip" install requests pandas openpyxl bech32
|
|
|
|
echo "Running LPS lock generation script..."
|
|
"$venv_dir/bin/python" "$script_dir/generate-lps-distribution-json.py" \
|
|
--input "$INPUT" \
|
|
--output "$OUTPUT_DIR/distribution.json" \
|
|
--sheet "$SHEET"
|
|
|
|
# Clean up venv
|
|
echo "Cleaning up..."
|
|
rm -rf "$venv_dir"
|