examples: improve robustness of deploy scripts
- The scripts now work within arbitrary nix-shells. Previously, they failed when run from nix shells other than `examples/shell.nix`. - The scripts now work from arbitrary working dirs.
This commit is contained in:
@@ -12,10 +12,12 @@ set -euo pipefail
|
||||
# MAKE SURE TO REPLACE the SSH identity file if you use this script for
|
||||
# anything serious.
|
||||
|
||||
if [[ ! -v IN_NIX_SHELL ]]; then
|
||||
if [[ ! -v NIX_BITCOIN_EXAMPLES_DIR ]]; then
|
||||
echo "Running script in nix shell env..."
|
||||
cd "${BASH_SOURCE[0]%/*}"
|
||||
exec nix-shell --run "./${BASH_SOURCE[0]##*/} $*"
|
||||
else
|
||||
cd "$NIX_BITCOIN_EXAMPLES_DIR"
|
||||
fi
|
||||
|
||||
source qemu-vm/run-vm.sh
|
||||
|
||||
Reference in New Issue
Block a user