From fc3e166e5061b6c916437b44257a01fb0630ba60 Mon Sep 17 00:00:00 2001 From: openoms Date: Sat, 9 Dec 2023 11:33:41 +0100 Subject: [PATCH 1/9] add aliases bitcoinlog, bitcoinconf --- scripts/standalone/_functions.standalone.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/standalone/_functions.standalone.sh b/scripts/standalone/_functions.standalone.sh index 32f909a..3935894 100755 --- a/scripts/standalone/_functions.standalone.sh +++ b/scripts/standalone/_functions.standalone.sh @@ -247,10 +247,18 @@ WantedBy=multi-user.target echo "# OK - the bitcoind.service is now enabled" # add aliases - if [ $(alias | grep -c "sudo -u bitcoin /home/bitcoin/bitcoin/bitcoin-cli") -eq 0 ]; then + if ! grep "alias bitcoin-cli" /home/joinmarket/_aliases.sh; then sudo bash -c "echo 'alias bitcoin-cli=\"sudo -u bitcoin /home/bitcoin/bitcoin/bitcoin-cli\"' >> /home/joinmarket/_aliases.sh" + fi + if ! grep "alias bitcoind" /home/joinmarket/_aliases.sh; then sudo bash -c "echo 'alias bitcoind=\"sudo -u bitcoin /home/bitcoin/bitcoin/bitcoind\"' >> /home/joinmarket/_aliases.sh" fi + if ! grep "alias bitcoinlog" /home/joinmarket/_aliases.sh; then + sudo bash -c "echo 'alias bitcoinlog=\"sudo tail -f /home/bitcoin/.bitcoin/debug.log\"' >> /home/joinmarket/_aliases.sh" + fi + if ! grep "alias bitcoinconf" /home/joinmarket/_aliases.sh; then + sudo bash -c "echo 'alias bitcoinconf=\"sudo nano /home/bitcoin/.bitcoin/bitcoin.conf\"' >> /home/joinmarket/_aliases.sh" + fi # set joinin.conf value /home/joinmarket/set.value.sh set network mainnet ${joininConfPath} From 806d930ea6866d5474c706b062b2587aca2d1d3e Mon Sep 17 00:00:00 2001 From: openoms Date: Sat, 9 Dec 2023 11:39:42 +0100 Subject: [PATCH 2/9] add bitcoin.update.sh --- scripts/standalone/bitcoin.update.sh | 219 +++++++++++++++++++++++++++ 1 file changed, 219 insertions(+) create mode 100644 scripts/standalone/bitcoin.update.sh diff --git a/scripts/standalone/bitcoin.update.sh b/scripts/standalone/bitcoin.update.sh new file mode 100644 index 0000000..23aea08 --- /dev/null +++ b/scripts/standalone/bitcoin.update.sh @@ -0,0 +1,219 @@ +#!/bin/bash + +# command info +if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then + echo "Interim optional Bitcoin Core updates." + echo "bitcoin.update.sh [info|tested|reckless|custom]" + echo "info -> get actual state and possible actions" + echo "tested -> only do a tested update by the RaspiBlitz team" + echo "reckless -> the update was not tested by the RaspiBlitz team" + echo "custom -> update to a chosen version" + echo " the binary checksum and signatures will be checked in all cases" + echo " except when 'skipverify' is used" + echo + exit 1 +fi + +echo "# Running: bitcoin.update.sh $*" + +# 1. parameter [info|tested|reckless] +mode="$1" + +# RECOMMENDED UPDATE BY RASPIBLITZ TEAM (just possible once per sd card update) +# comment will be shown as "BEWARE Info" when option is choosen (can be multiple lines) +bitcoinVersion="" # example: 22.0 .. keep empty if no newer version as sd card build is available + +# GATHER DATA +# setting download directory to the current user +downloadDir="/home/$(whoami)/download/bitcoin.update" + +# bitcoinOSversion +if [ "$(uname -m | grep -c 'arm')" -gt 0 ]; then + bitcoinOSversion="arm-linux-gnueabihf" +elif [ "$(uname -m | grep -c 'aarch64')" -gt 0 ]; then + bitcoinOSversion="aarch64-linux-gnu" +elif [ "$(uname -m | grep -c 'x86_64')" -gt 0 ]; then + bitcoinOSversion="x86_64-linux-gnu" +fi + +# installed version +installedVersion=$(sudo -u bitcoin /home/bitcoin/bitcoin/bitcoind --version | head -n1 | cut -d" " -f4 | cut -c 2-) + +# test if the installed version already the tested/recommended update version +bitcoinUpdateInstalled=$(echo "${installedVersion}" | grep -c "${bitcoinVersion}") + +# get latest release from GitHub releases +bitcoinLatestVersion=$(curl --header "X-GitHub-Api-Version:2022-11-28" -s https://api.github.com/repos/bitcoin/bitcoin/releases | jq -r '.[].tag_name' | sort | tail -n1 | cut -c 2-) + +# INFO +function displayInfo() { + echo "# basic data" + echo "installedVersion='${installedVersion}'" + echo "bitcoinOSversion='${bitcoinOSversion}'" + + echo "# the tested/recommended update option" + echo "bitcoinUpdateInstalled='${bitcoinUpdateInstalled}'" + echo "bitcoinVersion='${bitcoinVersion}'" + + echo "# reckless update option (latest Bitcoin Core release from GitHub)" + echo "bitcoinLatestVersion='${bitcoinLatestVersion}'" +} + +if [ "${mode}" = "info" ]; then + displayInfo + exit 1 +fi + +# tested +if [ "${mode}" = "tested" ]; then + + echo "# bitcoin.update.sh tested" + +elif [ "${mode}" = "reckless" ]; then + # RECKLESS + # this mode is just for people running test and development nodes - its not recommended + # for production nodes. In a update/recovery scenario it will not install a fixed version + # it will always pick the latest release from the github + echo "# bitcoin.update.sh reckless" + bitcoinVersion=${bitcoinLatestVersion} + pathVersion=${bitcoinVersion} + +elif [ "${mode}" = "custom" ]; then + if [ $# -gt 1 ]; then + bitcoinVersion="$2" + else + clear + echo + echo "# Update Bitcoin Core to a chosen version." + echo + echo "# Input the version you would like to install and press ENTER." + echo "# Examples (versions below 22.1 are not supported):" + echo "24.0.1" + echo "26.0" + echo + read bitcoinVersion + fi + + if [ $(echo ${bitcoinVersion} | grep -c "rc") -gt 0 ]; then + cutVersion=$(echo ${bitcoinVersion} | awk -F"r" '{print $1}') + rcVersion=$(echo ${bitcoinVersion} | awk -F"r" '{print $2}') + # https://bitcoincore.org/bin/bitcoin-core-22.0/test.rc3/ + pathVersion=${cutVersion}/test.r${rcVersion} + else + pathVersion=${bitcoinVersion} + fi + + if curl --output /dev/null --silent --head --fail \ + https://bitcoincore.org/bin/bitcoin-core-${pathVersion}/SHA256SUMS.asc; then + echo "# OK version exists at https://bitcoincore.org/bin/bitcoin-core-${pathVersion}" + if [ "${mode}" = "custom" ] && [ "$3" = "skipverify" ]; then + echo "# skipping signature verification" + fi + echo "# Press ENTER to proceed to install Bitcoin Core $bitcoinVersion or CTRL+C to abort." + read key + else + echo "# FAIL $bitcoinVersion does not exist" + echo + echo "# Press ENTER to return to the main menu" + read key + exit 0 + fi +fi + +# JOINED INSTALL +if [ "${mode}" = "tested" ] || [ "${mode}" = "reckless" ] || [ "${mode}" = "custom" ]; then + + displayInfo + + if [ "$installedVersion" = "$bitcoinVersion" ]; then + echo "# installedVersion = bitcoinVersion" + echo "# exiting script" + exit 0 + fi + + echo + echo "# clean & change into download directory" + sudo rm -rf "${downloadDir}" + mkdir -p "${downloadDir}" + cd "${downloadDir}" || exit 1 + + echo "# Receive signer keys" + curl -s "https://api.github.com/repos/bitcoin-core/guix.sigs/contents/builder-keys" | + jq -r '.[].download_url' | while read url; do curl -s "$url" | gpg --import; done + + # download signed binary sha256 hash sum file + wget --prefer-family=ipv4 --progress=bar:force -O SHA256SUMS https://bitcoincore.org/bin/bitcoin-core-${bitcoinVersion}/SHA256SUMS + # download the signed binary sha256 hash sum file and check + wget --prefer-family=ipv4 --progress=bar:force -O SHA256SUMS.asc https://bitcoincore.org/bin/bitcoin-core-${bitcoinVersion}/SHA256SUMS.asc + + if [ "${mode}" = "custom" ] && [ "$3" = "skipverify" ]; then + echo "# skipping signature verification" + echo "# display the output of 'gpg --verify SHA256SUMS.asc'" + gpg --verify SHA256SUMS.asc + else + if gpg --verify SHA256SUMS.asc; then + echo + echo "****************************************" + echo "OK --> BITCOIN MANIFEST IS CORRECT" + echo "****************************************" + echo + else + echo + echo "# BUILD FAILED --> the PGP verification failed" + echo "# try again or with a different version" + echo "# if you want to skip verifying all signatures (and just show them) use the command:" + echo "# /home/admin/config.scripts/bonus.bitcoin.sh custom ${bitcoinVersion:-} skipverify" + exit 1 + fi + fi + + echo "# Downloading Bitcoin Core v${bitcoinVersion} for ${bitcoinOSversion} ..." + binaryName="bitcoin-${bitcoinVersion}-${bitcoinOSversion}.tar.gz" + wget https://bitcoincore.org/bin/bitcoin-core-${pathVersion}/${binaryName} + if [ ! -f "./${binaryName}" ]; then + echo "# FAIL # Downloading BITCOIN BINARY did not succeed." + exit 1 + fi + + echo "# Checking the binary checksum ..." + if ! sha256sum -c --ignore-missing SHA256SUMS; then + # get the sha256 value for the corresponding platform from signed hash sum file + bitcoinSHA256=$(grep -i "${binaryName}}" SHA256SUMS | cut -d " " -f1) + echo "# FAIL # Downloaded BITCOIN BINARY CHECKSUM:" + echo "$(sha256sum ${binaryName})" + echo "NOT matching SHA256 checksum:" + echo "${bitcoinSHA256}" + exit 1 + else + echo + echo "# OK --> VERIFIED BITCOIN CORE BINARY CHECKSUM IS CORRECT" + echo + fi +fi + +# JOINED INSTALL +if [ "${mode}" = "tested" ] || [ "${mode}" = "reckless" ] || [ "${mode}" = "custom" ]; then + + # install + echo "# Stopping bitcoind ..." + sudo systemctl stop bitcoind 2>/dev/null + sudo systemctl stop tbitcoind 2>/dev/null + sudo systemctl stop sbitcoind 2>/dev/null + echo + echo "# Installing Bitcoin Core v${bitcoinVersion}" + tar -xvf ${binaryName} + sudo install -m 0755 -o root -g root -t /home/bitcoin/bitcoin/ bitcoin-${bitcoinVersion}/bin/* + sleep 3 + if ! sudo /home/bitcoin/bitcoin/bitcoind --version | grep "${bitcoinVersion}"; then + echo + echo "# BUILD FAILED --> Was not able to install bitcoind version(${bitcoinVersion})" + exit 1 + fi + + echo "# OK Bitcoin Core ${bitcoinVersion} is installed" + exit 0 + +else + echo "# error='parameter not known'" + exit 1 +fi From b6457fdcc8c810714409f56bcb07b6d5c7714a1e Mon Sep 17 00:00:00 2001 From: openoms Date: Sat, 9 Dec 2023 11:40:31 +0100 Subject: [PATCH 3/9] add update option, display bitcoin core version --- scripts/_functions.bitcoincore.sh | 2 +- scripts/_functions.sh | 1 + scripts/menu.update.advanced.sh | 9 ++++++--- scripts/menu.update.sh | 22 ++++++++++++++++++---- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/scripts/_functions.bitcoincore.sh b/scripts/_functions.bitcoincore.sh index 5ab5b5c..ddc9af1 100755 --- a/scripts/_functions.bitcoincore.sh +++ b/scripts/_functions.bitcoincore.sh @@ -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 diff --git a/scripts/_functions.sh b/scripts/_functions.sh index c7541b6..fc68e64 100755 --- a/scripts/_functions.sh +++ b/scripts/_functions.sh @@ -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/" diff --git a/scripts/menu.update.advanced.sh b/scripts/menu.update.advanced.sh index b429c7e..227e667 100755 --- a/scripts/menu.update.advanced.sh +++ b/scripts/menu.update.advanced.sh @@ -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" diff --git a/scripts/menu.update.sh b/scripts/menu.update.sh index 071f0ce..f6b0951 100755 --- a/scripts/menu.update.sh +++ b/scripts/menu.update.sh @@ -3,20 +3,28 @@ source /home/joinmarket/_functions.sh # BASIC MENU INFO -HEIGHT=12 +HEIGHT=14 WIDTH=56 CHOICE_HEIGHT=3 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 \ @@ -47,6 +55,12 @@ case $CHOICE in echo echo "Press ENTER to return to the menu" read key;; + BITCOIN) + /home/joinmarket/bitcoin.update.sh custom + errorOnInstall $? + echo + echo "Press ENTER to return to the menu" + read key;; ADVANCED) /home/joinmarket/menu.update.advanced.sh;; esac From 29ddff777f2d782556353d54b221bfb76e84b70a Mon Sep 17 00:00:00 2001 From: openoms Date: Sat, 9 Dec 2023 11:48:19 +0100 Subject: [PATCH 4/9] bitcoin core update to v26.0 --- scripts/_functions.bitcoincore.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_functions.bitcoincore.sh b/scripts/_functions.bitcoincore.sh index ddc9af1..4ddda9c 100755 --- a/scripts/_functions.bitcoincore.sh +++ b/scripts/_functions.bitcoincore.sh @@ -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" From 0d6e18b9226b55f38c9308e55c8745a5a94630d4 Mon Sep 17 00:00:00 2001 From: openoms Date: Sat, 9 Dec 2023 13:02:55 +0100 Subject: [PATCH 5/9] add deprecatedrpc=create_bdb, update services fixes #141 --- scripts/_functions.bitcoincore.sh | 53 +++++++++++++++++---- scripts/standalone/_functions.standalone.sh | 36 +++++++++++--- 2 files changed, 73 insertions(+), 16 deletions(-) diff --git a/scripts/_functions.bitcoincore.sh b/scripts/_functions.bitcoincore.sh index 4ddda9c..3952d4d 100755 --- a/scripts/_functions.bitcoincore.sh +++ b/scripts/_functions.bitcoincore.sh @@ -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 @@ -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/) diff --git a/scripts/standalone/_functions.standalone.sh b/scripts/standalone/_functions.standalone.sh index 3935894..d80d2eb 100755 --- a/scripts/standalone/_functions.standalone.sh +++ b/scripts/standalone/_functions.standalone.sh @@ -220,24 +220,46 @@ function installMainnet() { echo " [Unit] Description=Bitcoin daemon on mainnet + [Service] +Environment='MALLOC_ARENA_MAX=1' +PIDFile=/home/bitcoin/bitcoin/bitcoind.pid +ExecStart=/home/bitcoin/bitcoin/bitcoind -daemon \\ + -pid=/home/bitcoin/bitcoin/bitcoind.pid +PermissionsStartOnly=true + +# Process management +#################### +Type=forking +Restart=on-failure +TimeoutStartSec=infinity +TimeoutStopSec=600 + +# Directory creation and permissions +#################################### +# Run as bitcoin:bitcoin User=bitcoin Group=bitcoin -Type=forking -PIDFile=/home/bitcoin/bitcoin/bitcoind.pid -ExecStart=/home/bitcoin/bitcoin/bitcoind -daemon \ --pid=/home/bitcoin/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 From 7d950ba1f3ae1bb842b04614553d77c08790269e Mon Sep 17 00:00:00 2001 From: openoms Date: Sun, 10 Dec 2023 08:08:59 +0100 Subject: [PATCH 6/9] ci: update arm64-rpi image --- ci/arm64-rpi/arm64-rpi.pkr.hcl | 4 ++-- scripts/standalone/bitcoin.update.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/arm64-rpi/arm64-rpi.pkr.hcl b/ci/arm64-rpi/arm64-rpi.pkr.hcl index 4f7c294..7592b1b 100644 --- a/ci/arm64-rpi/arm64-rpi.pkr.hcl +++ b/ci/arm64-rpi/arm64-rpi.pkr.hcl @@ -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 { diff --git a/scripts/standalone/bitcoin.update.sh b/scripts/standalone/bitcoin.update.sh index 23aea08..d5ffe4d 100644 --- a/scripts/standalone/bitcoin.update.sh +++ b/scripts/standalone/bitcoin.update.sh @@ -20,7 +20,7 @@ echo "# Running: bitcoin.update.sh $*" mode="$1" # RECOMMENDED UPDATE BY RASPIBLITZ TEAM (just possible once per sd card update) -# comment will be shown as "BEWARE Info" when option is choosen (can be multiple lines) +# comment will be shown as "BEWARE Info" when option is chosen (can be multiple lines) bitcoinVersion="" # example: 22.0 .. keep empty if no newer version as sd card build is available # GATHER DATA From 9e097d71da7491964342270b36273c0dedf4c3a5 Mon Sep 17 00:00:00 2001 From: openoms Date: Sun, 10 Dec 2023 10:38:28 +0100 Subject: [PATCH 7/9] ci: install qemu plugin for packer --- ci/amd64/debian/joininbox-amd64-debian.json | 38 ++++++++++----------- ci/amd64/packer.build.amd64-debian.sh | 5 ++- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/ci/amd64/debian/joininbox-amd64-debian.json b/ci/amd64/debian/joininbox-amd64-debian.json index f4fb581..5922072 100644 --- a/ci/amd64/debian/joininbox-amd64-debian.json +++ b/ci/amd64/debian/joininbox-amd64-debian.json @@ -1,24 +1,24 @@ { "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": "install preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `preseed_path`}} debian-installer=en_US.UTF-8 auto locale=en_US.UTF-8 kbd-chooser/method=us keyboard-configuration/xkb-keymap=us netcfg/get_hostname={{ .Name }} netcfg/get_domain=vagrantup.com fb=false debconf/frontend=noninteractive console-setup/ask_detect=false console-keymaps-at/keymap=us grub-installer/bootdev=default ", - "version": "TIMESTAMP" -}, + "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": "install preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `preseed_path`}} debian-installer=en_US.UTF-8 auto locale=en_US.UTF-8 kbd-chooser/method=us keyboard-configuration/xkb-keymap=us netcfg/get_hostname={{ .Name }} netcfg/get_domain=vagrantup.com fb=false debconf/frontend=noninteractive console-setup/ask_detect=false console-keymaps-at/keymap=us grub-installer/bootdev=default ", + "version": "TIMESTAMP" + }, "builders": [ { "boot_command": "{{user `boot_command`}}", diff --git a/ci/amd64/packer.build.amd64-debian.sh b/ci/amd64/packer.build.amd64-debian.sh index 2cded91..8da4c62 100644 --- a/ci/amd64/packer.build.amd64-debian.sh +++ b/ci/amd64/packer.build.amd64-debian.sh @@ -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 From dbd52a764167dc1a19c4c7b795363624a11c9349 Mon Sep 17 00:00:00 2001 From: openoms Date: Sun, 10 Dec 2023 21:43:43 +0100 Subject: [PATCH 8/9] ci: add vnc --- .gitignore | 1 + ci/amd64/debian/joininbox-amd64-debian.json | 90 +++------------------ 2 files changed, 10 insertions(+), 81 deletions(-) diff --git a/.gitignore b/.gitignore index 025a3fe..0329ccb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ scripts/wallets ci/arm64-rpi/.packer* ci/arm64-rpi/joininbox-arm64-rpi* +ci/amd64/builds diff --git a/ci/amd64/debian/joininbox-amd64-debian.json b/ci/amd64/debian/joininbox-amd64-debian.json index 5922072..817f324 100644 --- a/ci/amd64/debian/joininbox-amd64-debian.json +++ b/ci/amd64/debian/joininbox-amd64-debian.json @@ -4,115 +4,43 @@ "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": "install preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `preseed_path`}} debian-installer=en_US.UTF-8 auto locale=en_US.UTF-8 kbd-chooser/method=us keyboard-configuration/xkb-keymap=us netcfg/get_hostname={{ .Name }} netcfg/get_domain=vagrantup.com fb=false debconf/frontend=noninteractive console-setup/ask_detect=false console-keymaps-at/keymap=us grub-installer/bootdev=default ", - "version": "TIMESTAMP" + "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": [ From 6e7773bf0067a3fc5b007201e58ea78ffa56c090 Mon Sep 17 00:00:00 2001 From: openoms Date: Mon, 11 Dec 2023 08:49:02 +0100 Subject: [PATCH 9/9] menu updates --- scripts/menu.update.advanced.sh | 4 ++-- scripts/menu.update.sh | 16 +++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/scripts/menu.update.advanced.sh b/scripts/menu.update.advanced.sh index 227e667..7b051db 100755 --- a/scripts/menu.update.advanced.sh +++ b/scripts/menu.update.advanced.sh @@ -9,8 +9,8 @@ CHOICE_HEIGHT=7 TITLE="Advanced update options" MENU=" Installed versions: -JoininBox: $currentJBcommit -JoinMarket: $currentJMversion +JoininBox $currentJBcommit +JoinMarket $currentJMversion $currentBTCversion" OPTIONS=() diff --git a/scripts/menu.update.sh b/scripts/menu.update.sh index f6b0951..336aca3 100755 --- a/scripts/menu.update.sh +++ b/scripts/menu.update.sh @@ -3,14 +3,14 @@ source /home/joinmarket/_functions.sh # BASIC MENU INFO -HEIGHT=14 +HEIGHT=15 WIDTH=56 -CHOICE_HEIGHT=3 +CHOICE_HEIGHT=4 TITLE="Update options" MENU=" Installed versions: -JoininBox: $currentJBcommit -JoinMarket: $currentJMversion +JoininBox $currentJBcommit +JoinMarket $currentJMversion $currentBTCversion" OPTIONS=() BACKTITLE="JoininBox GUI" @@ -56,11 +56,13 @@ case $CHOICE in echo "Press ENTER to return to the menu" read key;; BITCOIN) - /home/joinmarket/bitcoin.update.sh custom + /home/joinmarket/standalone/bitcoin.update.sh custom errorOnInstall $? echo - echo "Press ENTER to return to the menu" - read key;; + echo "# Start bitcoind .. " + sudo systemctl start bitcoind + echo "# Monitoring the bitcoind logs .. " + showBitcoinLogs;; ADVANCED) /home/joinmarket/menu.update.advanced.sh;; esac