Skip to content

Commit

Permalink
chore: POSIX compatible single-node (celestiaorg#3376)
Browse files Browse the repository at this point in the history
<!--
Please read and fill out this form before submitting your PR.

Please make sure you have reviewed our contributors guide before
submitting your
first PR.
-->

## Overview

Make the `single-node.sh` script POSIX compatible so it runs on
macOS/Linux etc without issue
  • Loading branch information
rach-id authored Apr 24, 2024
1 parent 3930656 commit 9dbc541
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions scripts/single-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ echo ""

# Ask the user for confirmation before deleting the existing celestia-app home
# directory.
read -p "Are you sure you want to delete: $CELESTIA_APP_HOME? [y/n] " response
echo "Are you sure you want to delete: $CELESTIA_APP_HOME? [y/n] "
read -r response

# Check the user's response
if [[ $response != "y" ]]; then
if [ "$response" != "y" ]; then
# Exit if the user did not respond with "y"
echo "You must delete $CELESTIA_APP_HOME to continue."
exit 1
Expand All @@ -41,33 +42,33 @@ rm -r "$CELESTIA_APP_HOME"
echo "Initializing validator and node config files..."
celestia-appd init ${CHAIN_ID} \
--chain-id ${CHAIN_ID} \
--home ${CELESTIA_APP_HOME} \
&> /dev/null # Hide output to reduce terminal noise
--home "${CELESTIA_APP_HOME}" \
> /dev/null 2>&1 # Hide output to reduce terminal noise

echo "Adding a new key to the keyring..."
celestia-appd keys add ${KEY_NAME} \
--keyring-backend=${KEYRING_BACKEND} \
--home ${CELESTIA_APP_HOME} \
&> /dev/null # Hide output to reduce terminal noise
--home "${CELESTIA_APP_HOME}" \
> /dev/null 2>&1 # Hide output to reduce terminal noise

echo "Adding genesis account..."
celestia-appd add-genesis-account \
$(celestia-appd keys show ${KEY_NAME} -a --keyring-backend=${KEYRING_BACKEND} --home ${CELESTIA_APP_HOME}) \
"$(celestia-appd keys show ${KEY_NAME} -a --keyring-backend=${KEYRING_BACKEND} --home "${CELESTIA_APP_HOME}")" \
$COINS \
--home ${CELESTIA_APP_HOME}
--home "${CELESTIA_APP_HOME}"

echo "Creating a genesis tx..."
celestia-appd gentx ${KEY_NAME} ${DELEGATION_AMOUNT} \
--fees ${FEES} \
--keyring-backend=${KEYRING_BACKEND} \
--chain-id ${CHAIN_ID} \
--home ${CELESTIA_APP_HOME} \
&> /dev/null # Hide output to reduce terminal noise
--home "${CELESTIA_APP_HOME}" \
> /dev/null 2>&1 # Hide output to reduce terminal noise

echo "Collecting genesis txs..."
celestia-appd collect-gentxs \
--home ${CELESTIA_APP_HOME} \
&> /dev/null # Hide output to reduce terminal noise
--home "${CELESTIA_APP_HOME}" \
> /dev/null 2>&1 # Hide output to reduce terminal noise

# Set proper defaults and change ports
# If you encounter: `sed: -I or -i may not be used with stdin` on MacOS you can mitigate by installing gnu-sed
Expand All @@ -86,7 +87,7 @@ sed -i'.bak' 's#"604800s"#"60s"#g' "${CELESTIA_APP_HOME}"/config/genesis.json
# Start celestia-app
echo "Starting celestia-app..."
celestia-appd start \
--home ${CELESTIA_APP_HOME} \
--home "${CELESTIA_APP_HOME}" \
--api.enable \
--grpc.enable \
--grpc-web.enable

0 comments on commit 9dbc541

Please sign in to comment.