examples: add option --interactive|-i
This commit is contained in:
parent
33ff8d82be
commit
c19f7ebb01
@ -48,6 +48,12 @@ shut down immediately. They leave no traces (outside of `/nix/store`) on the hos
|
||||
NixOps can be used to deploy to various other backends like cloud providers.\
|
||||
Requires: [Nix](https://nixos.org/nix/), [VirtualBox](https://www.virtualbox.org)
|
||||
|
||||
Run the examples with option `--interactive` or `-i` to start a shell for interacting with
|
||||
the node:
|
||||
```bash
|
||||
./deploy-qemu-vm.sh -i
|
||||
```
|
||||
|
||||
#### Tests
|
||||
The internal test suite is also useful for exploring features.
|
||||
The following `run-tests.sh` commands leave no traces (outside of `/nix/store`) on
|
||||
|
@ -17,12 +17,9 @@ fi
|
||||
if [[ ! -v IN_NIX_SHELL ]]; then
|
||||
echo "Running script in nix shell env..."
|
||||
cd "${BASH_SOURCE[0]%/*}"
|
||||
exec nix-shell --run "./${BASH_SOURCE[0]##*/}"
|
||||
exec nix-shell --run "./${BASH_SOURCE[0]##*/} $*"
|
||||
fi
|
||||
|
||||
# Uncomment to start a container shell session
|
||||
# interactive=1
|
||||
|
||||
# These commands can also be executed interactively in a shell session
|
||||
demoCmds='
|
||||
echo
|
||||
@ -42,11 +39,14 @@ echo "Bitcoind data dir:"
|
||||
sudo ls -al /var/lib/containers/demo-node/var/lib/bitcoind
|
||||
'
|
||||
|
||||
if [[ ${interactive:-} ]]; then
|
||||
runCmd=
|
||||
else
|
||||
runCmd=(--run bash -c "$demoCmds")
|
||||
fi
|
||||
case ${1:-} in
|
||||
-i|--interactive)
|
||||
runCmd=
|
||||
;;
|
||||
*)
|
||||
runCmd=(--run bash -c "$demoCmds")
|
||||
;;
|
||||
esac
|
||||
|
||||
# Build container.
|
||||
# Learn more: https://github.com/erikarvstedt/extra-container
|
||||
|
@ -11,7 +11,7 @@ set -euo pipefail
|
||||
if [[ ! -v IN_NIX_SHELL ]]; then
|
||||
echo "Running script in nix shell env..."
|
||||
cd "${BASH_SOURCE[0]%/*}"
|
||||
exec nix-shell --run "./${BASH_SOURCE[0]##*/}"
|
||||
exec nix-shell --run "./${BASH_SOURCE[0]##*/} $*"
|
||||
fi
|
||||
|
||||
# Cleanup on exit
|
||||
@ -40,7 +40,11 @@ nixops deploy -d bitcoin-node
|
||||
nixops ssh bitcoin-node systemctl status bitcoind
|
||||
|
||||
c() { nixops ssh bitcoin-node "$@"; }
|
||||
# Uncomment to start a shell session here
|
||||
# . start-bash-session.sh
|
||||
|
||||
case ${1:-} in
|
||||
-i|--interactive)
|
||||
. start-bash-session.sh
|
||||
;;
|
||||
esac
|
||||
|
||||
# Cleanup happens at exit (see above)
|
||||
|
@ -14,7 +14,7 @@ set -euo pipefail
|
||||
if [[ ! -v IN_NIX_SHELL ]]; then
|
||||
echo "Running script in nix shell env..."
|
||||
cd "${BASH_SOURCE[0]%/*}"
|
||||
exec nix-shell --run "./${BASH_SOURCE[0]##*/}"
|
||||
exec nix-shell --run "./${BASH_SOURCE[0]##*/} $*"
|
||||
fi
|
||||
|
||||
tmpDir=/tmp/nix-bitcoin-qemu-vm
|
||||
@ -91,7 +91,10 @@ echo
|
||||
echo "Node info:"
|
||||
c nodeinfo
|
||||
|
||||
# Uncomment to start a shell session here
|
||||
# . start-bash-session.sh
|
||||
case ${1:-} in
|
||||
-i|--interactive)
|
||||
. start-bash-session.sh
|
||||
;;
|
||||
esac
|
||||
|
||||
# Cleanup happens at exit (see above)
|
||||
|
@ -3,7 +3,11 @@
|
||||
USAGE_INFO='
|
||||
Starting shell...
|
||||
Run "c COMMAND" to execute a command on the bitcoin node
|
||||
Run "c" to start a shell session inside the node'
|
||||
Run "c" to start a shell session inside the node
|
||||
|
||||
Example:
|
||||
c systemctl status bitcoind
|
||||
'
|
||||
|
||||
# BASH_ENVIRONMENT contains definitions of read-only variables like 'BASHOPTS' that
|
||||
# cause warnings on evaluation. Suppress these warnings while sourcing.
|
||||
|
Loading…
Reference in New Issue
Block a user