#!/bin/bash # https://github.com/cryptoadvance/specter-desktop # ~/.config/btc-rpc-explorer.env # https://github.com/janoside/btc-rpc-explorer/blob/master/.env-sample # command info if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then echo "small config script to switch cryptoadvance specter on or off" echo "bonus.cryptoadvance-specter.sh [status|on|off]" exit 1 fi source /mnt/hdd/raspiblitz.conf # show info menu if [ "$1" = "menu" ]; then # get status echo "# collecting status info ... (please wait)" source <(sudo /home/admin/config.scripts/bonus.cryptoadvance-specter.sh status) # get network info localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/') toraddress=https://$(sudo cat /mnt/hdd/tor/cryptoadvance-specter/hostname 2>/dev/null) if [ "${runBehindTor}" = "on" ] && [ ${#toraddress} -gt 0 ]; then # TOR /home/admin/config.scripts/blitz.lcd.sh qr "${toraddress}" whiptail --title " Cryptoadvance Specter " --msgbox "Open the following URL in your local web browser: https://${localip}:25441 You have to accept the self-signed-certificate. Login with the Pin being Password B. If you have connected to a different Bitcoin RPC Endpoint, the Pin is the configured RPCPassword. Hidden Service address for TOR Browser (QR see LCD): ${toraddress}\n " 16 70 /home/admin/config.scripts/blitz.lcd.sh hide else # IP + Domain whiptail --title " Cryptoadvance Specter " --msgbox "Open the following URL in your local web browser: https://${localip}:25441 You have to accept the self-signed-certificate. Login with the Pin being Password B. If you have connected to a different Bitcoin RPC Endpoint, the Pin is the configured RPCPassword.\n Activate TOR to access the web block explorer from outside your local network. Unfortunately the camera is currently not usable via Tor, though. " 12 54 fi echo "please wait ..." exit 0 fi # add default value to raspi config if needed if ! grep -Eq "^specter=" /mnt/hdd/raspiblitz.conf; then echo "specter=off" >> /mnt/hdd/raspiblitz.conf fi # status if [ "$1" = "status" ]; then if [ "${specter}" = "on" ]; then echo "configured=1" # check for error isDead=$(sudo systemctl status cryptoadvance-specter | grep -c 'inactive (dead)') if [ ${isDead} -eq 1 ]; then echo "error='Service Failed'" exit 1 fi else echo "configured=0" fi exit 0 fi # stop service echo "making sure services are not running" sudo systemctl stop cryptoadvance-specter 2>/dev/null # switch on if [ "$1" = "1" ] || [ "$1" = "on" ]; then echo "*** INSTALL Cryptoadvance Specter ***" isInstalled=$(sudo ls /etc/systemd/system/cryptoadvance-specter.service 2>/dev/null | grep -c 'cryptoadvance-specter.service') if [ ${isInstalled} -eq 0 ]; then echo "*** Enable wallets in Bitcoin Core ***" sudo sed -i "s/^disablewallet=.*/disablewallet=0/g" /home/bitcoin/.bitcoin/bitcoin.conf sudo service bitcoind stop sudo service bitcoind start echo "*** Installing prerequisites ***" sudo apt install -y libusb-1.0.0-dev libudev-dev virtualenv # activating Authentication here ... echo "*** creating App-config ***" cat > /home/admin/config.json < /home/admin/20-hw1.rules < /home/admin/51-coinkite.rules < KERNEL=="hidraw*", ATTRS{idVendor}=="d13e", ATTRS{idProduct}=="cc10", GROUP="plugdev", MODE="0666" EOF cat > /home/admin/51-trezor.rules < /home/admin/51-usb-keepkey.rules < /home/admin/cryptoadvance-specter.service <