Skip to content

Commit

Permalink
Bitcoin Core update to v26.0 , add update option and display (#140)
Browse files Browse the repository at this point in the history
* add aliases bitcoinlog, bitcoinconf
* add bitcoin.update.sh
* add update option, display bitcoin core version
* bitcoin core update to v26.0
* add deprecatedrpc=create_bdb, update services
fixes #141
* ci: update arm64-rpi image
* ci: install qemu plugin for packer
* ci: add vnc
* menu updates
  • Loading branch information
openoms authored Dec 11, 2023
1 parent c240ba2 commit 8f61362
Show file tree
Hide file tree
Showing 10 changed files with 359 additions and 123 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
scripts/wallets
ci/arm64-rpi/.packer*
ci/arm64-rpi/joininbox-arm64-rpi*
ci/amd64/builds
114 changes: 21 additions & 93 deletions ci/amd64/debian/joininbox-amd64-debian.json
Original file line number Diff line number Diff line change
@@ -1,118 +1,46 @@
{
"variables": {
"iso_name": "debian-12.2.0-amd64-netinst.iso",
"iso_checksum": "23ab444503069d9ef681e3028016250289a33cc7bab079259b73100daee0af66",
"box_basename": "debian",
"build_directory": "../builds",
"cpus": "2",
"disk_size": "30000",
"headless": "false",
"http_directory": "{{template_dir}}/http",
"memory": "2048",
"mirror": "http://cdimage.debian.org/cdimage/release",
"mirror_directory": "current/amd64/iso-cd",
"name": "debian",
"preseed_path": "debian-9/preseed.cfg",
"qemu_display": "none",
"qemu_bios": "bios-256k.bin",
"template": "joininbox-amd64-debian",
"boot_command": "<esc><wait>install <wait> preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `preseed_path`}} <wait>debian-installer=en_US.UTF-8 <wait>auto <wait>locale=en_US.UTF-8 <wait>kbd-chooser/method=us <wait>keyboard-configuration/xkb-keymap=us <wait>netcfg/get_hostname={{ .Name }} <wait>netcfg/get_domain=vagrantup.com <wait>fb=false <wait>debconf/frontend=noninteractive <wait>console-setup/ask_detect=false <wait>console-keymaps-at/keymap=us <wait>grub-installer/bootdev=default <wait><enter><wait>",
"version": "TIMESTAMP"
},
"iso_name": "debian-12.2.0-amd64-netinst.iso",
"iso_checksum": "23ab444503069d9ef681e3028016250289a33cc7bab079259b73100daee0af66",
"box_basename": "debian",
"build_directory": "../builds",
"headless": "false",
"http_directory": "{{template_dir}}/http",
"name": "debian",
"preseed_path": "debian-9/preseed.cfg",
"qemu_bios": "bios-256k.bin",
"template": "joininbox-amd64-debian",
"boot_command": "<esc><wait>install <wait> preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `preseed_path`}} <wait>debian-installer=en_US.UTF-8 <wait>auto <wait>locale=en_US.UTF-8 <wait>kbd-chooser/method=us <wait>keyboard-configuration/xkb-keymap=us <wait>netcfg/get_hostname={{ .Name }} <wait>netcfg/get_domain=vagrantup.com <wait>fb=false <wait>debconf/frontend=noninteractive <wait>console-setup/ask_detect=false <wait>console-keymaps-at/keymap=us <wait>grub-installer/bootdev=default <wait><enter><wait>",
"memory": "2048"
},
"builders": [
{
"boot_command": "{{user `boot_command`}}",
"boot_wait": "5s",
"cpus": "{{ user `cpus` }}",
"disk_size": "{{user `disk_size`}}",
"cpus": "2",
"disk_size": "30000",
"headless": "{{ user `headless` }}",
"http_directory": "{{user `http_directory`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_url": "{{user `mirror`}}/{{user `mirror_directory`}}/{{user `iso_name`}}",
"iso_url": "http://cdimage.debian.org/cdimage/release/current/amd64/iso-cd/{{user `iso_name`}}",
"memory": "{{ user `memory` }}",
"output_directory": "{{ user `build_directory` }}/{{user `template`}}-qemu",
"shutdown_command": "echo 'joininbox' | sudo /sbin/shutdown -hP now",
"ssh_password": "joininbox",
"ssh_port": 22,
"ssh_port": "22",
"ssh_timeout": "10000s",
"ssh_username": "joinmarket",
"type": "qemu",
"format": "qcow2",
"vm_name": "{{ user `template` }}.qcow2",
"vnc_bind_address": "127.0.0.1",
"vnc_port_max": "5900",
"vnc_port_min": "5900",
"qemuargs": [
[ "-m", "{{ user `memory` }}" ],
[ "-bios", "{{ user `qemu_bios` }}" ],
[ "-display", "{{ user `qemu_display` }}" ]
[ "-display", "none" ]
]
},
{
"boot_command": "{{user `boot_command`}}",
"boot_wait": "5s",
"cpus": "{{ user `cpus` }}",
"disk_size": "{{user `disk_size`}}",
"guest_os_type": "Debian_64",
"hard_drive_interface": "sata",
"headless": "{{ user `headless` }}",
"http_directory": "{{user `http_directory`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_url": "{{user `mirror`}}/{{user `mirror_directory`}}/{{user `iso_name`}}",
"memory": "{{ user `memory` }}",
"output_directory": "{{ user `build_directory` }}/packer-{{user `template`}}-virtualbox",
"shutdown_command": "echo 'joininbox' | sudo -S /sbin/shutdown -hP now",
"ssh_password": "joininbox",
"ssh_port": 22,
"ssh_timeout": "10000s",
"ssh_username": "joinmarket",
"type": "virtualbox-iso",
"virtualbox_version_file": ".vbox_version",
"vm_name": "{{ user `template` }}"
},
{
"boot_command": "{{user `boot_command`}}",
"boot_wait": "5s",
"cpus": "{{ user `cpus` }}",
"disk_size": "{{user `disk_size`}}",
"guest_os_type": "debian8-64",
"headless": "{{ user `headless` }}",
"http_directory": "{{user `http_directory`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_url": "{{user `mirror`}}/{{user `mirror_directory`}}/{{user `iso_name`}}",
"memory": "{{ user `memory` }}",
"output_directory": "{{ user `build_directory` }}/packer-{{user `template`}}-vmware",
"shutdown_command": "echo 'joininbox' | sudo -S /sbin/shutdown -hP now",
"ssh_password": "joininbox",
"ssh_port": 22,
"ssh_timeout": "10000s",
"ssh_username": "joinmarket",
"tools_upload_flavor": "linux",
"type": "vmware-iso",
"vm_name": "{{ user `template` }}",
"vmx_data": {
"cpuid.coresPerSocket": "1",
"ethernet0.pciSlotNumber": "32"
},
"vmx_remove_ethernet_interfaces": true
},
{
"boot_command": "{{user `boot_command`}}",
"boot_wait": "5s",
"cpus": "{{ user `cpus` }}",
"disk_size": "{{user `disk_size`}}",
"guest_os_type": "debian",
"http_directory": "{{user `http_directory`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_url": "{{user `mirror`}}/{{user `mirror_directory`}}/{{user `iso_name`}}",
"memory": "{{ user `memory` }}",
"output_directory": "{{ user `build_directory` }}/packer-{{user `template`}}-parallels",
"parallels_tools_flavor": "lin",
"prlctl_version_file": ".prlctl_version",
"shutdown_command": "echo 'joininbox' | sudo -S /sbin/shutdown -hP now",
"ssh_password": "joininbox",
"ssh_port": 22,
"ssh_timeout": "10000s",
"ssh_username": "joinmarket",
"type": "parallels-iso",
"vm_name": "{{ user `template` }}"
}
],
"provisioners": [
Expand Down
5 changes: 4 additions & 1 deletion ci/amd64/packer.build.amd64-debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ else
echo "# Packer is installed"
fi

# Install qemu
# install qemu
echo "# Install qemu ..."
sudo apt-get update
sudo apt-get install -y qemu-system

# install qemu plugin
packer plugins install github.com/hashicorp/qemu

if [ $# -gt 0 ]; then
github_user=$1
else
Expand Down
4 changes: 2 additions & 2 deletions ci/arm64-rpi/arm64-rpi.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ variable "branch" {}

source "arm" "joininbox-arm64-rpi" {
file_checksum_type = "sha256"
file_checksum = "a68cd2bfe7831c438d8a5d832803ae0db17afec9f3cd370d9e8748c7b5456283"
file_checksum = "ace82f0d5e3586036cb72c5e46eb6222e93365503c51385496e3e2ee9999a5ad"
file_target_extension = "xz"
file_unarchive_cmd = ["xz", "--decompress", "$ARCHIVE_PATH"]
file_urls = ["https://raspi.debian.net/tested/20230612_raspi_4_bookworm.img.xz"]
file_urls = ["https://raspi.debian.net/tested/20231109_raspi_4_bookworm.img.xz"]
image_build_method = "resize"
image_chroot_env = ["PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin"]
image_partitions {
Expand Down
57 changes: 46 additions & 11 deletions scripts/_functions.bitcoincore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ joininConfPath="/home/joinmarket/joinin.conf"
function downloadBitcoinCore() {
# set version
# https://bitcoincore.org/en/download/
bitcoinVersion="25.0"
bitcoinVersion="26.0"

if bitcoin-cli --version | grep $bitcoinVersion >/dev/null; then
echo "# Bitcoin Core $bitcoinVersion is already installed"
Expand Down Expand Up @@ -39,7 +39,7 @@ function downloadBitcoinCore() {
echo
else
echo
echo "# BUILD FAILED --> the PGP verification failed / signature(${goodSignature}) "
echo "# BUILD FAILED --> the PGP verification failed"
exit 1
fi

Expand Down Expand Up @@ -155,25 +155,46 @@ function installSignet() {
Description=Bitcoin daemon on signet
[Service]
Environment='MALLOC_ARENA_MAX=1'
PIDFile=/home/joinmarket/bitcoin/bitcoind.pid
ExecStart=/home/joinmarket/bitcoin/bitcoind -signet -daemon \\
-datadir=/home/joinmarket/.bitcoin \\
-conf=/home/joinmarket/.bitcoin/bitcoin.conf \\
-pid=/home/joinmarket/bitcoin/bitcoind.pid
PermissionsStartOnly=true
# Process management
####################
Type=forking
Restart=on-failure
TimeoutStartSec=infinity
TimeoutStopSec=600
# Directory creation and permissions
####################################
# Run as joinmarket:joinmarket
User=joinmarket
Group=joinmarket
Type=forking
PIDFile=/home/joinmarket/bitcoin/bitcoind.pid
ExecStart=/home/joinmarket/bitcoin/bitcoind -signet -daemon \
-datadir=/home/joinmarket/.bitcoin \
-conf=/home/joinmarket/.bitcoin/bitcoin.conf \
-pid=/home/joinmarket/bitcoin/bitcoind.pid
Restart=always
TimeoutSec=120
RestartSec=30
StandardOutput=null
StandardError=journal
# Hardening measures
####################
# Provide a private /tmp and /var/tmp.
PrivateTmp=true
# Mount /usr, /boot/ and /etc read-only for the process.
ProtectSystem=full
# Deny access to /home, /root and /run/user
ProtectHome=true
# Disallow the process and all of its children to gain
# new privileges through execve().
NoNewPrivileges=true
# Use a new /dev namespace only populated with API pseudo devices
# such as /dev/null, /dev/zero and /dev/random.
PrivateDevices=true
# Deny the creation of writable and executable memory mappings.
MemoryDenyWriteExecute=true
[Install]
WantedBy=multi-user.target
Expand Down Expand Up @@ -310,6 +331,20 @@ function checkRPCwallet {
else
rpc_wallet=$1
fi
echo "# Check 'deprecatedrpc=create_bdb' in bitcoin.conf"
source ${joininConfPath}
if [ $runningEnv = standalone ]; then
bitcoinConfPath="/home/bitcoin/.bitcoin/bitcoin.conf"
elif [ $runningEnv = raspiblitz ]; then
bitcoinConfPath="/mnt/hdd/bitcoin/bitcoin.conf"
fi
if ! sudo grep -c "deprecatedrpc=create_bdb" "$bitcoinConfPath"; then
echo "# Place 'deprecatedrpc=create_bdb' in bitcoin.conf"
echo "deprecatedrpc=create_bdb" | sudo tee -a "$bitcoinConfPath"
echo "# Restarting bitcoind"
sudo systemctl restart bitcoind
fi

echo "# Making sure the set $rpc_wallet wallet is present in bitcoind"
trap 'rm -f "$connectionOutput"' EXIT
connectionOutput=$(mktemp -p /dev/shm/)
Expand Down
1 change: 1 addition & 0 deletions scripts/_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ currentJBcommit=$(cd /home/joinmarket/joininbox; git describe --tags)
currentJBtag=$(cd /home/joinmarket/joininbox; git tag | sort -V | tail -1)
currentJMversion=$(cd /home/joinmarket/joinmarket-clientserver 2>/dev/null; \
git describe --tags 2>/dev/null)
currentBTCversion=$(bitcoind --version | grep version)

# paths
walletPath="/home/joinmarket/.joinmarket/wallets/"
Expand Down
9 changes: 6 additions & 3 deletions scripts/menu.update.advanced.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
source /home/joinmarket/_functions.sh

# BASIC MENU INFO
HEIGHT=16
HEIGHT=18
WIDTH=60
CHOICE_HEIGHT=7
TITLE="Advanced update options"
MENU="
Current JoininBox version: $currentJBcommit
Current JoinMarket version: $currentJMversion"
Installed versions:
JoininBox $currentJBcommit
JoinMarket $currentJMversion
$currentBTCversion"

OPTIONS=()
BACKTITLE="JoininBox GUI"

Expand Down
26 changes: 21 additions & 5 deletions scripts/menu.update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,28 @@
source /home/joinmarket/_functions.sh

# BASIC MENU INFO
HEIGHT=12
HEIGHT=15
WIDTH=56
CHOICE_HEIGHT=3
CHOICE_HEIGHT=4
TITLE="Update options"
MENU="
Current JoininBox version: $currentJBcommit
Current JoinMarket version: $currentJMversion"
Installed versions:
JoininBox $currentJBcommit
JoinMarket $currentJMversion
$currentBTCversion"
OPTIONS=()
BACKTITLE="JoininBox GUI"

# Basic Options
OPTIONS+=(
JOININBOX "Update the JoininBox scripts and menu"
JOINMARKET "Update/reinstall JoinMarket to $(grep testedJMversion= < ~/install.joinmarket.sh | cut -d '"' -f 2)"
JOINMARKET "Update/reinstall JoinMarket to $(grep testedJMversion= < ~/install.joinmarket.sh | cut -d '"' -f 2)")

if [ "$runningEnv" = "standalone" ]; then
OPTIONS+=(\
BITCOIN "Update Bitcoin Core to a chosen version")
fi
OPTIONS+=(\
ADVANCED "Advanced update options")

CHOICE=$(dialog --clear \
Expand Down Expand Up @@ -47,6 +55,14 @@ case $CHOICE in
echo
echo "Press ENTER to return to the menu"
read key;;
BITCOIN)
/home/joinmarket/standalone/bitcoin.update.sh custom
errorOnInstall $?
echo
echo "# Start bitcoind .. "
sudo systemctl start bitcoind
echo "# Monitoring the bitcoind logs .. "
showBitcoinLogs;;
ADVANCED)
/home/joinmarket/menu.update.advanced.sh;;
esac
Loading

0 comments on commit 8f61362

Please sign in to comment.