solana/snap/hooks/configure

32 lines
664 B
Bash
Executable File

#!/bin/bash -e
echo Stopping daemons
snapctl stop --disable solana.daemon-drone
snapctl stop --disable solana.daemon-leader
snapctl stop --disable solana.daemon-validator
mode="$(snapctl get mode)"
if [[ -z "$mode" ]]; then
exit 0
fi
public_ip="$(snapctl get public-ip)"
$SNAP/bin/setup.sh -n "$(snapctl get num-tokens)" -p ${public_ip:+-p $public_ip}
case $mode in
leader+drone)
snapctl start --enable solana.daemon-leader
snapctl start --enable solana.daemon-drone
;;
leader)
snapctl start --enable solana.daemon-leader
;;
validator)
snapctl start --enable solana.daemon-validator
;;
*)
echo "Error: Unknown mode: $mode"
exit 1
;;
esac