Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP signet support #22

Merged
merged 9 commits into from
Feb 10, 2021
14 changes: 7 additions & 7 deletions build_joininbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,15 @@ echo "############################"
echo "# Preparing the base image #"
echo "############################"
echo
if [ "${baseImage}" = "raspbian" ] || [ "${baseImage}" = "dietpi" ]; then
if [ "${baseImage}" = "raspbian" ]||[ "${baseImage}" = "dietpi" ]||\
[ "${baseImage}" = "buster" ]; then
# fixing locales for build
# https://github.com/rootzoll/raspiblitz/issues/138
# https://daker.me/2014/10/how-to-fix-perl-warning-setting-locale-failed-in-raspbian.html
# https://stackoverflow.com/questions/38188762/generate-all-locales-in-a-docker-image
echo ""
echo
echo "# FIXING LOCALES FOR BUILD "
sudo apt install -y locales
sudo sed -i "s/^# en_US.UTF-8 UTF-8.*/en_US.UTF-8 UTF-8/g" /etc/locale.gen
sudo sed -i "s/^# en_US ISO-8859-1.*/en_US ISO-8859-1/g" /etc/locale.gen
sudo locale-gen
Expand All @@ -110,6 +112,9 @@ if [ "${baseImage}" = "raspbian" ] || [ "${baseImage}" = "dietpi" ]; then
sudo sed -i "s/^ SendEnv LANG LC.*/# SendEnv LANG LC_*/g" /etc/ssh/ssh_config
# remove unnecessary files
sudo rm -rf /home/pi/MagPi
# https://www.reddit.com/r/linux/comments/lbu0t1/microsoft_repo_installed_on_all_raspberry_pis/
sudo rm -f /etc/apt/sources.list.d/vscode.list
sudo rm -f /etc/apt/trusted.gpg.d/microsoft.gpg
fi

if [ -f "/usr/bin/python3.7" ]; then
Expand Down Expand Up @@ -229,11 +234,6 @@ echo "##########################"
echo "# Tools and dependencies #"
echo "##########################"
echo
if [ "${baseImage}" = "buster" ]||[ "${baseImage}" = "bionic" ]||\
[ "${baseImage}" = "focal" ]; then
# add armbian config
sudo apt install armbian-config -y
fi
sudo apt-get install -y htop git curl bash-completion vim jq bsdmainutils
# prepare for display graphics mode
# see https://github.com/rootzoll/raspiblitz/pull/334
Expand Down
5 changes: 4 additions & 1 deletion scripts/_commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@ function stats() {
function qtgui() {
echo "# opening the JoinMarket-QT GUI with the command: '(jmvenv) python joinmarket-qt.py'"
/home/joinmarket/joinmarket-clientserver/jmvenv/bin/python /home/joinmarket/joinmarket-clientserver/scripts/joinmarket-qt.py
}
}

alias signet-cli="/home/joinmarket/bitcoin/bitcoin-cli -signet"
alias signetd="/home/joinmarket/bitcoin/bitcoind -signet"
59 changes: 41 additions & 18 deletions scripts/_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ function YGuptime() {
JMUptime=$(printf '%dd:%dh:%dm\n' $((JMUptimeInSeconds/86400)) $((JMUptimeInSeconds%86400/3600)) $((JMUptimeInSeconds%3600/60)))
}


