This commit is contained in:
rootzoll
2022-01-07 22:33:35 +01:00
3 changed files with 49 additions and 29 deletions

View File

@@ -268,7 +268,7 @@ case $CHOICE in
/home/admin/config.scripts/bonus.specter.sh menu /home/admin/config.scripts/bonus.specter.sh menu
;; ;;
JM) JM)
sudo /home/admin/config.scripts/bonus.joinmarket.sh menu /home/admin/config.scripts/bonus.joinmarket.sh menu
;; ;;
FARADAY) FARADAY)
sudo /home/admin/config.scripts/bonus.faraday.sh menu sudo /home/admin/config.scripts/bonus.faraday.sh menu

View File

@@ -5,7 +5,8 @@
# https://github.com/openoms/bitcoin-tutorials/tree/master/joinmarket # https://github.com/openoms/bitcoin-tutorials/tree/master/joinmarket
# https://github.com/openoms/joininbox # https://github.com/openoms/joininbox
JBVERSION="v0.6.5" # with JoinMarket v0.9.4 # JBVERSION="v0.6.5" # with JoinMarket v0.9.4
JBVERSION="b0efe45" # dev
# command info # command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
@@ -15,18 +16,6 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
exit 1 exit 1
fi fi
PGPsigner="openoms"
PGPpubkeyLink="https://github.com/openoms.gpg"
PGPpubkeyFingerprint="13C688DB5B9C745DE4D2E4545BFB77609B081B65"
# check if sudo
if [ "$EUID" -ne 0 ]
then echo "Please run as root (with sudo)"
exit
fi
source /mnt/hdd/raspiblitz.conf
# show info menu # show info menu
if [ "$1" = "menu" ]; then if [ "$1" = "menu" ]; then
whiptail --title " JoinMarket info " --msgbox " whiptail --title " JoinMarket info " --msgbox "
@@ -38,6 +27,18 @@ https://github.com/openoms/bitcoin-tutorials/blob/master/joinmarket/README.md
exit 0 exit 0
fi fi
# check if sudo
if [ "$EUID" -ne 0 ]
then echo "Please run as root (with sudo)"
exit
fi
PGPsigner="openoms"
PGPpubkeyLink="https://github.com/openoms.gpg"
PGPpubkeyFingerprint="13C688DB5B9C745DE4D2E4545BFB77609B081B65"
source /mnt/hdd/raspiblitz.conf
# switch on # switch on
if [ "$1" = "1" ] || [ "$1" = "on" ]; then if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# INSTALL JOINMARKET" echo "# INSTALL JOINMARKET"
@@ -123,7 +124,6 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "AllowOutboundLocalhost 1" | sudo tee -a /etc/tor/torsocks.conf echo "AllowOutboundLocalhost 1" | sudo tee -a /etc/tor/torsocks.conf
sudo systemctl reload tor@default sudo systemctl reload tor@default
fi fi
# joinin.conf settings # joinin.conf settings
sudo -u joinmarket touch /home/joinmarket/joinin.conf sudo -u joinmarket touch /home/joinmarket/joinin.conf
# add default Tor value to joinin.conf if needed # add default Tor value to joinin.conf if needed
@@ -134,6 +134,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
if grep -Eq "^runBehindTor=on" /mnt/hdd/raspiblitz.conf; then if grep -Eq "^runBehindTor=on" /mnt/hdd/raspiblitz.conf; then
sudo -u joinmarket sed -i "s/^runBehindTor=.*/runBehindTor=on/g" /home/joinmarket/joinin.conf sudo -u joinmarket sed -i "s/^runBehindTor=.*/runBehindTor=on/g" /home/joinmarket/joinin.conf
fi fi
echo echo
echo "##########" echo "##########"
echo "# Extras #" echo "# Extras #"
@@ -166,10 +167,11 @@ if [ -z \"\$TMUX\" ]; then
fi fi
" | sudo -u joinmarket tee -a /home/joinmarket/.bashrc " | sudo -u joinmarket tee -a /home/joinmarket/.bashrc
echo "######################" echo "##############################################"
echo "# Install JoinMarket #" echo "# Install JoinMarket and configure JoininBox #"
echo "######################" echo "##############################################"
sudo -u joinmarket /home/joinmarket/install.joinmarket.sh install echo
sudo -u joinmarket /home/joinmarket/start.joininbox.sh
else else
echo "JoinMarket is already installed" echo "JoinMarket is already installed"

View File

@@ -49,7 +49,7 @@ function install() {
fi fi
} }
if [ $1 = on ];then if [ "$1" = on ];then
install install
@@ -74,6 +74,15 @@ if [ $1 = on ];then
--lightning-dir /home/bitcoin/.lightning/${CLNETWORK} \ --lightning-dir /home/bitcoin/.lightning/${CLNETWORK} \
file:///home/bitcoin/${netprefix}lightningd.sqlite3.backup file:///home/bitcoin/${netprefix}lightningd.sqlite3.backup
if [ $(crontab -u admin -l | grep -c "backup-compact $CHAIN") -eq 0 ]; then
echo "Add weekly backup-compact as a cronjob"
cronjob="@weekly /home/admin/cl-plugin.backup.sh backup-compact $CHAIN"
(crontab -u admin -l; echo "$cronjob" ) | crontab -u admin -
fi
echo "# The crontab for admin now is:"
crontab -u admin -l
echo
source <(/home/admin/_cache.sh get state) source <(/home/admin/_cache.sh get state)
if [ "${state}" == "ready" ]; then if [ "${state}" == "ready" ]; then
sudo systemctl start ${netprefix}lightningd sudo systemctl start ${netprefix}lightningd
@@ -81,7 +90,7 @@ if [ $1 = on ];then
fi fi
elif [ $1 = off ];then elif [ "$1" = off ];then
echo "# Removing the backup plugin" echo "# Removing the backup plugin"
sudo rm -f /home/bitcoin/${netprefix}cl-plugins-enabled/backup.py sudo rm -f /home/bitcoin/${netprefix}cl-plugins-enabled/backup.py
echo "# Backup the existing old backup on the SDcard" echo "# Backup the existing old backup on the SDcard"
@@ -92,7 +101,7 @@ elif [ $1 = off ];then
sudo rm -f /home/bitcoin/.lightning/${CLNETWORK}/backup.lock sudo rm -f /home/bitcoin/.lightning/${CLNETWORK}/backup.lock
elif [ $1 = restore ];then elif [ "$1" = restore ];then
install install
@@ -128,15 +137,24 @@ elif [ $1 = restore ];then
fi fi
elif [ $1 = backup-compact ];then elif [ "$1" = backup-compact ];then
# https://github.com/lightningd/plugins/tree/master/backup#performing-backup-compaction
if sudo ls /home/bitcoin/.lightning/${CLNETWORK}/lightningd.sqlite3;then dbPath="/home/bitcoin/.lightning/${CLNETWORK}/lightningd.sqlite3"
# https://github.com/lightningd/plugins/tree/master/backup#performing-backup-compaction backupPath="/home/bitcoin/${netprefix}lightningd.sqlite3.backup"
echo "# Running $lightning-cli backup-compact ..."
$lightningcli_alias backup-compact
if sudo ls "${dbPath}" >/dev/null; then
dbSize=$(sudo du -m "${dbPath}" | awk '{print $1}')
echo "$dbSize MB $dbPath"
backupSize=$(sudo du -m "${backupPath}" | awk '{print $1}')
echo "$backupSize MB $backupPath"
if [ "$backupSize" -gt $((dbSize+200)) ] ; then
echo "# The backup is 200MB+ larger than the db, running '${netprefix}lightning-cli backup-compact' ..."
$lightningcli_alias backup-compact
else
echo "The backup is not significantly larger than the db, there is no need to compact."
fi
else else
echo "# No /home/bitcoin/.lightning/${CLNETWORK}/lightningd.sqlite3 is present" echo "# No ${dbPath} is present"
echo "# Run 'config.scripts/cl-plugin.backup.sh on ${CLNETWORK}' first" echo "# Run 'config.scripts/cl-plugin.backup.sh on ${CLNETWORK}' first"
fi fi