Merge pull request #826 from cosmos/784-gnused

Use gnused in scripts
This commit is contained in:
Will Clark 2021-06-09 18:26:29 +02:00 committed by GitHub
commit e680d42427
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 25 additions and 9 deletions

View File

@ -9,6 +9,8 @@ work on CosmJS, i.e. modify it. It is not intended for users of CosmJS.
- Node.js 12+, Docker and yarn
- `sha256sum`, which you
[can get on macOS as well](https://unix.stackexchange.com/questions/426837/no-sha256sum-in-macos)
- `gsed`, which you
[can get on macOS as well](https://formulae.brew.sh/formula/gnu-sed)
## Checking out code

View File

@ -2,6 +2,8 @@
set -o errexit -o nounset -o pipefail
command -v shellcheck >/dev/null && shellcheck "$0"
gnused="$(command -v gsed || echo sed)"
SCRIPT_DIR="$(realpath "$(dirname "$0")")"
# shellcheck source=./env
# shellcheck disable=SC1091
@ -53,7 +55,7 @@ function inline_jq() {
inline_jq "template/.simapp/config/genesis.json" -S
# Custom settings in config.toml
sed -i "" \
"$gnused" -i \
-e 's/^cors_allowed_origins =.*$/cors_allowed_origins = ["*"]/' \
-e 's/^timeout_propose =.*$/timeout_propose = "300ms"/' \
-e 's/^timeout_propose_delta =.*$/timeout_propose_delta = "100ms"/' \
@ -65,7 +67,7 @@ function inline_jq() {
"template/.simapp/config/config.toml"
# Custom settings app.toml
sed -i "" \
"$gnused" -i \
-e 's/^enable =.*$/enable = true/' \
-e 's/^enabled-unsafe-cors =.*$/enabled-unsafe-cors = true/' \
"template/.simapp/config/app.toml"

View File

@ -2,6 +2,8 @@
set -o errexit -o nounset -o pipefail
command -v shellcheck >/dev/null && shellcheck "$0"
gnused="$(command -v gsed || echo sed)"
SCRIPT_DIR="$(realpath "$(dirname "$0")")"
# Create template for slow simapp
@ -12,7 +14,7 @@ SCRIPT_DIR="$(realpath "$(dirname "$0")")"
chmod +x "$SCRIPT_DIR/template_slow/run_simd.sh"
# Slow settings in config.toml
sed -i "" \
"$gnused" -i \
-e 's/^timeout_broadcast_tx_commit =.*$/timeout_broadcast_tx_commit = "1s"/' \
-e 's/^timeout_commit =.*$/timeout_commit = "10s"/' \
"template_slow/.simapp/config/config.toml"

View File

@ -2,6 +2,8 @@
set -o errexit -o nounset
command -v shellcheck >/dev/null && shellcheck "$0"
gnused="$(command -v gsed || echo sed)"
PASSWORD=${PASSWORD:-1234567890}
CHAIN_ID=${CHAIN_ID:-simd-testing}
MONIKER=${MONIKER:-simd-moniker}
@ -15,7 +17,7 @@ START_BALANCE="10000000$STAKE,1000000000$FEE"
echo "Creating genesis ..."
simd init --chain-id "$CHAIN_ID" "$MONIKER"
sed -i "s/\"stake\"/\"$STAKE\"/" "$HOME"/.simapp/config/genesis.json # staking/governance token is hardcoded in config, change this
"$gnused" -i "s/\"stake\"/\"$STAKE\"/" "$HOME"/.simapp/config/genesis.json # staking/governance token is hardcoded in config, change this
echo "Setting up validator ..."
if ! simd keys show validator 2>/dev/null; then

View File

@ -2,6 +2,8 @@
set -o errexit -o nounset
command -v shellcheck >/dev/null && shellcheck "$0"
gnused="$(command -v gsed || echo sed)"
PASSWORD=${PASSWORD:-1234567890}
CHAIN_ID=${CHAIN_ID:-simd-testing}
MONIKER=${MONIKER:-simd-moniker}
@ -15,7 +17,7 @@ START_BALANCE="10000000$STAKE,1000000000$FEE"
echo "Creating genesis ..."
simd init --chain-id "$CHAIN_ID" "$MONIKER"
sed -i "s/\"stake\"/\"$STAKE\"/" "$HOME"/.simapp/config/genesis.json # staking/governance token is hardcoded in config, change this
"$gnused" -i "s/\"stake\"/\"$STAKE\"/" "$HOME"/.simapp/config/genesis.json # staking/governance token is hardcoded in config, change this
echo "Setting up validator ..."
if ! simd keys show validator 2>/dev/null; then

View File

@ -2,6 +2,8 @@
set -o errexit -o nounset
command -v shellcheck >/dev/null && shellcheck "$0"
gnused="$(command -v gsed || echo sed)"
PASSWORD=${PASSWORD:-1234567890}
CHAIN_ID=${CHAIN_ID:-simd-testing}
MONIKER=${MONIKER:-simd-moniker}
@ -15,7 +17,7 @@ START_BALANCE="10000000$STAKE,1000000000$FEE"
echo "Creating genesis ..."
simd init --chain-id "$CHAIN_ID" "$MONIKER"
sed -i "s/\"stake\"/\"$STAKE\"/" "$HOME"/.simapp/config/genesis.json # staking/governance token is hardcoded in config, change this
"$gnused" -i "s/\"stake\"/\"$STAKE\"/" "$HOME"/.simapp/config/genesis.json # staking/governance token is hardcoded in config, change this
echo "Setting up validator ..."
if ! simd keys show validator 2>/dev/null; then

View File

@ -2,6 +2,8 @@
set -o errexit -o nounset -o pipefail
command -v shellcheck >/dev/null && shellcheck "$0"
gnused="$(command -v gsed || echo sed)"
# Tendermint settings must be specified
# Choose version from https://hub.docker.com/r/tendermint/tendermint/tags/
for SETTING in "TENDERMINT_VERSION" "TENDERMINT_PORT" "TENDERMINT_NAME"; do
@ -24,7 +26,7 @@ docker run --rm \
# make sure we allow cors origins, only possible by modifying the config file
# https://github.com/tendermint/tendermint/issues/3216
sed -ie 's/^cors_allowed_origins =.*$/cors_allowed_origins = ["*"]/' "${TMP_DIR}/config/config.toml"
"$gnused" -i -e 's/^cors_allowed_origins =.*$/cors_allowed_origins = ["*"]/' "${TMP_DIR}/config/config.toml"
# must enable tx index for search and subscribe
docker run --rm \

View File

@ -2,6 +2,8 @@
set -o errexit -o nounset -o pipefail
command -v shellcheck >/dev/null && shellcheck "$0"
gnused="$(command -v gsed || echo sed)"
SCRIPT_DIR="$(realpath "$(dirname "$0")")"
# shellcheck source=./env
# shellcheck disable=SC1091
@ -47,7 +49,7 @@ function inline_jq() {
inline_jq "template/.wasmd/config/genesis.json" -S
# Custom settings in config.toml
sed -i "" \
"$gnused" -i \
-e 's/^cors_allowed_origins =.*$/cors_allowed_origins = ["*"]/' \
-e 's/^timeout_propose =.*$/timeout_propose = "300ms"/' \
-e 's/^timeout_propose_delta =.*$/timeout_propose_delta = "100ms"/' \
@ -59,7 +61,7 @@ function inline_jq() {
"template/.wasmd/config/config.toml"
# Custom settings app.toml
sed -i "" \
"$gnused" -i \
-e 's/^enable =.*$/enable = true/' \
-e 's/^enabled-unsafe-cors =.*$/enabled-unsafe-cors = true/' \
"template/.wasmd/config/app.toml"