# installJoinMarket [update|testPR <PRnumber>|commit]
function installJoinMarket() {
source /home/joinmarket/joinin.conf
Expand Down Expand Up @@ -224,6 +223,14 @@ function installJoinMarket() {
echo "# installed JoinMarket $JMVersion"
}

# copyJoininboxScripts
function copyJoininboxScripts() {
echo "# Copying the scripts in place"
sudo -u joinmarket cp /home/joinmarket/joininbox/scripts/*.* /home/joinmarket/
sudo -u joinmarket cp /home/joinmarket/joininbox/scripts/.* /home/joinmarket/ 2>/dev/null
sudo -u joinmarket chmod +x /home/joinmarket/*.sh
}

# updateJoininBox <reset|commit>
function updateJoininBox() {
cd /home/joinmarket
Expand Down Expand Up @@ -262,40 +269,56 @@ function updateJoininBox() {
fi
sudo -u joinmarket git reset --hard $TAG
echo "# Updated to version" $TAG
echo "# Copying the scripts in place"
sudo -u joinmarket cp /home/joinmarket/joininbox/scripts/*.* /home/joinmarket/
sudo -u joinmarket cp /home/joinmarket/joininbox/scripts/.* /home/joinmarket/ 2>/dev/null
sudo -u joinmarket chmod +x /home/joinmarket/*.sh
copyJoininboxScripts
}

function setIRCtoTor() {
#communicate with IRC servers via Tor
sed -i "s/^host = irc.darkscience.net/#host = irc.darkscience.net/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sed -i "s/^#host = darksci3bfoka7tw.onion/host = darksci3bfoka7tw.onion/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sed -i "s/^host = irc.hackint.org/#host = irc.hackint.org/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sed -i "s/^#host = ncwkrwxpq2ikcngxq3dy2xctuheniggtqeibvgofixpzvrwpa77tozqd.onion/host = ncwkrwxpq2ikcngxq3dy2xctuheniggtqeibvgofixpzvrwpa77tozqd.onion/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sed -i "s/^socks5 = false/#socks5 = false/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sed -i "s/^#socks5 = true/socks5 = true/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sed -i "s/^#port = 6667/port = 6667/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sed -i "s/^#usessl = false/usessl = false/g" /home/joinmarket/.joinmarket/joinmarket.cfg
echo "# Edited the joinmarket.cfg to communicate over Tor only."
source /home/joinmarket/joinin.conf
if [ "${runBehindTor}" = "on" ]; then
sed -i "s/^host = irc.darkscience.net/#host = irc.darkscience.net/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sed -i "s/^#host = darksci3bfoka7tw.onion/host = darksci3bfoka7tw.onion/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sed -i "s/^host = irc.hackint.org/#host = irc.hackint.org/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sed -i "s/^#host = ncwkrwxpq2ikcngxq3dy2xctuheniggtqeibvgofixpzvrwpa77tozqd.onion/host = ncwkrwxpq2ikcngxq3dy2xctuheniggtqeibvgofixpzvrwpa77tozqd.onion/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sed -i "s/^socks5 = false/#socks5 = false/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sed -i "s/^#socks5 = true/socks5 = true/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sed -i "s/^#port = 6667/port = 6667/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sed -i "s/^#usessl = false/usessl = false/g" /home/joinmarket/.joinmarket/joinmarket.cfg
echo "# Edited the joinmarket.cfg to communicate over Tor only."
else
echo "# Tor is not active, will communicate with IRC servers via clearnet"
fi
}

function generateJMconfig() {
if [ ! -f "/home/joinmarket/.joinmarket/joinmarket.cfg" ] ; then
echo "# Generating the joinmarket.cfg"
echo "# Generating joinmarket.cfg with default settings"
echo
. /home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate &&\
cd /home/joinmarket/joinmarket-clientserver/scripts/
python wallet-tool.py generate --datadir=/home/joinmarket/.joinmarket
else
echo "# The joinmarket.cfg is present"
echo ""
echo
fi
setIRCtoTor
# set strict permission to joinmarket.cfg
sudo chmod 600 /home/joinmarket/.joinmarket/joinmarket.cfg || exit 1
}

#backupJMconf
function backupJMconf() {
if [ -f "/home/joinmarket/.joinmarket/joinmarket.cfg" ] ; then
now=$(date +"%Y_%m_%d_%H%M%S")
echo "# Moving the joinmarket.cfg to the filename joinmarket.cfg.backup$now"
mv /home/joinmarket/.joinmarket/joinmarket.cfg \
/home/joinmarket/.joinmarket/joinmarket.cfg.backup$now
echo
else
echo "# The joinmarket.cfg is not present"
echo
fi
}

# updateTor
function updateTor() {
# as in https://2019.www.torproject.org/docs/debian#source
Expand Down Expand Up @@ -346,4 +369,4 @@ deb-src https://deb.torproject.org/torproject.org tor-nightly-master-$distro mai
sudo systemctl start tor
echo "# Installed $(tor --version)"
fi
}
}
8 changes: 0 additions & 8 deletions scripts/install.joinmarket.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,14 @@ source /home/joinmarket/_functions.sh
source /home/joinmarket/joinin.conf

if [ "$1" = "config" ]; then

generateJMconfig

if [ "${runBehindTor}" = "on" ]; then
setIRCtoTor
fi

# show info
dialog \
--title "Configure JoinMarket" \
--exit-label "Continue to edit the joinmarket.cfg" \
--textbox "info.conf.txt" 21 102

# edit joinmarket.cfg
/home/joinmarket/set.conf.sh /home/joinmarket/.joinmarket/joinmarket.cfg

exit 0
fi

Expand Down
Loading