-# As a workaround, this function is for enabling the wallet when I want
-# to use it and leave it disabled otherwise.
-walleton() {
- local active
- active=false
- no_on=true
- if [[ ! $(readlink -f /var/lib/bitcoind/wallets) == /q/wallets ]]; then
- if systemctl --quiet is-active bitcoind; then
- if [[ -e /tmp/no-bitcoinon ]]; then
- no_on=true
- else
- if [[ $EUID == 0 ]]; then
- m install -T -o iank -g iank /dev/null /tmp/no-bitcoinon
- else
- m touch /tmp/no-bitcoinon
- fi
- fi
- active=true
- m ser stop bitcoind
- fi
- m s ln -s /q/wallets /var/lib/bitcoind
- sudo chown -h bitcoin:bitcoin /var/lib/bitcoind/wallets
- if $active; then
- m ser start bitcoind
- if ! $no_on; then
- m rm /tmp/no-bitcoinon
- fi
- fi
- fi
-}
-walletoff() {
- local active
- active=false
- no_on=true
- if [[ $(readlink -f /var/lib/bitcoind/wallets) == /q/wallets ]]; then
- if systemctl --quiet is-active bitcoind; then
- if [[ -e /tmp/no-bitcoinon ]]; then
- no_on=true
- else
- if [[ $EUID == 0 ]]; then
- m install -T -o iank -g iank /dev/null /tmp/no-bitcoinon
- else
- m touch /tmp/no-bitcoinon
- fi
- fi
- active=true
- m ser stop bitcoind
- else
- echo note: bitcoind not active
- fi
- m rm /var/lib/bitcoind/wallets
- if $active; then
- # note, starting bitcoin always fails, but it actually
- # succeeds. But this is strangely not consistent.
- m ser start bitcoind
- if ! $no_on; then
- m rm /tmp/no-bitcoinon
- fi
- fi
- fi
-}