From ea5187c93309687232712a9b2c79745015071b1d Mon Sep 17 00:00:00 2001 From: openoms <43343391+openoms@users.noreply.github.com> Date: Mon, 26 Feb 2024 11:06:00 +0000 Subject: [PATCH] joinmarket update to v0.9.11 (#145) * joinmarket update to v0.9.11 * remove deprecated install tweak * remove pyhton 3.7 support * stop using system-side PySide2 * don't install the QT Gui on ARM * format start.joininbox.sh * remove arm specific qtgui deps, no qtgui on build for arm * don't protect system packages from pip install * add libltdl-dev to apt-get packages --- build_joininbox.sh | 98 +++++++++++----------------- scripts/_functions.sh | 1 - scripts/install.joinmarket.sh | 37 +---------- scripts/start.joininbox.sh | 119 +++++++++++++++++----------------- 4 files changed, 99 insertions(+), 156 deletions(-) diff --git a/build_joininbox.sh b/build_joininbox.sh index 54d9421..9883eba 100644 --- a/build_joininbox.sh +++ b/build_joininbox.sh @@ -266,69 +266,38 @@ echo "##########" echo # apt dependencies for python apt-get install -y python3 virtualenv python3-venv python3-dev python3-wheel python3-jinja2 python3-pip -if [ "${cpu}" = "armv7l" ] || [ "${cpu}" = "armv6l" ]; then - if [ ! -f "/usr/bin/python3.7" ]; then - # install python37 - pythonVersion="3.7.9" - majorPythonVersion=$(echo "$pythonVersion" | awk -F. '{print $1"."$2}') - # dependencies - apt-get install software-properties-common build-essential libnss3-dev zlib1g-dev libgdbm-dev libncurses5-dev libssl-dev libffi-dev libreadline-dev libsqlite3-dev libbz2-dev -y - # download - wget --prefer-family=ipv4 --progress=bar:force https://www.python.org/ftp/python/${pythonVersion}/Python-${pythonVersion}.tgz - # optional signature for verification - wget --prefer-family=ipv4 --progress=bar:force https://www.python.org/ftp/python/${pythonVersion}/Python-${pythonVersion}.tgz.asc - # get PGP pubkey of Ned Deily (Python release signing key) - gpg --recv-key 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D - # check for: Good signature from "Pablo Galindo Salgado " - gpg --verify Python-${pythonVersion}.tgz.asc || exit 1 - # unzip - tar xvf Python-${pythonVersion}.tgz - cd Python-${pythonVersion} || exit 1 - # configure - ./configure --enable-optimizations - # install - make altinstall - # move the python binary to the expected directory - mv "$(which python${majorPythonVersion})" /usr/bin/ - # check - ls -la /usr/bin/python${majorPythonVersion} || exit 1 - # clean - cd .. - rm Python-${pythonVersion}.tgz - rm -rf Python-${pythonVersion} - fi - update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1 - echo "# python calls python3.7" - +if [ -f "/usr/bin/python3.8" ]; then + # use python 3.8 if available + update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 + echo "# python calls python3.8" +elif [ -f "/usr/bin/python3.9" ]; then + # use python 3.9 if available + update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1 + echo "# python calls python3.9" +elif [ -f "/usr/bin/python3.10" ]; then + # use python 3.10 if available + update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1 + echo "# python calls python3.10" +elif [ -f "/usr/bin/python3.11" ]; then + # use python 3.11 if available + update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1 + echo "# python calls python3.11" else - if [ -f "/usr/bin/python3.7" ]; then - # make sure /usr/bin/python exists (and calls Python3.7) - update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1 - echo "# python calls python3.7" - elif [ -f "/usr/bin/python3.8" ]; then - # use python 3.8 if available - update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 - echo "# python calls python3.8" - elif [ -f "/usr/bin/python3.9" ]; then - # use python 3.9 if available - update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1 - echo "# python calls python3.9" - elif [ -f "/usr/bin/python3.10" ]; then - # use python 3.10 if available - update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1 - echo "# python calls python3.10" - elif [ -f "/usr/bin/python3.11" ]; then - # use python 3.11 if available - update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1 - echo "# python calls python3.11" - else - echo "# FAIL- there is no tested version of python present" - exit 1 - fi + echo "# FAIL- there is no tested version of python present" + exit 1 fi # make sure /usr/bin/pip exists (and calls pip3) update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 + +# don't protect system packages from pip install +# tracking issue: https://github.com/raspiblitz/raspiblitz/issues/4170 +for PYTHONDIR in /usr/lib/python3.*; do + if [ -f "$PYTHONDIR/EXTERNALLY-MANAGED" ]; then + rm "$PYTHONDIR/EXTERNALLY-MANAGED" + fi +done + # setuptools needed for Nyx pip install setuptools @@ -359,6 +328,8 @@ apt-get install -y dialog apt-get install -y qrencode # unzip for the pruned node snapshot apt-get install -y unzip +# JoinMarket dependency https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/5bfa08c6f558458c9a93e8095ce9dc1b62412838/install.sh#L76C10-L76C21 +apt-get install -y libltdl-dev apt-get clean apt-get -y autoremove @@ -593,7 +564,6 @@ echo "#############" echo " if [ -f \"/home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate\" ]; then . /home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate - /home/joinmarket/joinmarket-clientserver/jmvenv/bin/python -c \"import PySide2\" cd /home/joinmarket/joinmarket-clientserver/scripts/ fi # shortcut commands @@ -616,10 +586,16 @@ echo "######################" echo "# Install JoinMarket" echo "######################" -qtgui=true + +if [ "${cpu}" = x86_64 ]; then + qtgui=true +else + # no qtgui on arm + qtgui=false +fi checkEntry=$(runuser joinmarket -c "cat /home/joinmarket/joinin.conf | grep -c qtgui") if [ ${checkEntry} -eq 0 ]; then - echo "qtgui=true" | tee -a /home/joinmarket/joinin.conf + echo "qtgui=$qtgui" | tee -a /home/joinmarket/joinin.conf fi if [ "$4" = "without-qt" ]; then qtgui="false" diff --git a/scripts/_functions.sh b/scripts/_functions.sh index fc68e64..781ea2f 100755 --- a/scripts/_functions.sh +++ b/scripts/_functions.sh @@ -23,7 +23,6 @@ fi function activateJMvenv() { . /home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate || exit 1 - /home/joinmarket/joinmarket-clientserver/jmvenv/bin/python -c "import PySide2" } function openMenuIfCancelled() { diff --git a/scripts/install.joinmarket.sh b/scripts/install.joinmarket.sh index 2251308..4a2248d 100755 --- a/scripts/install.joinmarket.sh +++ b/scripts/install.joinmarket.sh @@ -1,6 +1,7 @@ #!/bin/bash -testedJMversion="v0.9.10" +# https://github.com/JoinMarket-Org/joinmarket-clientserver/releases +testedJMversion="v0.9.11" PGPsigner="kristapsk" PGPpkeys="https://github.com/kristapsk.gpg" @@ -140,7 +141,6 @@ if [ "${user}" != "joinmarket" ]; then echo " if [ -f \"/home/${user}/joinmarket-clientserver/jmvenv/bin/activate\" ]; then . /home/${user}/joinmarket-clientserver/jmvenv/bin/activate - /home/${user}/joinmarket-clientserver/jmvenv/bin/python -c \"import PySide2\" cd /home/${user}/joinmarket-clientserver/scripts/ fi " | sudo -u ${user} tee -a /home/${user}/.bashrc @@ -158,14 +158,7 @@ fi # installJoinMarket [update|testPR |commit] function installJoinMarket() { - cpu=$(uname -m) cd /home/${user} || exit 1 - if [ "${qtgui}" = "true" ]; then - # PySide2 for armf: https://packages.debian.org/buster/python3-pyside2.qtcore - echo "# Installing ARM specific dependencies to run the QT GUI" - sudo apt-get install -y python3-pyside2.qtcore python3-pyside2.qtgui \ - python3-pyside2.qtwidgets zlib1g-dev libjpeg-dev python3-pyqt5 libltdl-dev - fi # https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/668#issuecomment-717815719 sudo apt-get install -y build-essential automake pkg-config libffi-dev python3-dev sudo -u ${user} pip install libtool asn1crypto cffi pycparser @@ -202,7 +195,7 @@ function installJoinMarket() { echo "# WARNING --> the PGP fingerprint is not as expected for ${PGPsigner}" echo "# Should contain PGP: ${PGPcheck}" echo "# PRESS ENTER to TAKE THE RISK if you think all is OK" - read key + read -r fi sudo -u ${user} gpg --import ./pgp_keys.asc @@ -232,30 +225,6 @@ function installJoinMarket() { fi # do not clear screen during installation sudo -u ${user} sed -i 's/clear//g' install.sh - # do not stop at installing Debian dependencies - sudo -u ${user} sed -i \ - "s#^ if ! sudo apt-get install \${deb_deps\[@\]}; then#\ - if ! sudo apt-get install -y \${deb_deps\[@\]}; then#g" install.sh - - if [ ${cpu} != "x86_64" ]; then - echo "# Make install.sh set up jmvenv with -- system-site-packages on arm" - # and import the PySide2 armf package from the system - sudo -u ${user} sed -i "s#^ virtualenv -p \"\${python}\" \"\${jm_source}/jmvenv\" || return 1#\ - virtualenv --system-site-packages -p \"\${python}\" \"\${jm_source}/jmvenv\" || return 1 ;\ - /home/${user}/joinmarket-clientserver/jmvenv/bin/python -c \'import PySide2\'\ - #g" install.sh - # don't install PySide2 - using the system-site-package instead - sudo -u ${user} sed -i "s#^PySide2.*##g" requirements/gui.txt - # don't install PyQt5 - using the system package instead - sudo -u ${user} sed -i "s#^PyQt5.*##g" requirements/gui.txt - sudo -u ${user} sed -i "s#PyQt5!=5.15.0,!=5.15.1,!=5.15.2,!=6.0##g" jmqtui/setup.py - fi - - # pin werkzeug dependency to 2.2.0 as in: - # https://github.com/JoinMarket-Org/joinmarket-clientserver/pull/1485/files - if ! grep 'werkzeug==' jmclient/setup.py; then - sed -i "s/autobahn==20.12.3/&', 'werkzeug==2.2.0/g" jmclient/setup.py - fi if [ "${qtgui}" = "false" ]; then GUIchoice="--without-qt" diff --git a/scripts/start.joininbox.sh b/scripts/start.joininbox.sh index d95fdcb..fd8dfa6 100755 --- a/scripts/start.joininbox.sh +++ b/scripts/start.joininbox.sh @@ -2,7 +2,7 @@ echo "# starting JoininBox ..." -if [ ! -f /home/joinmarket/joinin.conf ];then +if [ ! -f /home/joinmarket/joinin.conf ]; then touch /home/joinmarket/joinin.conf fi @@ -12,45 +12,44 @@ source /home/joinmarket/_functions.sh # FIRST RUN # ############# -setupStepEntry=$(grep -c "setupStep" < $joininConfPath) -if [ "$setupStepEntry" -eq 0 ];then - echo "setupStep=0" >> $joininConfPath +setupStepEntry=$(grep -c "setupStep" <$joininConfPath) +if [ "$setupStepEntry" -eq 0 ]; then + echo "setupStep=0" >>$joininConfPath fi source /home/joinmarket/joinin.conf -if [ "$setupStep" -lt 100 ];then - if [ "$setupStep" -lt 5 ];then +if [ "$setupStep" -lt 100 ]; then + if [ "$setupStep" -lt 5 ]; then # identify running env - runningEnvEntry=$(grep -c "runningEnv" < $joininConfPath) - if [ "$runningEnvEntry" -eq 0 ];then - if [ -f "/mnt/hdd/raspiblitz.conf" ];then + runningEnvEntry=$(grep -c "runningEnv" <$joininConfPath) + if [ "$runningEnvEntry" -eq 0 ]; then + if [ -f "/mnt/hdd/raspiblitz.conf" ]; then runningEnv="raspiblitz" - elif [ -f "/usr/share/mynode/mynode_config.sh" ];then + elif [ -f "/usr/share/mynode/mynode_config.sh" ]; then runningEnv="mynode" else runningEnv="standalone" fi - echo "runningEnv=$runningEnv" >> $joininConfPath - sed -i "s#setupStep=.*#setupStep=1#g" $joininConfPath + echo "runningEnv=$runningEnv" >>$joininConfPath + sed -i "s#setupStep=.*#setupStep=1#g" $joininConfPath fi echo "# running in the environment: $runningEnv" # identify cpu architecture - cpuEntry=$(grep -c "cpu" < $joininConfPath) - if [ "$cpuEntry" -eq 0 ];then + cpuEntry=$(grep -c "cpu" <$joininConfPath) + if [ "$cpuEntry" -eq 0 ]; then cpu=$(uname -m) - echo "cpu=$cpu" >> $joininConfPath - sed -i "s#setupStep=.*#setupStep=2#g" $joininConfPath + echo "cpu=$cpu" >>$joininConfPath + sed -i "s#setupStep=.*#setupStep=2#g" $joininConfPath fi echo "# cpu=${cpu}" # check Tor - torEntry=$(grep -c "runBehindTor" < $joininConfPath) - if [ "$torEntry" -eq 0 ];then + torEntry=$(grep -c "runBehindTor" <$joininConfPath) + if [ "$torEntry" -eq 0 ]; then torTest=$(curl --socks5 localhost:9050 --socks5-hostname localhost:9050 -s \ - https://check.torproject.org/ | cat | grep -m 1 Congratulations | xargs) - if [ "$torTest" = "Congratulations. This browser is configured to use Tor." ] - then + https://check.torproject.org/ | cat | grep -m 1 Congratulations | xargs) + if [ "$torTest" = "Congratulations. This browser is configured to use Tor." ]; then runBehindTor=on else runBehindTor=off @@ -59,65 +58,65 @@ if [ "$setupStep" -lt 100 ];then echo "# Press ENTER to continue without Tor or CTRL+C to cancel and try checking again with 'menu'" read key fi - echo "runBehindTor=$runBehindTor" >> $joininConfPath + echo "runBehindTor=$runBehindTor" >>$joininConfPath echo "# runBehindTor=$runBehindTor" fi # make sure Tor path is known - DirEntry=$(grep -c "HiddenServiceDir" < $joininConfPath) - if [ "$DirEntry" -eq 0 ];then - if [ -d "/mnt/hdd/tor" ];then + DirEntry=$(grep -c "HiddenServiceDir" <$joininConfPath) + if [ "$DirEntry" -eq 0 ]; then + if [ -d "/mnt/hdd/tor" ]; then HiddenServiceDir="/mnt/hdd/tor" else HiddenServiceDir="/var/lib/tor" fi - echo "HiddenServiceDir=$HiddenServiceDir" >> $joininConfPath - sed -i "s#setupStep=.*#setupStep=3#g" $joininConfPath + echo "HiddenServiceDir=$HiddenServiceDir" >>$joininConfPath + sed -i "s#setupStep=.*#setupStep=3#g" $joininConfPath fi # check for dialog - if [ "$(dialog | grep -c "ComeOn Dialog!")" -eq 0 ];then + if [ "$(dialog | grep -c "ComeOn Dialog!")" -eq 0 ]; then sudo apt-get install -y dialog fi # check for qrencode - if [ "$(qrencode -V 2>&1 | grep -c "not found")" -gt 0 ];then + if [ "$(qrencode -V 2>&1 | grep -c "not found")" -gt 0 ]; then sudo apt-get install -y qrencode fi - sed -i "s#setupStep=.*#setupStep=4#g" $joininConfPath + sed -i "s#setupStep=.*#setupStep=4#g" $joininConfPath # check if JoinMarket is installed - if [ "${runningEnv}" = raspiblitz ] && [ "$(lsb_release -sc)" = bullseye ]; then - # no qtgui for raspibliz on bullseye - /home/joinmarket/install.joinmarket.sh -i install -q 0 - else + if [ "${cpu}" = x86_64 ]; then /home/joinmarket/install.joinmarket.sh -i install + else + # no qtgui on arm + /home/joinmarket/install.joinmarket.sh -i install -q 0 fi - sed -i "s#setupStep=.*#setupStep=5#g" $joininConfPath + sed -i "s#setupStep=.*#setupStep=5#g" $joininConfPath fi # change the ssh password if standalone - if [ "$runningEnv" = "standalone" ];then + if [ "$runningEnv" = "standalone" ]; then source /home/joinmarket/joinin.conf - if [ "$setupStep" -lt 6 ];then + if [ "$setupStep" -lt 6 ]; then # set ssh passwords on the first run sudo /home/joinmarket/set.password.sh - sed -i "s#setupStep=.*#setupStep=6#g" $joininConfPath + sed -i "s#setupStep=.*#setupStep=6#g" $joininConfPath fi source /home/joinmarket/joinin.conf - if [ "$setupStep" -lt 7 ]&&[ ${cpu} != "x86_64" ];then + if [ "$setupStep" -lt 7 ] && [ ${cpu} != "x86_64" ]; then # expand SDcard partition on ARM sudo /home/joinmarket/standalone/expand.rootfs.sh fi fi generateJMconfig - sudo sed -i "s#setupStep=.*#setupStep=10#g" $joininConfPath + sudo sed -i "s#setupStep=.*#setupStep=10#g" $joininConfPath source /home/joinmarket/joinin.conf - if [ "$setupStep" -lt 11 ];then - if [ "$runningEnv" = "standalone" ];then + if [ "$setupStep" -lt 11 ]; then + if [ "$runningEnv" = "standalone" ]; then # open the config menu if standalone /home/joinmarket/menu.config.sh else # setup finished - sudo sed -i "s#setupStep=.*#setupStep=100#g" $joininConfPath + sudo sed -i "s#setupStep=.*#setupStep=100#g" $joininConfPath fi fi fi @@ -128,11 +127,11 @@ fi # check bitcoind RPC setting # add default value to joinin config if needed -if ! grep -Eq "^RPCoverTor=" $joininConfPath;then - echo "RPCoverTor=off" >> $joininConfPath +if ! grep -Eq "^RPCoverTor=" $joininConfPath; then + echo "RPCoverTor=off" >>$joininConfPath fi # check if bitcoin RPC connection is over Tor -if grep -Eq "^rpc_host = .*.onion" $JMcfgPath;then +if grep -Eq "^rpc_host = .*.onion" $JMcfgPath; then echo "# RPC over Tor is on" sed -i "s/^RPCoverTor=.*/RPCoverTor=on/g" $joininConfPath else @@ -142,14 +141,14 @@ fi # check if there is only one joinmarket wallet and make default # add default value to joinin config if needed -if ! grep -Eq "^defaultWallet=" $joininConfPath;then - echo "defaultWallet=off" >> $joininConfPath +if ! grep -Eq "^defaultWallet=" $joininConfPath; then + echo "defaultWallet=off" >>$joininConfPath fi -if [ "$(ls -p /home/joinmarket/.joinmarket/wallets/ | grep -cv /)" -gt 1 ];then +if [ "$(ls -p /home/joinmarket/.joinmarket/wallets/ | grep -cv /)" -gt 1 ]; then echo "# Found more than one wallet file" echo "# Setting defaultWallet to off" sed -i "s#^defaultWallet=.*#defaultWallet=off#g" $joininConfPath -elif [ "$(ls -p /home/joinmarket/.joinmarket/wallets/ | grep -cv /)" -eq 1 ];then +elif [ "$(ls -p /home/joinmarket/.joinmarket/wallets/ | grep -cv /)" -eq 1 ]; then onlyWallet=$(ls -p /home/joinmarket/.joinmarket/wallets/ | grep -v /) echo "# Found only one wallet file: $onlyWallet" echo "# Using it as default" @@ -157,25 +156,25 @@ elif [ "$(ls -p /home/joinmarket/.joinmarket/wallets/ | grep -cv /)" -eq 1 ];the fi # add default value to joinin config if needed -if ! grep -Eq "^network=" $joininConfPath;then - echo "network=unknown" >> $joininConfPath +if ! grep -Eq "^network=" $joininConfPath; then + echo "network=unknown" >>$joininConfPath fi -isMainnet=$(grep -c "network = mainnet" < $JMcfgPath) -isSignet=$(grep -c "network = signet" < $JMcfgPath) -isTestnet=$(grep -c "network = testnet" < $JMcfgPath) -if [ $isMainnet -gt 0 ];then +isMainnet=$(grep -c "network = mainnet" <$JMcfgPath) +isSignet=$(grep -c "network = signet" <$JMcfgPath) +isTestnet=$(grep -c "network = testnet" <$JMcfgPath) +if [ $isMainnet -gt 0 ]; then sed -i "s#^network=.*#network=mainnet#g" $joininConfPath -elif [ $isSignet -gt 0 ];then +elif [ $isSignet -gt 0 ]; then sed -i "s#^network=.*#network=signet#g" $joininConfPath -elif [ $isTestnet -gt 0 ];then +elif [ $isTestnet -gt 0 ]; then sed -i "s#^network=.*#network=testnet#g" $joininConfPath else sed -i "s#^network=.*#network=unknown#g" $joininConfPath fi # add default value to joinin config if needed -if ! grep -Eq "^localip=" $joininConfPath;then - echo "localip=unknown" >> $joininConfPath +if ! grep -Eq "^localip=" $joininConfPath; then + echo "localip=unknown" >>$joininConfPath fi localip=$(hostname -I | awk '{print $1}') sed -i "s#^localip=.*#localip=$localip#g" $joininConfPath