X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=brc2;h=5f0a5ff45f5ee11430b1d232c6fed78473686b2a;hb=5a6e794f459b3e83b6d665e05d0ab0c8bc6cdfbe;hp=fbe19ebbcca468d00b2f2caa942466cd83bf88ec;hpb=0f9a999aa601cd77343a3e08cf0c6c4f9f943813;p=distro-setup diff --git a/brc2 b/brc2 index fbe19eb..5f0a5ff 100644 --- a/brc2 +++ b/brc2 @@ -1806,6 +1806,66 @@ satoshi() { # $1 satoshi in usd printf "$%.2f\n" "$(echo "scale=10; $price * $1"| bc -l)" fi } + +# Bitcoin holds open the wallet file. this causes problems for a +# secondary computer running bitcoin and receiving a backup. So, as a +# workaround, I intend to manually enable 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 + fi + m rm /var/lib/bitcoind/wallets + if $active; then + m ser start bitcoind + if ! $no_on; then + m rm /tmp/no-bitcoinon + fi + fi + fi +} #### end bitcoin related things @@ -4195,6 +4255,13 @@ hssh-update() { fi } +noi3bar() { + touch /tmp/noi3bar +} +i3bar() { + rm -fv /tmp/noi3bar +} + export BASEFILE_DIR=/a/bin/fai-basefiles