From af5df9bdf67fe73a096d0268fe49aa302f406b6c Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Wed, 20 Nov 2019 20:02:33 -0600 Subject: [PATCH] Install JoinMarket --- rootfs/standard/usr/bin/mynode-local-upgrade | 4 ++ .../standard/usr/bin/mynode_post_upgrade.sh | 55 ++++++++++++++++++- .../usr/share/mynode/mynode_config.sh | 6 ++ setup/setup_device.sh | 6 +- 4 files changed, 67 insertions(+), 4 deletions(-) diff --git a/rootfs/standard/usr/bin/mynode-local-upgrade b/rootfs/standard/usr/bin/mynode-local-upgrade index 07fcd1cf..827a0c45 100755 --- a/rootfs/standard/usr/bin/mynode-local-upgrade +++ b/rootfs/standard/usr/bin/mynode-local-upgrade @@ -59,5 +59,9 @@ else # Default, full upgrade echo "Full upgrade, running post upgrade script and rebooting device..." /bin/bash /usr/bin/mynode_post_upgrade.sh + if [ $? -ne 0 ]; then + echo "ERROR: Post upgrade script failed!" + exit 1 + fi reboot fi \ No newline at end of file diff --git a/rootfs/standard/usr/bin/mynode_post_upgrade.sh b/rootfs/standard/usr/bin/mynode_post_upgrade.sh index 24d3e51a..972458e8 100755 --- a/rootfs/standard/usr/bin/mynode_post_upgrade.sh +++ b/rootfs/standard/usr/bin/mynode_post_upgrade.sh @@ -15,9 +15,10 @@ systemctl stop bitcoind apt -y install pv sysstat network-manager unzip pkg-config libfreetype6-dev libpng-dev apt -y install libatlas-base-dev libffi-dev libssl-dev glances python3-bottle apt -y -qq install apt-transport-https ca-certificates +apt -y install libgmp-dev automake libtool libltdl-dev libltdl7 # Install any pip software -pip install tzupdate +pip install tzupdate virtualenv # Install any pip3 software @@ -28,6 +29,7 @@ pip3 install docker-compose # Import Keys curl https://keybase.io/roasbeef/pgp_keys.asc | gpg --import +curl https://raw.githubusercontent.com/JoinMarket-Org/joinmarket-clientserver/master/pubkeys/AdamGibson.asc | gpg --import gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 01EA5486DE18A882D4C2684590C8019E36C2E964 @@ -43,6 +45,7 @@ usermod -aG docker root # Upgrade BTC +echo "Upgrading BTC..." set +e BTC_VERSION="0.18.1" ARCH="arm-linux-gnueabihf" @@ -90,6 +93,7 @@ if [ "$CURRENT" != "$BTC_UPGRADE_URL" ]; then fi # Upgrade LND +echo "Upgrading LND..." LND_VERSION="v0.8.0-beta" LND_ARCH="lnd-linux-armv7" if [ $IS_X86 = 1 ]; then @@ -127,6 +131,55 @@ if [ "$CURRENT" != "$LND_UPGRADE_URL" ]; then fi fi +# Install recent version of secp256k1 +echo "Installing secp256k1..." +if [ ! -f /usr/include/secp256k1_ecdh.h ]; then + rm -rf /tmp/secp256k1 + cd /tmp/ + git clone https://github.com/bitcoin-core/secp256k1.git + cd secp256k1 + + ./autogen.sh + ./configure + make + make install + cp -f include/* /usr/include/ +fi + +# Upgrade Joinmarket +echo "Upgrading JoinMarket..." +if [ $IS_PREMIUM -eq 1 ]; then + JOINMARKET_VERSION=0.5.5 + JOINMARKET_GITHUB_URL=https://github.com/JoinMarket-Org/joinmarket-clientserver.git + JOINMARKET_VERSION_FILE=/home/bitcoin/.mynode/.joinmarket_version + CURRENT="" + if [ -f $JOINMARKET_VERSION_FILE ]; then + CURRENT=$(cat $JOINMARKET_VERSION_FILE) + fi + if [ "$CURRENT" != "$JOINMARKET_VERSION" ]; then + # Download and build JoinMarket + cd /opt/mynode + + if [ ! -d /opt/mynode/joinmarket-clientserver ]; then + git clone $JOINMARKET_GITHUB_URL + cd joinmarket-clientserver + else + cd joinmarket-clientserver + git pull origin master + fi + git reset --hard v$JOINMARKET_VERSION + + # Create virtualenv and setup joinmarket + virtualenv -p python3 jmvenv + source jmvenv/bin/activate + python setupall.py --daemon + python setupall.py --client-bitcoin + deactivate + + #echo $JOINMARKET_VERSION > $JOINMARKET_VERSION_FILE + fi +fi + # Upgrade RTL RTL_UPGRADE_URL=https://github.com/ShahanaFarooqui/RTL/archive/v0.5.1.tar.gz RTL_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.rtl_url diff --git a/rootfs/standard/usr/share/mynode/mynode_config.sh b/rootfs/standard/usr/share/mynode/mynode_config.sh index 677b41d6..5741afec 100644 --- a/rootfs/standard/usr/share/mynode/mynode_config.sh +++ b/rootfs/standard/usr/share/mynode/mynode_config.sh @@ -60,9 +60,15 @@ VPN_ENABLED_FILE="/mnt/hdd/mynode/.mynode_vpn_enabled" BITCOIN_SYNCED_FILE="/mnt/hdd/mynode/.mynode_bitcoind_synced" QUICKSYNC_COMPLETE_FILE="$QUICKSYNC_DIR/.quicksync_complete" +IS_PREMIUM=0 PRODUCT_KEY="not_found" if [ -f $PRODUCT_KEY_FILE ]; then PRODUCT_KEY=$(cat $PRODUCT_KEY_FILE) + if [ ! -f /home/bitcoin/.mynode/.product_key_skipped ] && [ ! -f /mnt/hdd/mynode/settings/.product_key_skipped ]; then + if [ ! -f /home/bitcoin/.mynode/.product_key_error ] && [ ! -f /mnt/hdd/mynode/settings/.product_key_error ]; then + IS_PREMIUM=1 + fi + fi fi UPGRADE_DOWNLOAD_URL="http://www.mynodebtc.com/device_api/download_latest_standard.php?type=${DEVICE_TYPE}&product_key=${PRODUCT_KEY}&serial=${SERIAL_NUM}" diff --git a/setup/setup_device.sh b/setup/setup_device.sh index d72ac066..42197cb2 100755 --- a/setup/setup_device.sh +++ b/setup/setup_device.sh @@ -72,8 +72,8 @@ apt-get -y install toilet-fonts avahi-daemon figlet libsecp256k1-dev apt-get -y install inotify-tools libssl-dev tor tmux screen apt-get -y install python-grpcio python3-grpcio apt-get -y install pv sysstat network-manager rsync parted unzip pkg-config -apt-get -y install libfreetype6-dev libpng-dev libatlas-base-dev -apt-get -y install libffi-dev libssl-dev glances python3-bottle +apt-get -y install libfreetype6-dev libpng-dev libatlas-base-dev libgmp-dev +apt-get -y install libffi-dev libssl-dev glances python3-bottle automake libtool apt -y -qq install apt-transport-https ca-certificates @@ -93,7 +93,7 @@ pip install --upgrade wheel pip install speedtest-cli transmissionrpc flask python-bitcoinrpc redis prometheus_client requests pip install python-pam python-bitcoinlib psutil pip install grpcio grpcio-tools googleapis-common-protos -pip install tzupdate +pip install tzupdate virtualenv # Import Keys