From 7c91ee99a7c3f01f7d89eb86d65c251900d7377a Mon Sep 17 00:00:00 2001 From: /rootzoll Date: Mon, 28 Oct 2024 13:33:18 +0100 Subject: [PATCH] Fix #4817 BTCPay Server install (#4824) --- home.admin/config.scripts/blitz.datadrive.sh | 46 +++++++++++++------ .../config.scripts/bonus.btcpayserver.sh | 4 +- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/home.admin/config.scripts/blitz.datadrive.sh b/home.admin/config.scripts/blitz.datadrive.sh index aee8e8ed3..c5c4e1a7a 100755 --- a/home.admin/config.scripts/blitz.datadrive.sh +++ b/home.admin/config.scripts/blitz.datadrive.sh @@ -35,17 +35,6 @@ elif [ -d /boot ]; then fi echo "# raspi_bootdir(${raspi_bootdir})" -# install BTRFS if needed -btrfsInstalled=$(btrfs --version 2>/dev/null | grep -c "btrfs-progs") -if [ ${btrfsInstalled} -eq 0 ]; then - >&2 echo "# Installing BTRFS ..." - apt-get install -y btrfs-progs 1>/dev/null -fi -btrfsInstalled=$(btrfs --version 2>/dev/null | grep -c "btrfs-progs") -if [ ${btrfsInstalled} -eq 0 ]; then - echo "error='missing btrfs package'" - exit 1 -fi # install smartmontools if needed smartmontoolsInstalled=$(apt-cache policy smartmontools | grep -c 'Installed: (none)' | grep -c "0") @@ -66,14 +55,41 @@ fi # gathering system info # is global so that also other parts of this script can use this +# check if a btrfs filesystem is available # basics isMounted=$(df | grep -c /mnt/hdd) -isBTRFS=$(btrfs filesystem show 2>/dev/null| grep -c 'BLITZSTORAGE') -isRaid=$(btrfs filesystem df /mnt/hdd 2>/dev/null | grep -c "Data, RAID1") -isZFS=$(zfs list 2>/dev/null | grep -c "/mnt/hdd") +isBTRFS="0" +isRaid="0" +isZFS="0" isSSD="0" isSMART="0" +# BTRFS extras +btrfsConnected=$(lsblk -f | grep -c btrfs) +if [ ${btrfsConnected} -gt 0 ]; then + + # install BTRFS if needed + btrfsInstalled=$(btrfs --version 2>/dev/null | grep -c "btrfs-progs") + if [ ${btrfsInstalled} -eq 0 ]; then + >&2 echo "# Installing BTRFS ..." + apt-get install -y btrfs-progs 1>/dev/null + fi + btrfsInstalled=$(btrfs --version 2>/dev/null | grep -c "btrfs-progs") + if [ ${btrfsInstalled} -eq 0 ]; then + echo "error='missing btrfs package'" + exit 1 + fi + isBTRFS=$(btrfs filesystem show 2>/dev/null| grep -c 'BLITZSTORAGE') + isRaid=$(btrfs filesystem df /mnt/hdd 2>/dev/null | grep -c "Data, RAID1") + +fi + +# ZFS extras +zfsConnected=$(lsblk -f | grep -c zfs) +if [ ${zfsConnected} -gt 0 ]; then + isZFS=$(zfs list 2>/dev/null | grep -c "/mnt/hdd") +fi + # determine if swap is external on or not externalSwapPath="/mnt/hdd/swapfile" if [ ${isBTRFS} -eq 1 ]; then @@ -656,6 +672,8 @@ if [ "$1" = "format" ]; then # check valid format if [ "$2" = "btrfs" ]; then >&2 echo "# DATA DRIVE - FORMATTING to BTRFS layout (new)" + # check if btrfs-tools are installed + apt-get install -y btrfs-progs 1>/dev/null elif [ "$2" = "ext4" ]; then >&2 echo "# DATA DRIVE - FORMATTING to EXT4 layout (old)" else diff --git a/home.admin/config.scripts/bonus.btcpayserver.sh b/home.admin/config.scripts/bonus.btcpayserver.sh index fdac17454..28f007695 100644 --- a/home.admin/config.scripts/bonus.btcpayserver.sh +++ b/home.admin/config.scripts/bonus.btcpayserver.sh @@ -487,8 +487,8 @@ if [ "$1" = "install" ]; then echo "# Install NBXplorer $NBXplorerVersion" cd /home/btcpay || exit 1 echo "# Download the NBXplorer source code $NBXplorerVersion" - sudo -u btcpay git clone https://github.com/dgarage/NBXplorer.git 2>/dev/null - cd NBXplorer || exit 1 + sudo -u btcpay git clone https://github.com/dgarage/NBXplorer.git + cd NBXplorer sudo -u btcpay git reset --hard $NBXplorerVersion # PGP verify NBXPGPsigner="nicolasdorier"