2019-07-13 18:25:22 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-06-26 04:15:07 +00:00
|
|
|
###
|
2023-12-01 22:06:57 +00:00
|
|
|
### Setup MyNode (all devices)
|
2019-06-26 04:15:07 +00:00
|
|
|
### Run with "sudo"
|
|
|
|
###
|
|
|
|
|
|
|
|
set -x
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if [ "$#" != "1" ]; then
|
2022-08-01 01:50:16 +00:00
|
|
|
echo "Usage: $0 <ip address | online>"
|
2019-06-26 04:15:07 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
SERVER_IP=$1
|
|
|
|
|
2019-06-30 21:13:04 +00:00
|
|
|
# Determine Device
|
2019-12-22 01:55:42 +00:00
|
|
|
IS_ARMBIAN=0
|
2019-06-30 21:13:04 +00:00
|
|
|
IS_ROCK64=0
|
2019-12-06 03:30:23 +00:00
|
|
|
IS_ROCKPRO64=0
|
|
|
|
IS_RASPI=0
|
2019-06-30 21:13:04 +00:00
|
|
|
IS_RASPI3=0
|
|
|
|
IS_RASPI4=0
|
2024-01-08 00:56:37 +00:00
|
|
|
IS_RASPI5=0
|
2022-01-25 03:50:13 +00:00
|
|
|
IS_ROCKPI4=0
|
2019-10-03 03:10:20 +00:00
|
|
|
IS_X86=0
|
2024-01-08 00:56:37 +00:00
|
|
|
IS_ARM64=0
|
2021-12-17 05:30:02 +00:00
|
|
|
IS_32_BIT=0
|
2021-10-28 01:44:23 +00:00
|
|
|
IS_64_BIT=0
|
2019-12-06 03:30:23 +00:00
|
|
|
IS_UNKNOWN=0
|
|
|
|
DEVICE_TYPE="unknown"
|
|
|
|
MODEL=$(cat /proc/device-tree/model) || IS_UNKNOWN=1
|
2022-08-12 03:38:12 +00:00
|
|
|
DEBIAN_VERSION=$(lsb_release -c -s) || DEBIAN_VERSION="unknown"
|
2022-05-12 04:40:57 +00:00
|
|
|
uname -a | grep amd64 && IS_X86=1 && IS_64_BIT=1 && IS_UNKNOWN=0 || true
|
2019-12-22 01:55:42 +00:00
|
|
|
if [[ $MODEL == *"Rock64"* ]]; then
|
|
|
|
IS_ARMBIAN=1
|
2019-12-06 03:30:23 +00:00
|
|
|
IS_ROCK64=1
|
2021-10-28 01:44:23 +00:00
|
|
|
IS_64_BIT=1
|
2019-12-22 01:55:42 +00:00
|
|
|
elif [[ $MODEL == *"RockPro64"* ]]; then
|
|
|
|
IS_ARMBIAN=1
|
2019-12-06 03:30:23 +00:00
|
|
|
IS_ROCKPRO64=1
|
2021-10-28 01:44:23 +00:00
|
|
|
IS_64_BIT=1
|
2019-12-06 03:30:23 +00:00
|
|
|
elif [[ $MODEL == *"Raspberry Pi 3"* ]]; then
|
|
|
|
IS_RASPI=1
|
|
|
|
IS_RASPI3=1
|
2021-12-17 05:30:02 +00:00
|
|
|
IS_32_BIT=1
|
2019-12-06 03:30:23 +00:00
|
|
|
elif [[ $MODEL == *"Raspberry Pi 4"* ]]; then
|
|
|
|
IS_RASPI=1
|
|
|
|
IS_RASPI4=1
|
2021-12-17 05:30:02 +00:00
|
|
|
IS_32_BIT=1
|
2021-04-28 02:53:49 +00:00
|
|
|
UNAME=$(uname -a)
|
|
|
|
if [[ $UNAME == *"aarch64"* ]]; then
|
2024-01-08 00:56:37 +00:00
|
|
|
IS_ARM64=1
|
2021-12-17 05:30:02 +00:00
|
|
|
IS_32_BIT=0
|
2021-10-28 01:44:23 +00:00
|
|
|
IS_64_BIT=1
|
2021-04-28 02:53:49 +00:00
|
|
|
fi
|
2024-01-08 00:56:37 +00:00
|
|
|
elif [[ $MODEL == *"Raspberry Pi 5"* ]]; then
|
|
|
|
IS_RASPI=1
|
|
|
|
IS_RASPI5=1
|
|
|
|
IS_ARM64=1
|
|
|
|
IS_64_BIT=1
|
2022-01-25 03:50:13 +00:00
|
|
|
elif [[ $MODEL == *"ROCK Pi 4"* ]]; then
|
|
|
|
IS_ARMBIAN=1
|
|
|
|
IS_ROCKPI4=1
|
|
|
|
IS_64_BIT=1
|
2019-12-06 03:30:23 +00:00
|
|
|
fi
|
|
|
|
|
2022-01-25 03:50:13 +00:00
|
|
|
|
2019-12-06 03:30:23 +00:00
|
|
|
if [ $IS_UNKNOWN = 1 ]; then
|
|
|
|
echo "UNKNOWN DEVICE TYPE"
|
|
|
|
exit 1
|
2019-10-03 03:10:20 +00:00
|
|
|
fi
|
2019-06-30 21:13:04 +00:00
|
|
|
|
2020-03-31 04:38:54 +00:00
|
|
|
# Set kernel settings
|
|
|
|
sysctl -w net.ipv6.conf.all.disable_ipv6=1
|
|
|
|
sysctl -w net.ipv6.conf.default.disable_ipv6=1
|
|
|
|
sysctl -w net.ipv6.conf.lo.disable_ipv6=1
|
|
|
|
|
2021-01-05 04:10:04 +00:00
|
|
|
# Set DNS for install (old)
|
|
|
|
#echo "" > /etc/resolv.conf
|
|
|
|
#echo "nameserver 1.1.1.1" >> /etc/resolv.conf
|
|
|
|
#echo "nameserver 9.9.9.9" >> /etc/resolv.conf
|
|
|
|
#echo "nameserver 8.8.8.8" >> /etc/resolv.conf
|
|
|
|
|
|
|
|
# Set DNS for install (new)
|
|
|
|
echo "" >> /etc/dhcp/dhclient.conf
|
|
|
|
echo "append domain-name-servers 1.1.1.1, 208.67.222.222, 8.8.8.8;" >> /etc/dhcp/dhclient.conf
|
|
|
|
dhclient -r
|
|
|
|
|
|
|
|
# Test DNS resolution issues (may have only seen issues on bad device)
|
|
|
|
#ping -c 2 raspberrypi.org
|
|
|
|
#ping -c 2 raspbian.raspberrypi.org
|
|
|
|
#ping -c 2 pythonhosted.org
|
|
|
|
#ping -c 2 python.org
|
|
|
|
#ping -c 2 piwheels.org
|
2020-04-02 04:46:53 +00:00
|
|
|
|
2019-12-06 03:30:23 +00:00
|
|
|
|
2023-12-01 18:44:47 +00:00
|
|
|
# Make sure FS is expanded
|
2019-12-22 01:55:42 +00:00
|
|
|
if [ $IS_ARMBIAN = 1 ] ; then
|
2019-07-06 01:45:42 +00:00
|
|
|
/usr/lib/armbian/armbian-resize-filesystem start
|
|
|
|
fi
|
2023-12-01 18:44:47 +00:00
|
|
|
if [ $IS_X86 = 1 ]; then
|
|
|
|
apt-get -y install gdisk parted
|
|
|
|
|
|
|
|
X86_ROOT_PARTITION="$(mount | grep ' / ' | cut -d ' ' -f1)"
|
|
|
|
X86_DEVICE="$(lsblk -no pkname $X86_ROOT_PARTITION)"
|
|
|
|
X86_DEVICE_PATH="/dev/$X86_DEVICE"
|
|
|
|
case "$X86_DEVICE" in
|
|
|
|
sd* | hd* | vd*)
|
|
|
|
# SATA
|
|
|
|
X86_PARTITION_NUMBER=$(cat /proc/partitions | grep -c "${X86_DEVICE}[0-9]")
|
|
|
|
;;
|
|
|
|
nvme*)
|
|
|
|
# NVMe
|
|
|
|
X86_PARTITION_NUMBER=$(cat /proc/partitions | grep -c "${X86_DEVICE}p[0-9]")
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
X86_FDISK_TYPE=$(fdisk -l "$X86_DEVICE_PATH" | grep "Disklabel")
|
|
|
|
echo "Root Partition: $X86_ROOT_PARTITION"
|
|
|
|
echo "Root Device: $X86_DEVICE"
|
|
|
|
echo "Root Dev Path: $X86_DEVICE_PATH"
|
|
|
|
echo "Root Partition #: $X86_PARTITION_NUMBER"
|
|
|
|
if [[ "$X86_FDISK_TYPE" = *"Disklabel type: gpt"* ]]; then
|
|
|
|
if [ "$X86_PARTITION_NUMBER" = "2" ]; then
|
|
|
|
sgdisk -e $X86_DEVICE_PATH
|
|
|
|
sgdisk -d $X86_PARTITION_NUMBER $X86_DEVICE_PATH
|
|
|
|
sgdisk -N $X86_PARTITION_NUMBER $X86_DEVICE_PATH
|
|
|
|
partprobe $X86_DEVICE_PATH
|
|
|
|
resize2fs $X86_ROOT_PARTITION
|
|
|
|
else
|
|
|
|
echo "Not resizing - Expected 2 partitions, found $X86_PARTITION_NUMBER"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Not resizing - Expected GPT partition"
|
|
|
|
echo "$X86_FDISK"
|
|
|
|
fi
|
|
|
|
fi
|
2019-07-06 01:45:42 +00:00
|
|
|
|
2019-10-12 02:31:31 +00:00
|
|
|
|
|
|
|
# Download rootfs
|
|
|
|
rm -rf /tmp/rootfs.tar.gz
|
|
|
|
rm -rf /tmp/upgrade/
|
|
|
|
mkdir -p /tmp/upgrade
|
|
|
|
|
|
|
|
TARBALL=""
|
|
|
|
if [ $IS_ROCK64 = 1 ]; then
|
|
|
|
TARBALL="mynode_rootfs_rock64.tar.gz"
|
2019-12-06 03:30:23 +00:00
|
|
|
elif [ $IS_ROCKPRO64 = 1 ]; then
|
|
|
|
TARBALL="mynode_rootfs_rockpro64.tar.gz"
|
2019-10-12 02:31:31 +00:00
|
|
|
elif [ $IS_RASPI3 = 1 ]; then
|
|
|
|
TARBALL="mynode_rootfs_raspi3.tar.gz"
|
|
|
|
elif [ $IS_RASPI4 = 1 ]; then
|
|
|
|
TARBALL="mynode_rootfs_raspi4.tar.gz"
|
2024-01-08 00:56:37 +00:00
|
|
|
elif [ $IS_RASPI5 = 1 ]; then
|
|
|
|
TARBALL="mynode_rootfs_raspi5.tar.gz"
|
2022-01-25 03:50:13 +00:00
|
|
|
elif [ $IS_ROCKPI4 = 1 ]; then
|
|
|
|
TARBALL="mynode_rootfs_rockpi4.tar.gz"
|
2019-10-12 02:31:31 +00:00
|
|
|
elif [ $IS_X86 = 1 ]; then
|
|
|
|
TARBALL="mynode_rootfs_debian.tar.gz"
|
|
|
|
fi
|
2022-08-01 01:50:16 +00:00
|
|
|
if [ "$SERVER_IP" == "online" ]; then
|
2022-08-09 02:44:56 +00:00
|
|
|
TARBALL="${TARBALL/"mynode_rootfs_"/"mynode_release_latest_"}"
|
2022-08-01 01:50:16 +00:00
|
|
|
wget https://mynodebtc.com/device/upgrade_images/${TARBALL} -O /tmp/rootfs.tar.gz
|
|
|
|
else
|
|
|
|
wget http://${SERVER_IP}:8000/${TARBALL} -O /tmp/rootfs.tar.gz
|
|
|
|
fi
|
2019-10-12 02:31:31 +00:00
|
|
|
|
2021-04-22 05:19:12 +00:00
|
|
|
# Extract rootfs (so we can reference temporary files)
|
|
|
|
tar -xvf /tmp/rootfs.tar.gz -C /tmp/upgrade/
|
|
|
|
TMP_INSTALL_PATH="/tmp/upgrade/out/rootfs_*"
|
|
|
|
|
2022-05-11 03:08:19 +00:00
|
|
|
# Setup some dependencies
|
|
|
|
mkdir -p /usr/share/mynode/
|
|
|
|
cp -f /tmp/upgrade/out/rootfs_*/usr/share/mynode/mynode_device_info.sh /usr/share/mynode/mynode_device_info.sh
|
|
|
|
cp -f /tmp/upgrade/out/rootfs_*/usr/share/mynode/mynode_config.sh /usr/share/mynode/mynode_config.sh
|
|
|
|
cp -f /tmp/upgrade/out/rootfs_*/usr/share/mynode/mynode_functions.sh /usr/share/mynode/mynode_functions.sh
|
|
|
|
cp -f /tmp/upgrade/out/rootfs_*/usr/bin/mynode-get-device-serial /usr/bin/mynode-get-device-serial
|
|
|
|
|
2021-04-22 05:19:12 +00:00
|
|
|
# Source file containing app versions
|
|
|
|
source /tmp/upgrade/out/rootfs_*/usr/share/mynode/mynode_app_versions.sh
|
2020-09-07 21:13:45 +00:00
|
|
|
|
2022-05-11 02:07:29 +00:00
|
|
|
# Update SD card
|
|
|
|
mkdir -p /etc/torrc.d
|
2019-10-12 02:31:31 +00:00
|
|
|
|
2023-08-27 20:32:31 +00:00
|
|
|
# Set admin password to bolt
|
2022-08-01 01:50:16 +00:00
|
|
|
useradd -p $(openssl passwd -1 bolt) -m -s /bin/bash admin || true
|
2023-08-27 20:32:31 +00:00
|
|
|
|
|
|
|
# Initialize Users
|
|
|
|
/bin/bash $TMP_INSTALL_PATH/usr/bin/mynode_initialize_users.sh
|
2020-06-26 04:30:17 +00:00
|
|
|
|
2021-03-05 04:50:35 +00:00
|
|
|
# Setup bitcoin user folders
|
|
|
|
mkdir -p /home/bitcoin/.mynode/
|
2021-04-22 05:19:12 +00:00
|
|
|
chown bitcoin:bitcoin /home/bitcoin
|
2021-03-05 04:50:35 +00:00
|
|
|
chown -R bitcoin:bitcoin /home/bitcoin/.mynode/
|
|
|
|
|
2022-08-01 01:50:16 +00:00
|
|
|
# Update host info
|
2023-12-01 22:06:57 +00:00
|
|
|
echo "mynode" > /etc/hostname
|
|
|
|
sed -i 's/rock64/mynode/g' /etc/hosts
|
|
|
|
sed -i 's/rockpi4-b/mynode/g' /etc/hosts
|
2022-08-01 01:50:16 +00:00
|
|
|
|
2020-07-30 00:19:55 +00:00
|
|
|
# Update sources
|
2021-10-28 01:44:23 +00:00
|
|
|
apt-get -y update --allow-releaseinfo-change
|
2020-07-30 00:19:55 +00:00
|
|
|
|
2019-07-13 18:25:22 +00:00
|
|
|
# Add sources
|
2022-10-09 18:37:41 +00:00
|
|
|
apt-get -y install apt-transport-https curl gnupg ca-certificates
|
2021-10-28 01:44:23 +00:00
|
|
|
# Tor (arm32 support was dropped)
|
|
|
|
if [ $IS_64_BIT = 1 ]; then
|
|
|
|
grep -qxF "deb https://deb.torproject.org/torproject.org ${DEBIAN_VERSION} main" /etc/apt/sources.list || echo "deb https://deb.torproject.org/torproject.org ${DEBIAN_VERSION} main" >> /etc/apt/sources.list
|
|
|
|
grep -qxF "deb-src https://deb.torproject.org/torproject.org ${DEBIAN_VERSION} main" /etc/apt/sources.list || echo "deb-src https://deb.torproject.org/torproject.org ${DEBIAN_VERSION} main" >> /etc/apt/sources.list
|
|
|
|
fi
|
2022-08-15 03:44:08 +00:00
|
|
|
if [ "$DEBIAN_VERSION" = "buster" ]; then
|
2024-04-25 03:59:48 +00:00
|
|
|
# Migrate old buster backports to archive
|
|
|
|
sed -i 's|deb.debian.org/debian buster-backports|archive.debian.org/debian buster-backports|g' /etc/apt/sources.list
|
|
|
|
# Add backports repo
|
|
|
|
grep -qxF "deb http://archive.debian.org/debian buster-backports main" /etc/apt/sources.list || echo "deb http://archive.debian.org/debian buster-backports main" >> /etc/apt/sources.list
|
2022-08-15 03:44:08 +00:00
|
|
|
fi
|
2022-10-08 17:34:04 +00:00
|
|
|
# Add I2P Repo
|
|
|
|
/bin/bash $TMP_INSTALL_PATH/usr/share/mynode/scripts/add_i2p_repo.sh
|
2020-02-19 03:04:07 +00:00
|
|
|
|
|
|
|
# Import Keys
|
|
|
|
curl https://keybase.io/roasbeef/pgp_keys.asc | gpg --import
|
2020-11-08 22:23:01 +00:00
|
|
|
curl https://keybase.io/bitconner/pgp_keys.asc | gpg --import
|
2021-01-02 01:33:22 +00:00
|
|
|
curl https://keybase.io/guggero/pgp_keys.asc | gpg --import # Pool
|
2020-02-19 03:04:07 +00:00
|
|
|
curl https://raw.githubusercontent.com/JoinMarket-Org/joinmarket-clientserver/master/pubkeys/AdamGibson.asc | gpg --import
|
|
|
|
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 01EA5486DE18A882D4C2684590C8019E36C2E964
|
2021-10-28 01:44:23 +00:00
|
|
|
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys E777299FC265DD04793070EB944D35F9AC3DB76A # Bitcoin - Michael Ford (fanquake)
|
2020-02-19 03:04:07 +00:00
|
|
|
curl https://keybase.io/suheb/pgp_keys.asc | gpg --import
|
2020-09-16 02:55:57 +00:00
|
|
|
curl https://samouraiwallet.com/pgp.txt | gpg --import # two keys from Samourai team
|
2023-08-16 01:05:28 +00:00
|
|
|
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys DE23E73BFA8A0AD5587D2FCDE80D2F3F311FD87E # Loop (abosworth)
|
|
|
|
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 9FC6B0BFD597A94DBF09708280E5375C094198D8 # Loop (bhandras)
|
2022-10-10 02:16:43 +00:00
|
|
|
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 26984CB69EB8C4A26196F7A4D7D916376026F177 # Lightning Terminal
|
2023-06-12 03:10:40 +00:00
|
|
|
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 187F6ADD93AE3B0CF335AA6AB984570980684DCC # Lightning Terminal
|
2022-09-29 03:30:22 +00:00
|
|
|
wget -q https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc -O- | apt-key add - # Tor
|
2022-08-13 03:27:46 +00:00
|
|
|
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 # Debian Backports
|
|
|
|
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9 # Debian Backports
|
2022-10-09 18:37:41 +00:00
|
|
|
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 74A941BA219EC810 # Tor
|
|
|
|
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 66F6C87B98EBCFE2 # I2P (R4SAS)
|
2019-07-13 18:25:22 +00:00
|
|
|
|
2019-06-26 04:15:07 +00:00
|
|
|
# Update OS
|
2019-07-13 18:25:22 +00:00
|
|
|
apt -y update # Needed to accept new repos
|
|
|
|
apt-get -y update
|
2020-08-21 18:28:42 +00:00
|
|
|
|
|
|
|
# Freeze any packages we don't want to update
|
|
|
|
if [ $IS_X86 = 1 ]; then
|
|
|
|
apt-mark hold grub*
|
|
|
|
fi
|
2022-08-12 03:38:12 +00:00
|
|
|
#apt-mark hold redis-server
|
2020-08-21 18:28:42 +00:00
|
|
|
|
|
|
|
# Upgrade packages
|
2019-06-26 04:15:07 +00:00
|
|
|
apt-get -y upgrade
|
|
|
|
|
|
|
|
# Install other tools (run section multiple times to make sure success)
|
2019-11-26 00:13:33 +00:00
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
2022-08-12 03:38:12 +00:00
|
|
|
apt-get -y install apt-transport-https lsb-release
|
2019-06-26 04:15:07 +00:00
|
|
|
apt-get -y install htop git curl bash-completion jq dphys-swapfile lsof libzmq3-dev
|
2022-08-12 03:38:12 +00:00
|
|
|
apt-get -y install build-essential python3-dev python3-pip python3-grpcio
|
|
|
|
apt-get -y install transmission-cli fail2ban ufw tclsh redis-server
|
2019-07-13 18:25:22 +00:00
|
|
|
apt-get -y install clang hitch zlib1g-dev libffi-dev file toilet ncdu
|
2020-08-27 01:12:48 +00:00
|
|
|
apt-get -y install toilet-fonts avahi-daemon figlet libsecp256k1-dev
|
2019-11-29 22:36:29 +00:00
|
|
|
apt-get -y install inotify-tools libssl-dev tor tmux screen fonts-dejavu
|
2019-10-26 04:42:32 +00:00
|
|
|
apt-get -y install pv sysstat network-manager rsync parted unzip pkg-config
|
2020-08-27 01:12:48 +00:00
|
|
|
apt-get -y install libfreetype6-dev libpng-dev libatlas-base-dev libgmp-dev libltdl-dev
|
2022-08-12 03:38:12 +00:00
|
|
|
apt-get -y install libffi-dev libssl-dev python3-bottle automake libtool libltdl7
|
2019-11-18 03:58:37 +00:00
|
|
|
apt -y -qq install apt-transport-https ca-certificates
|
2023-12-01 18:44:47 +00:00
|
|
|
apt-get -y install libevent-dev ncurses-dev
|
2020-06-26 04:30:17 +00:00
|
|
|
apt-get -y install zlib1g-dev libudev-dev libusb-1.0-0-dev python3-venv gunicorn
|
2021-02-10 05:37:43 +00:00
|
|
|
apt-get -y install sqlite3 libsqlite3-dev torsocks python3-requests libsystemd-dev
|
2021-09-28 23:18:21 +00:00
|
|
|
apt-get -y install libjpeg-dev zlib1g-dev psmisc hexyl libbz2-dev liblzma-dev netcat-openbsd
|
2023-03-02 04:18:24 +00:00
|
|
|
apt-get -y install hdparm iotop nut obfs4proxy libpq-dev socat btrfs-progs i2pd apparmor pass
|
2023-12-01 18:44:47 +00:00
|
|
|
apt-get -y install gdisk xxd
|
|
|
|
|
|
|
|
# Install Java
|
|
|
|
apt-get -y install default-jre
|
2022-08-12 03:38:12 +00:00
|
|
|
|
|
|
|
# Install packages dependent on Debian release
|
|
|
|
if [ "$DEBIAN_VERSION" == "bullseye" ]; then
|
|
|
|
apt-get -y install wireguard
|
2023-10-26 03:04:23 +00:00
|
|
|
elif [ "$DEBIAN_VERSION" == "bookworm" ]; then
|
|
|
|
apt-get -y install wireguard
|
2022-08-12 03:38:12 +00:00
|
|
|
elif [ "$DEBIAN_VERSION" == "buster" ]; then
|
2023-10-26 03:04:23 +00:00
|
|
|
apt-get -y -t buster-backports install wireguard
|
2022-08-12 03:38:12 +00:00
|
|
|
else
|
|
|
|
echo "========================================="
|
|
|
|
echo "== UNKNOWN DEBIAN VERSION: $DEBIAN_VERSION"
|
|
|
|
echo "== SOME APPS MAY NOT WORK PROPERLY"
|
|
|
|
echo "========================================="
|
|
|
|
fi
|
2019-06-26 04:15:07 +00:00
|
|
|
|
2022-02-25 04:23:58 +00:00
|
|
|
# Install Openbox GUI
|
|
|
|
if [ $IS_X86 = 1 ]; then
|
|
|
|
apt-get -y install xorg chromium openbox lightdm
|
|
|
|
fi
|
|
|
|
|
2021-04-11 21:47:13 +00:00
|
|
|
# Install device specific packages
|
|
|
|
if [ $IS_X86 = 1 ]; then
|
2023-04-10 02:49:45 +00:00
|
|
|
apt-get -y install cloud-init
|
|
|
|
apt-get -y install intel-microcode || true
|
2021-04-11 21:47:13 +00:00
|
|
|
fi
|
2022-12-09 04:00:16 +00:00
|
|
|
if [ $IS_ARMBIAN = 1 ] ; then
|
|
|
|
apt-get -y install systemd-timesyncd
|
|
|
|
timedatectl set-ntp true
|
|
|
|
fi
|
2019-06-26 04:15:07 +00:00
|
|
|
|
2019-11-26 13:49:24 +00:00
|
|
|
# Make sure some software is removed
|
|
|
|
apt-get -y purge ntp # (conflicts with systemd-timedatectl)
|
2019-12-19 03:34:57 +00:00
|
|
|
apt-get -y purge chrony # (conflicts with systemd-timedatectl)
|
2019-11-26 13:49:24 +00:00
|
|
|
|
|
|
|
|
2019-06-26 04:15:07 +00:00
|
|
|
# Install other things without recommendation
|
|
|
|
apt-get -y install --no-install-recommends expect
|
|
|
|
|
2020-08-04 02:07:16 +00:00
|
|
|
|
|
|
|
# Install nginx
|
|
|
|
mkdir -p /var/log/nginx
|
2023-10-26 03:04:23 +00:00
|
|
|
apt-get -y install nginx || true
|
2023-12-01 18:44:47 +00:00
|
|
|
apt-get -y install libnginx-mod-stream || true
|
2020-08-04 02:07:16 +00:00
|
|
|
# Install may fail, so we need to edit the default config file and reconfigure
|
2020-08-11 04:08:38 +00:00
|
|
|
rm -f /etc/nginx/modules-enabled/50-mod-* || true
|
2020-08-04 02:07:16 +00:00
|
|
|
echo "" > /etc/nginx/sites-available/default
|
|
|
|
dpkg --configure -a
|
|
|
|
|
2023-12-21 04:35:50 +00:00
|
|
|
# Cleanup apt-get cache to save some space
|
|
|
|
apt-get clean
|
2020-08-04 02:07:16 +00:00
|
|
|
|
2021-04-22 05:19:12 +00:00
|
|
|
# Update users
|
2019-06-29 15:53:33 +00:00
|
|
|
usermod -a -G debian-tor bitcoin
|
2019-06-26 04:15:07 +00:00
|
|
|
|
2021-04-22 05:19:12 +00:00
|
|
|
# Make admin a member of bitcoin
|
|
|
|
adduser admin bitcoin
|
2022-10-22 16:38:11 +00:00
|
|
|
adduser joinmarket bitcoin
|
2022-03-11 04:41:36 +00:00
|
|
|
grep "joinmarket" /etc/sudoers || (echo 'joinmarket ALL=(ALL) NOPASSWD:ALL' | EDITOR='tee -a' visudo)
|
2019-07-02 03:25:05 +00:00
|
|
|
|
2019-06-26 04:15:07 +00:00
|
|
|
|
2022-12-29 04:08:54 +00:00
|
|
|
# Install Go
|
|
|
|
GO_ARCH="unknown"
|
|
|
|
if [ "$DEVICE_ARCH" == "armv7l" ]; then
|
|
|
|
GO_ARCH="armv6l"
|
|
|
|
elif [ "$DEVICE_ARCH" == "aarch64" ]; then
|
|
|
|
GO_ARCH="arm64"
|
|
|
|
elif [ "$DEVICE_ARCH" == "x86_64" ]; then
|
|
|
|
GO_ARCH="amd64"
|
|
|
|
fi
|
|
|
|
GO_UPGRADE_URL=https://go.dev/dl/go$GO_VERSION.linux-$GO_ARCH.tar.gz
|
|
|
|
CURRENT=""
|
|
|
|
if [ -f $GO_VERSION_FILE ]; then
|
|
|
|
CURRENT=$(cat $GO_VERSION_FILE)
|
|
|
|
fi
|
|
|
|
if [ "$CURRENT" != "$GO_VERSION" ]; then
|
|
|
|
rm -rf /opt/download
|
|
|
|
mkdir -p /opt/download
|
|
|
|
cd /opt/download
|
|
|
|
|
|
|
|
wget $GO_UPGRADE_URL -O go.tar.gz
|
|
|
|
rm -rf /usr/local/go && tar -C /usr/local -xzf go.tar.gz
|
|
|
|
|
|
|
|
# Mark current version
|
|
|
|
echo $GO_VERSION > $GO_VERSION_FILE
|
|
|
|
fi
|
|
|
|
echo "export GOBIN=/usr/local/go/bin; PATH=\$PATH:/usr/local/go/bin" > /etc/profile.d/go.sh
|
|
|
|
grep -qxF '. /etc/profile.d/go.sh' /root/.bashrc || echo '. /etc/profile.d/go.sh' >> /root/.bashrc
|
|
|
|
|
|
|
|
|
2021-11-23 06:23:16 +00:00
|
|
|
# Install Rust (only needed on 32-bit RPi for building some python wheels)
|
|
|
|
if [ ! -f $HOME/.cargo/env ]; then
|
|
|
|
wget https://sh.rustup.rs -O /tmp/setup_rust.sh
|
|
|
|
/bin/bash /tmp/setup_rust.sh -y --default-toolchain none
|
|
|
|
sync
|
|
|
|
fi
|
|
|
|
if [ -f $HOME/.cargo/env ]; then
|
|
|
|
# Remove old toolchains
|
|
|
|
source $HOME/.cargo/env
|
|
|
|
TOOLCHAINS=$(rustup toolchain list)
|
|
|
|
for toolchain in $TOOLCHAINS; do
|
|
|
|
if [[ "$toolchain" == *"linux"* ]] && [[ "$toolchain" != *"${RUST_VERSION}"* ]]; then
|
|
|
|
rustup toolchain remove $toolchain || true
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
# Manage rust toolchains
|
2024-01-08 00:56:37 +00:00
|
|
|
if [ $IS_RASPI = 1 ] && [ $IS_ARM64 = 0 ]; then
|
2021-11-23 06:23:16 +00:00
|
|
|
# Install and use desired version
|
|
|
|
rustup install $RUST_VERSION
|
|
|
|
rustup default $RUST_VERSION
|
|
|
|
rustc --version
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Install Python3 (latest)
|
2020-06-26 04:30:17 +00:00
|
|
|
CURRENT_PYTHON3_VERSION=$(python3 --version)
|
|
|
|
if [[ "$CURRENT_PYTHON3_VERSION" != *"Python ${PYTHON_VERSION}"* ]]; then
|
2020-02-05 02:17:25 +00:00
|
|
|
mkdir -p /opt/download
|
|
|
|
cd /opt/download
|
2020-06-26 04:30:17 +00:00
|
|
|
rm -rf Python-*
|
|
|
|
|
|
|
|
wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz -O python.tar.xz
|
|
|
|
tar xf python.tar.xz
|
|
|
|
|
|
|
|
cd Python-*
|
2019-06-27 03:02:08 +00:00
|
|
|
./configure
|
|
|
|
make -j4
|
2020-03-06 00:26:36 +00:00
|
|
|
make install
|
2019-06-27 03:02:08 +00:00
|
|
|
cd ~
|
|
|
|
else
|
|
|
|
echo "Python up to date"
|
|
|
|
fi
|
2019-06-26 04:15:07 +00:00
|
|
|
|
2023-01-16 05:07:52 +00:00
|
|
|
# Add to python path
|
|
|
|
[ -d /usr/local/lib/python2.7/dist-packages ] && echo "/var/pynode" > /usr/local/lib/python2.7/dist-packages/pynode.pth
|
|
|
|
[ -d /usr/local/lib/python3.7/site-packages ] && echo "/var/pynode" > /usr/local/lib/python3.7/site-packages/pynode.pth
|
|
|
|
[ -d /usr/local/lib/python3.8/site-packages ] && echo "/var/pynode" > /usr/local/lib/python3.8/site-packages/pynode.pth
|
|
|
|
|
2019-06-26 04:15:07 +00:00
|
|
|
|
2022-04-12 03:41:57 +00:00
|
|
|
# Install Python3 specific tools
|
2020-08-29 19:47:59 +00:00
|
|
|
pip3 install --upgrade pip wheel setuptools
|
2022-04-12 03:41:57 +00:00
|
|
|
|
|
|
|
pip3 install -r $TMP_INSTALL_PATH/usr/share/mynode/mynode_pip3_requirements.txt --no-cache-dir || \
|
|
|
|
pip3 install -r $TMP_INSTALL_PATH/usr/share/mynode/mynode_pip3_requirements.txt --no-cache-dir --use-deprecated=html5lib
|
2019-06-26 04:15:07 +00:00
|
|
|
|
2021-12-17 05:30:02 +00:00
|
|
|
# For RP4 32-bit, install specific grpcio version known to build (uses proper glibc for wheel)
|
|
|
|
if [ $IS_32_BIT = 1 ]; then
|
|
|
|
pip3 install grpcio==$PYTHON_ARM32_GRPCIO_VERSION grpcio-tools==$PYTHON_ARM32_GRPCIO_VERSION
|
|
|
|
fi
|
|
|
|
|
2019-06-26 04:15:07 +00:00
|
|
|
|
|
|
|
# Install node
|
2019-06-30 21:13:04 +00:00
|
|
|
if [ ! -f /tmp/installed_node ]; then
|
2021-10-23 23:44:52 +00:00
|
|
|
curl -sL https://deb.nodesource.com/setup_$NODE_JS_VERSION | bash -
|
2019-06-30 21:13:04 +00:00
|
|
|
apt-get install -y nodejs
|
|
|
|
touch /tmp/installed_node
|
|
|
|
fi
|
2019-06-26 04:15:07 +00:00
|
|
|
|
2019-11-11 03:22:39 +00:00
|
|
|
# Install docker
|
2022-08-12 03:42:49 +00:00
|
|
|
mkdir -p /etc/apt/keyrings
|
|
|
|
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --batch --yes --dearmor -o /etc/apt/keyrings/docker.gpg
|
|
|
|
echo \
|
|
|
|
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
|
|
|
|
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
|
|
|
|
apt-get update --allow-releaseinfo-change
|
2023-07-15 02:14:44 +00:00
|
|
|
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin || true
|
2019-11-26 00:13:33 +00:00
|
|
|
|
|
|
|
# Use systemd for managing docker
|
|
|
|
rm -f /etc/init.d/docker
|
|
|
|
rm -f /etc/systemd/system/multi-user.target.wants/docker.service
|
|
|
|
systemctl -f enable docker.service
|
|
|
|
|
2019-11-11 03:22:39 +00:00
|
|
|
groupadd docker || true
|
|
|
|
usermod -aG docker admin
|
|
|
|
usermod -aG docker bitcoin
|
|
|
|
usermod -aG docker root
|
|
|
|
|
2019-06-26 04:15:07 +00:00
|
|
|
# Install node packages
|
|
|
|
npm install -g pug-cli browserify uglify-js babel-cli
|
2021-11-06 20:29:02 +00:00
|
|
|
npm install -g npm@$NODE_NPM_VERSION
|
2022-08-16 04:10:31 +00:00
|
|
|
npm install -g yarn
|
2019-06-26 04:15:07 +00:00
|
|
|
|
2022-08-01 01:50:16 +00:00
|
|
|
# Install Log2Ram
|
2024-01-12 04:57:43 +00:00
|
|
|
if [ $IS_RASPI = 1 ] || [ $IS_X86 = 1 ]; then
|
2022-08-01 01:50:16 +00:00
|
|
|
cd /tmp
|
|
|
|
rm -rf log2ram*
|
|
|
|
wget https://github.com/azlux/log2ram/archive/v1.2.2.tar.gz -O log2ram.tar.gz
|
|
|
|
tar -xvf log2ram.tar.gz
|
|
|
|
mv log2ram-* log2ram
|
|
|
|
cd log2ram
|
|
|
|
chmod +x install.sh
|
|
|
|
service log2ram stop
|
|
|
|
./install.sh
|
|
|
|
cd ~
|
|
|
|
fi
|
|
|
|
|
2019-06-26 04:15:07 +00:00
|
|
|
# Remove existing MOTD login info
|
|
|
|
rm -rf /etc/motd
|
|
|
|
rm -rf /etc/update-motd.d/*
|
|
|
|
|
|
|
|
#########################################################
|
|
|
|
|
|
|
|
|
|
|
|
# Install Bitcoin
|
2019-12-07 02:41:55 +00:00
|
|
|
ARCH="UNKNOWN"
|
2019-12-22 01:55:42 +00:00
|
|
|
if [ $IS_RASPI = 1 ]; then
|
2019-12-07 02:41:55 +00:00
|
|
|
ARCH="arm-linux-gnueabihf"
|
2024-01-08 00:56:37 +00:00
|
|
|
if [ $IS_ARM64 = 1 ]; then
|
2021-04-28 02:53:49 +00:00
|
|
|
ARCH="aarch64-linux-gnu"
|
|
|
|
fi
|
2022-01-25 03:50:13 +00:00
|
|
|
elif [ $IS_ROCK64 = 1 ] || [ $IS_ROCKPRO64 = 1 ] || [ $IS_ROCKPI4 = 1 ]; then
|
2019-06-26 04:15:07 +00:00
|
|
|
ARCH="aarch64-linux-gnu"
|
2019-12-07 02:41:55 +00:00
|
|
|
elif [ $IS_X86 = 1 ]; then
|
2020-08-27 01:12:48 +00:00
|
|
|
ARCH="x86_64-linux-gnu"
|
2019-12-07 02:41:55 +00:00
|
|
|
else
|
|
|
|
echo "Unknown Bitcoin Version"
|
|
|
|
exit 1
|
2019-10-03 03:10:20 +00:00
|
|
|
fi
|
2019-10-16 02:57:46 +00:00
|
|
|
BTC_UPGRADE_URL=https://bitcoincore.org/bin/bitcoin-core-$BTC_VERSION/bitcoin-$BTC_VERSION-$ARCH.tar.gz
|
2021-10-03 03:28:52 +00:00
|
|
|
BTC_UPGRADE_SHA256SUM_URL=https://bitcoincore.org/bin/bitcoin-core-$BTC_VERSION/SHA256SUMS
|
|
|
|
BTC_UPGRADE_SHA256SUM_ASC_URL=https://bitcoincore.org/bin/bitcoin-core-$BTC_VERSION/SHA256SUMS.asc
|
2023-12-15 21:01:12 +00:00
|
|
|
BTC_CLI_COMPLETION_URL=https://raw.githubusercontent.com/bitcoin/bitcoin/v$BTC_VERSION/contrib/completions/bash/bitcoin-cli.bash
|
2019-06-27 03:02:08 +00:00
|
|
|
CURRENT=""
|
2020-09-03 02:59:32 +00:00
|
|
|
if [ -f $BTC_VERSION_FILE ]; then
|
|
|
|
CURRENT=$(cat $BTC_VERSION_FILE)
|
2019-06-27 03:02:08 +00:00
|
|
|
fi
|
2020-09-03 02:48:40 +00:00
|
|
|
if [ "$CURRENT" != "$BTC_VERSION" ]; then
|
2019-10-16 02:57:46 +00:00
|
|
|
# Download and install Bitcoin
|
2020-02-05 02:17:25 +00:00
|
|
|
rm -rf /opt/download
|
|
|
|
mkdir -p /opt/download
|
|
|
|
cd /opt/download
|
2019-06-27 03:02:08 +00:00
|
|
|
|
2019-10-16 03:03:53 +00:00
|
|
|
wget $BTC_UPGRADE_URL
|
2021-10-03 03:28:52 +00:00
|
|
|
wget $BTC_UPGRADE_SHA256SUM_URL -O SHA256SUMS
|
|
|
|
wget $BTC_UPGRADE_SHA256SUM_ASC_URL -O SHA256SUMS.asc
|
2019-10-16 02:57:46 +00:00
|
|
|
|
2021-10-28 01:44:23 +00:00
|
|
|
sha256sum --ignore-missing --check SHA256SUMS
|
2021-10-03 03:28:52 +00:00
|
|
|
gpg --verify SHA256SUMS.asc SHA256SUMS |& grep "gpg: Good signature"
|
2019-10-16 02:57:46 +00:00
|
|
|
|
2019-10-16 03:19:02 +00:00
|
|
|
# Install Bitcoin
|
|
|
|
tar -xvf bitcoin-$BTC_VERSION-$ARCH.tar.gz
|
|
|
|
mv bitcoin-$BTC_VERSION bitcoin
|
2019-06-27 03:02:08 +00:00
|
|
|
install -m 0755 -o root -g root -t /usr/local/bin bitcoin/bin/*
|
2021-03-31 03:09:55 +00:00
|
|
|
|
2019-10-03 03:10:20 +00:00
|
|
|
if [ ! -L /home/bitcoin/.bitcoin ]; then
|
|
|
|
sudo -u bitcoin ln -s /mnt/hdd/mynode/bitcoin /home/bitcoin/.bitcoin
|
|
|
|
fi
|
|
|
|
if [ ! -L /home/bitcoin/.lnd ]; then
|
|
|
|
sudo -u bitcoin ln -s /mnt/hdd/mynode/lnd /home/bitcoin/.lnd
|
|
|
|
fi
|
|
|
|
mkdir -p /home/admin/.bitcoin
|
2020-09-03 02:59:32 +00:00
|
|
|
echo $BTC_VERSION > $BTC_VERSION_FILE
|
2021-12-13 23:39:20 +00:00
|
|
|
|
|
|
|
# Install bash-completion for bitcoin-cli
|
2023-12-15 21:01:12 +00:00
|
|
|
wget $BTC_CLI_COMPLETION_URL -O bitcoin-cli.bash
|
|
|
|
sudo cp bitcoin-cli.bash /etc/bash_completion.d/bitcoin-cli
|
2019-06-27 03:02:08 +00:00
|
|
|
fi
|
|
|
|
cd ~
|
2019-06-26 04:15:07 +00:00
|
|
|
|
|
|
|
# Install Lightning
|
2019-10-16 02:10:40 +00:00
|
|
|
LND_ARCH="lnd-linux-armv7"
|
2019-10-03 03:10:20 +00:00
|
|
|
if [ $IS_X86 = 1 ]; then
|
2019-10-16 02:10:40 +00:00
|
|
|
LND_ARCH="lnd-linux-amd64"
|
2019-10-03 03:10:20 +00:00
|
|
|
fi
|
2024-01-08 00:56:37 +00:00
|
|
|
if [ $IS_ARM64 = 1 ] || [ $IS_ROCK64 = 1 ] || [ $IS_ROCKPRO64 = 1 ] || [ $IS_ROCKPI4 = 1 ]; then
|
2021-04-28 02:53:49 +00:00
|
|
|
LND_ARCH="lnd-linux-arm64"
|
|
|
|
fi
|
2019-10-16 02:10:40 +00:00
|
|
|
LND_UPGRADE_URL=https://github.com/lightningnetwork/lnd/releases/download/$LND_VERSION/$LND_ARCH-$LND_VERSION.tar.gz
|
2021-12-13 03:10:24 +00:00
|
|
|
LNCLI_COMPLETION_URL=https://raw.githubusercontent.com/lightningnetwork/lnd/$LND_VERSION/contrib/lncli.bash-completion
|
|
|
|
|
2019-06-27 03:02:08 +00:00
|
|
|
CURRENT=""
|
2020-09-03 02:59:32 +00:00
|
|
|
if [ -f $LND_VERSION_FILE ]; then
|
|
|
|
CURRENT=$(cat $LND_VERSION_FILE)
|
2019-06-27 03:02:08 +00:00
|
|
|
fi
|
2020-09-03 02:59:32 +00:00
|
|
|
if [ "$CURRENT" != "$LND_VERSION" ]; then
|
2020-02-05 02:17:25 +00:00
|
|
|
rm -rf /opt/download
|
|
|
|
mkdir -p /opt/download
|
|
|
|
cd /opt/download
|
2019-06-27 03:02:08 +00:00
|
|
|
|
2019-10-16 03:03:53 +00:00
|
|
|
wget $LND_UPGRADE_URL
|
2021-04-22 05:19:12 +00:00
|
|
|
wget $LND_UPGRADE_MANIFEST_URL -O manifest.txt
|
2022-11-01 17:51:21 +00:00
|
|
|
wget $LND_UPGRADE_MANIFEST_ROASBEEF_SIG_URL -O manifest_roasbeef.txt.sig || true
|
|
|
|
wget $LND_UPGRADE_MANIFEST_GUGGERO_SIG_URL -O manifest_guggero.txt.sig || true
|
2019-10-16 02:10:40 +00:00
|
|
|
|
2022-11-01 17:51:21 +00:00
|
|
|
gpg --verify manifest_roasbeef.txt.sig manifest.txt || \
|
|
|
|
gpg --verify manifest_guggero.txt.sig manifest.txt
|
2019-10-16 02:10:40 +00:00
|
|
|
|
2019-10-16 03:03:53 +00:00
|
|
|
tar -xzf lnd-*.tar.gz
|
|
|
|
mv $LND_ARCH-$LND_VERSION lnd
|
2019-06-27 03:02:08 +00:00
|
|
|
install -m 0755 -o root -g root -t /usr/local/bin lnd/*
|
2019-10-03 03:10:20 +00:00
|
|
|
ln -s /bin/ip /usr/bin/ip || true
|
2019-06-27 03:02:08 +00:00
|
|
|
|
2020-09-03 02:59:32 +00:00
|
|
|
echo $LND_VERSION > $LND_VERSION_FILE
|
2021-12-13 03:10:24 +00:00
|
|
|
|
|
|
|
# Download bash-completion file for lncli
|
|
|
|
wget $LNCLI_COMPLETION_URL
|
|
|
|
sudo cp lncli.bash-completion /etc/bash_completion.d/lncli
|
2019-06-27 03:02:08 +00:00
|
|
|
fi
|
2019-06-26 04:15:07 +00:00
|
|
|
cd ~
|
|
|
|
|
2021-03-31 03:09:55 +00:00
|
|
|
# Install Loop
|
|
|
|
echo "Installing loop..."
|
2020-02-09 02:20:35 +00:00
|
|
|
LOOP_ARCH="loop-linux-armv7"
|
|
|
|
if [ $IS_X86 = 1 ]; then
|
|
|
|
LOOP_ARCH="loop-linux-amd64"
|
|
|
|
fi
|
2024-01-08 00:56:37 +00:00
|
|
|
if [ $IS_ARM64 = 1 ]; then
|
2021-04-28 02:53:49 +00:00
|
|
|
LOOP_ARCH="loop-linux-arm64"
|
|
|
|
fi
|
2020-02-09 02:20:35 +00:00
|
|
|
LOOP_UPGRADE_URL=https://github.com/lightninglabs/loop/releases/download/$LOOP_VERSION/$LOOP_ARCH-$LOOP_VERSION.tar.gz
|
|
|
|
CURRENT=""
|
2020-08-30 03:32:36 +00:00
|
|
|
if [ -f $LOOP_VERSION_FILE ]; then
|
|
|
|
CURRENT=$(cat $LOOP_VERSION_FILE)
|
2020-02-09 02:20:35 +00:00
|
|
|
fi
|
2020-09-03 02:59:32 +00:00
|
|
|
if [ "$CURRENT" != "$LOOP_VERSION" ]; then
|
2020-02-09 02:20:35 +00:00
|
|
|
# Download and install Loop
|
|
|
|
rm -rf /opt/download
|
|
|
|
mkdir -p /opt/download
|
|
|
|
cd /opt/download
|
|
|
|
|
|
|
|
wget $LOOP_UPGRADE_URL
|
2021-04-22 05:19:12 +00:00
|
|
|
wget $LOOP_UPGRADE_MANIFEST_URL -O manifest.txt
|
|
|
|
wget $LOOP_UPGRADE_MANIFEST_SIG_URL -O manifest.txt.sig
|
2020-02-09 02:20:35 +00:00
|
|
|
|
2021-04-22 05:19:12 +00:00
|
|
|
gpg --verify manifest.txt.sig manifest.txt
|
2020-02-09 02:20:35 +00:00
|
|
|
if [ $? == 0 ]; then
|
|
|
|
# Install Loop
|
|
|
|
tar -xzf loop-*.tar.gz
|
|
|
|
mv $LOOP_ARCH-$LOOP_VERSION loop
|
|
|
|
install -m 0755 -o root -g root -t /usr/local/bin loop/*
|
|
|
|
|
|
|
|
# Mark current version
|
2020-08-30 03:32:36 +00:00
|
|
|
echo $LOOP_VERSION > $LOOP_VERSION_FILE
|
2020-02-09 02:20:35 +00:00
|
|
|
else
|
|
|
|
echo "ERROR UPGRADING LND - GPG FAILED"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2020-11-08 22:23:01 +00:00
|
|
|
# Install Pool
|
|
|
|
echo "Installing pool..."
|
|
|
|
POOL_ARCH="pool-linux-armv7"
|
|
|
|
if [ $IS_X86 = 1 ]; then
|
|
|
|
POOL_ARCH="pool-linux-amd64"
|
|
|
|
fi
|
2024-01-08 00:56:37 +00:00
|
|
|
if [ $IS_ARM64 = 1 ]; then
|
2021-04-28 02:53:49 +00:00
|
|
|
POOL_ARCH="pool-linux-arm64"
|
|
|
|
fi
|
2020-11-08 22:23:01 +00:00
|
|
|
POOL_UPGRADE_URL=https://github.com/lightninglabs/pool/releases/download/$POOL_VERSION/$POOL_ARCH-$POOL_VERSION.tar.gz
|
|
|
|
CURRENT=""
|
|
|
|
if [ -f $POOL_VERSION_FILE ]; then
|
|
|
|
CURRENT=$(cat $POOL_VERSION_FILE)
|
|
|
|
fi
|
|
|
|
if [ "$CURRENT" != "$POOL_VERSION" ]; then
|
|
|
|
# Download and install pool
|
|
|
|
rm -rf /opt/download
|
|
|
|
mkdir -p /opt/download
|
|
|
|
cd /opt/download
|
|
|
|
|
|
|
|
wget $POOL_UPGRADE_URL
|
2021-04-22 05:19:12 +00:00
|
|
|
wget $POOL_UPGRADE_MANIFEST_URL -O manifest.txt
|
2021-08-17 04:21:26 +00:00
|
|
|
wget $POOL_UPGRADE_MANIFEST_SIG_URL -O manifest.txt.sig
|
2020-11-08 22:23:01 +00:00
|
|
|
|
2021-08-17 04:21:26 +00:00
|
|
|
gpg --verify manifest.txt.sig manifest.txt
|
2020-11-08 22:23:01 +00:00
|
|
|
if [ $? == 0 ]; then
|
|
|
|
# Install Pool
|
|
|
|
tar -xzf pool-*.tar.gz
|
|
|
|
mv $POOL_ARCH-$POOL_VERSION pool
|
|
|
|
install -m 0755 -o root -g root -t /usr/local/bin pool/*
|
|
|
|
|
|
|
|
# Mark current version
|
|
|
|
echo $POOL_VERSION > $POOL_VERSION_FILE
|
|
|
|
else
|
|
|
|
echo "ERROR UPGRADING POOL - GPG FAILED"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2021-03-31 03:09:55 +00:00
|
|
|
# Install Lightning Terminal
|
|
|
|
echo "Installing lit..."
|
|
|
|
LIT_ARCH="lightning-terminal-linux-armv7"
|
|
|
|
if [ $IS_X86 = 1 ]; then
|
|
|
|
LIT_ARCH="lightning-terminal-linux-amd64"
|
|
|
|
fi
|
2024-01-08 00:56:37 +00:00
|
|
|
if [ $IS_ARM64 = 1 ]; then
|
2021-04-28 02:53:49 +00:00
|
|
|
LIT_ARCH="lightning-terminal-linux-arm64"
|
|
|
|
fi
|
2021-03-31 03:09:55 +00:00
|
|
|
LIT_UPGRADE_URL=https://github.com/lightninglabs/lightning-terminal/releases/download/$LIT_VERSION/$LIT_ARCH-$LIT_VERSION.tar.gz
|
|
|
|
CURRENT=""
|
|
|
|
if [ -f $LIT_VERSION_FILE ]; then
|
|
|
|
CURRENT=$(cat $LIT_VERSION_FILE)
|
|
|
|
fi
|
|
|
|
if [ "$CURRENT" != "$LIT_VERSION" ]; then
|
|
|
|
# Download and install lit
|
|
|
|
rm -rf /opt/download
|
|
|
|
mkdir -p /opt/download
|
|
|
|
cd /opt/download
|
|
|
|
|
|
|
|
wget $LIT_UPGRADE_URL
|
2021-04-22 05:19:12 +00:00
|
|
|
wget $LIT_UPGRADE_MANIFEST_URL -O manifest.txt
|
|
|
|
wget $LIT_UPGRADE_MANIFEST_SIG_URL -O manifest.txt.sig
|
2021-03-31 03:09:55 +00:00
|
|
|
|
2021-04-22 05:19:12 +00:00
|
|
|
gpg --verify manifest.txt.sig manifest.txt
|
2021-03-31 03:09:55 +00:00
|
|
|
if [ $? == 0 ]; then
|
|
|
|
# Install lit
|
|
|
|
tar -xzf lightning-terminal-*.tar.gz
|
|
|
|
mv $LIT_ARCH-$LIT_VERSION lightning-terminal
|
|
|
|
install -m 0755 -o root -g root -t /usr/local/bin lightning-terminal/lit*
|
|
|
|
|
|
|
|
# Mark current version
|
|
|
|
echo $LIT_VERSION > $LIT_VERSION_FILE
|
|
|
|
else
|
|
|
|
echo "ERROR UPGRADING LIT - GPG FAILED"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
cd ~
|
|
|
|
|
2023-07-29 05:32:31 +00:00
|
|
|
# Upgrade Lightning Chantools
|
|
|
|
echo "Upgrading chantools..."
|
|
|
|
CHANTOOLS_ARCH="chantools-linux-armv7"
|
|
|
|
if [ $IS_X86 = 1 ]; then
|
|
|
|
CHANTOOLS_ARCH="chantools-linux-amd64"
|
|
|
|
fi
|
2024-01-08 00:56:37 +00:00
|
|
|
if [ $IS_ARM64 = 1 ]; then
|
2023-07-29 05:32:31 +00:00
|
|
|
CHANTOOLS_ARCH="chantools-linux-arm64"
|
|
|
|
fi
|
|
|
|
CHANTOOLS_UPGRADE_URL=https://github.com/lightninglabs/chantools/releases/download/$CHANTOOLS_VERSION/$CHANTOOLS_ARCH-$CHANTOOLS_VERSION.tar.gz
|
|
|
|
CURRENT=""
|
|
|
|
if [ -f $CHANTOOLS_VERSION_FILE ]; then
|
|
|
|
CURRENT=$(cat $CHANTOOLS_VERSION_FILE)
|
|
|
|
fi
|
|
|
|
if [ "$CURRENT" != "$CHANTOOLS_VERSION" ]; then
|
|
|
|
# Download and install lit
|
|
|
|
rm -rf /opt/download
|
|
|
|
mkdir -p /opt/download
|
|
|
|
cd /opt/download
|
|
|
|
|
|
|
|
wget $CHANTOOLS_UPGRADE_URL
|
|
|
|
wget $CHANTOOLS_UPGRADE_MANIFEST_URL -O manifest.txt
|
|
|
|
wget $CHANTOOLS_UPGRADE_MANIFEST_SIG_URL -O manifest.txt.sig
|
|
|
|
|
|
|
|
gpg --verify manifest.txt.sig manifest.txt
|
|
|
|
if [ $? == 0 ]; then
|
|
|
|
# Install lit
|
|
|
|
tar -xzf chantools-*.tar.gz
|
|
|
|
mv $CHANTOOLS_ARCH-$CHANTOOLS_VERSION chantools
|
|
|
|
install -m 0755 -o root -g root -t /usr/local/bin chantools/chantools
|
|
|
|
|
|
|
|
# Mark current version
|
|
|
|
echo $CHANTOOLS_VERSION > $CHANTOOLS_VERSION_FILE
|
|
|
|
else
|
|
|
|
echo "ERROR UPGRADING CHANTOOLS - GPG FAILED"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
cd ~
|
|
|
|
|
2020-02-09 02:20:35 +00:00
|
|
|
|
2019-06-26 04:15:07 +00:00
|
|
|
# Setup "install" location for some apps
|
|
|
|
mkdir -p /opt/mynode
|
|
|
|
chown -R bitcoin:bitcoin /opt/mynode
|
|
|
|
|
|
|
|
|
|
|
|
# Install LND Hub
|
2023-09-09 01:02:11 +00:00
|
|
|
# Skip - no longer default app
|
2019-06-26 04:15:07 +00:00
|
|
|
|
2020-06-06 01:46:39 +00:00
|
|
|
# Install Caravan
|
2021-06-03 05:07:06 +00:00
|
|
|
# Skip - no longer default app
|
2020-06-06 01:46:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Install cors proxy (my fork)
|
2020-08-27 01:12:48 +00:00
|
|
|
CORSPROXY_UPGRADE_URL=https://github.com/tehelsper/CORS-Proxy/archive/$CORSPROXY_VERSION.tar.gz
|
2020-06-06 01:46:39 +00:00
|
|
|
CURRENT=""
|
2020-09-07 21:13:45 +00:00
|
|
|
if [ -f $CORSPROXY_VERSION_FILE ]; then
|
|
|
|
CURRENT=$(cat $CORSPROXY_VERSION_FILE)
|
2020-06-06 01:46:39 +00:00
|
|
|
fi
|
2020-09-07 21:13:45 +00:00
|
|
|
if [ "$CURRENT" != "$CORSPROXY_VERSION" ]; then
|
2020-06-06 01:46:39 +00:00
|
|
|
cd /opt/mynode
|
|
|
|
rm -rf corsproxy
|
|
|
|
|
|
|
|
rm -f corsproxy.tar.gz
|
|
|
|
wget $CORSPROXY_UPGRADE_URL -O corsproxy.tar.gz
|
2020-08-27 01:12:48 +00:00
|
|
|
tar -xzf corsproxy.tar.gz
|
2020-06-06 01:46:39 +00:00
|
|
|
rm -f corsproxy.tar.gz
|
|
|
|
mv CORS-* corsproxy
|
|
|
|
|
|
|
|
cd corsproxy
|
|
|
|
npm install
|
2020-09-07 21:13:45 +00:00
|
|
|
echo $CORSPROXY_VERSION > $CORSPROXY_VERSION_FILE
|
2020-06-06 01:46:39 +00:00
|
|
|
fi
|
|
|
|
cd ~
|
|
|
|
|
|
|
|
|
2021-11-06 22:02:57 +00:00
|
|
|
# Install Electrs (just mark version, now included in overlay)
|
2021-06-16 03:42:17 +00:00
|
|
|
echo $ELECTRS_VERSION > $ELECTRS_VERSION_FILE
|
2019-06-26 04:15:07 +00:00
|
|
|
|
|
|
|
|
2019-12-23 05:46:42 +00:00
|
|
|
# Install recent version of secp256k1
|
|
|
|
echo "Installing secp256k1..."
|
2021-12-08 01:59:40 +00:00
|
|
|
SECP256K1_UPGRADE_URL=https://github.com/bitcoin-core/secp256k1/archive/$SECP256K1_VERSION.tar.gz
|
|
|
|
CURRENT=""
|
|
|
|
if [ -f $SECP256K1_VERSION_FILE ]; then
|
|
|
|
CURRENT=$(cat $SECP256K1_VERSION_FILE)
|
|
|
|
fi
|
|
|
|
if [ "$CURRENT" != "$SECP256K1_VERSION" ]; then
|
2019-12-23 05:46:42 +00:00
|
|
|
rm -rf /tmp/secp256k1
|
|
|
|
cd /tmp/
|
|
|
|
git clone https://github.com/bitcoin-core/secp256k1.git
|
|
|
|
cd secp256k1
|
|
|
|
|
|
|
|
./autogen.sh
|
2021-12-08 01:59:40 +00:00
|
|
|
./configure --enable-module-recovery --disable-jni --enable-experimental --enable-module-ecdh --enable-benchmark=no
|
2019-12-23 05:46:42 +00:00
|
|
|
make
|
|
|
|
make install
|
|
|
|
cp -f include/* /usr/include/
|
2021-12-08 01:59:40 +00:00
|
|
|
|
|
|
|
echo $SECP256K1_VERSION > $SECP256K1_VERSION_FILE
|
2019-12-23 05:46:42 +00:00
|
|
|
fi
|
|
|
|
|
2021-02-18 03:22:05 +00:00
|
|
|
echo "Installing JoinInBox..."
|
2020-05-03 03:20:49 +00:00
|
|
|
if [ $IS_RASPI = 1 ] || [ $IS_X86 = 1 ]; then
|
2021-02-18 03:22:05 +00:00
|
|
|
JOININBOX_UPGRADE_URL=https://github.com/openoms/joininbox/archive/$JOININBOX_VERSION.tar.gz
|
2020-05-03 03:20:49 +00:00
|
|
|
CURRENT=""
|
2021-02-18 03:22:05 +00:00
|
|
|
if [ -f $JOININBOX_VERSION_FILE ]; then
|
|
|
|
CURRENT=$(cat $JOININBOX_VERSION_FILE)
|
2020-05-03 03:20:49 +00:00
|
|
|
fi
|
2021-02-18 03:22:05 +00:00
|
|
|
if [ "$CURRENT" != "$JOININBOX_VERSION" ]; then
|
|
|
|
# Download and build JoinInBox
|
|
|
|
cd /home/joinmarket
|
|
|
|
|
|
|
|
# Delete all non-hidden files
|
|
|
|
rm -rf *
|
|
|
|
rm -rf joininbox-*
|
|
|
|
|
|
|
|
sudo -u joinmarket wget $JOININBOX_UPGRADE_URL -O joininbox.tar.gz
|
|
|
|
sudo -u joinmarket tar -xvf joininbox.tar.gz
|
|
|
|
sudo -u joinmarket rm joininbox.tar.gz
|
|
|
|
mv joininbox-* joininbox
|
|
|
|
|
|
|
|
chmod -R +x ./joininbox/
|
|
|
|
sudo -u joinmarket cp -rf ./joininbox/scripts/* .
|
|
|
|
|
2021-12-17 04:52:30 +00:00
|
|
|
# Use Python3.7 on RP4 32-bit
|
|
|
|
JM_ENV_VARS=""
|
2021-12-17 05:30:02 +00:00
|
|
|
if [ $IS_32_BIT = 1 ]; then
|
2021-12-17 04:52:30 +00:00
|
|
|
JM_ENV_VARS="export JM_PYTHON=python3.7; "
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Install
|
2022-11-24 01:22:45 +00:00
|
|
|
sudo -u joinmarket bash -c "cd /home/joinmarket/; ${JM_ENV_VARS} ./install.joinmarket.sh --install install" || true
|
2022-10-16 13:16:04 +00:00
|
|
|
sudo -u joinmarket bash -c "cd /home/joinmarket/; ${JM_ENV_VARS} ./install.joinmarket-api.sh on" || true
|
2023-12-21 04:35:50 +00:00
|
|
|
|
|
|
|
# Cleanup apt-get cache to save some space
|
|
|
|
apt-get clean
|
2022-10-16 13:16:04 +00:00
|
|
|
|
2022-11-24 01:22:45 +00:00
|
|
|
# Enable obwatcher at the end of setup_device.sh
|
2021-12-17 04:52:30 +00:00
|
|
|
|
2021-02-18 03:22:05 +00:00
|
|
|
echo $JOININBOX_VERSION > $JOININBOX_VERSION_FILE
|
2020-05-03 03:20:49 +00:00
|
|
|
fi
|
|
|
|
fi
|
2019-12-23 05:46:42 +00:00
|
|
|
|
2019-12-26 05:11:29 +00:00
|
|
|
# Install Whirlpool
|
2020-09-03 00:54:31 +00:00
|
|
|
WHIRLPOOL_UPGRADE_URL=https://code.samourai.io/whirlpool/whirlpool-client-cli/uploads/$WHIRLPOOL_UPLOAD_FILE_ID/whirlpool-client-cli-$WHIRLPOOL_VERSION-run.jar
|
2019-12-26 05:11:29 +00:00
|
|
|
CURRENT=""
|
2020-09-03 00:54:31 +00:00
|
|
|
if [ -f $WHIRLPOOL_VERSION_FILE ]; then
|
|
|
|
CURRENT=$(cat $WHIRLPOOL_VERSION_FILE)
|
2019-12-26 05:11:29 +00:00
|
|
|
fi
|
2020-09-03 02:26:02 +00:00
|
|
|
if [ "$CURRENT" != "$WHIRLPOOL_VERSION" ]; then
|
2019-12-26 05:11:29 +00:00
|
|
|
sudo -u bitcoin mkdir -p /opt/mynode/whirlpool
|
|
|
|
cd /opt/mynode/whirlpool
|
|
|
|
sudo rm -rf *.jar
|
|
|
|
sudo -u bitcoin wget -O whirlpool.jar $WHIRLPOOL_UPGRADE_URL
|
2020-08-27 01:12:48 +00:00
|
|
|
|
2021-08-06 03:10:22 +00:00
|
|
|
cp -f $TMP_INSTALL_PATH/usr/share/whirlpool/whirlpool.asc whirlpool.asc
|
2020-09-02 04:08:42 +00:00
|
|
|
gpg --verify whirlpool.asc
|
|
|
|
|
2020-09-03 00:54:31 +00:00
|
|
|
echo $WHIRLPOOL_VERSION > $WHIRLPOOL_VERSION_FILE
|
2019-12-26 05:11:29 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2019-06-26 04:15:07 +00:00
|
|
|
# Install RTL
|
2020-01-10 05:10:07 +00:00
|
|
|
RTL_UPGRADE_URL=https://github.com/Ride-The-Lightning/RTL/archive/$RTL_VERSION.tar.gz
|
|
|
|
RTL_UPGRADE_ASC_URL=https://github.com/Ride-The-Lightning/RTL/releases/download/$RTL_VERSION/$RTL_VERSION.tar.gz.asc
|
2019-07-28 22:41:37 +00:00
|
|
|
CURRENT=""
|
2020-08-30 03:32:54 +00:00
|
|
|
if [ -f $RTL_VERSION_FILE ]; then
|
|
|
|
CURRENT=$(cat $RTL_VERSION_FILE)
|
2019-07-28 22:41:37 +00:00
|
|
|
fi
|
2020-08-30 03:32:54 +00:00
|
|
|
if [ "$CURRENT" != "$RTL_VERSION" ]; then
|
2019-06-30 21:13:04 +00:00
|
|
|
cd /opt/mynode
|
|
|
|
rm -rf RTL
|
2020-08-27 01:12:48 +00:00
|
|
|
|
2019-07-28 22:41:37 +00:00
|
|
|
sudo -u bitcoin wget $RTL_UPGRADE_URL -O RTL.tar.gz
|
2020-01-22 03:46:14 +00:00
|
|
|
#sudo -u bitcoin wget $RTL_UPGRADE_ASC_URL -O RTL.tar.gz.asc
|
2020-01-10 05:10:07 +00:00
|
|
|
|
|
|
|
#gpg --verify RTL.tar.gz.asc RTL.tar.gz
|
|
|
|
|
2019-06-30 21:13:04 +00:00
|
|
|
sudo -u bitcoin tar -xvf RTL.tar.gz
|
|
|
|
sudo -u bitcoin rm RTL.tar.gz
|
|
|
|
sudo -u bitcoin mv RTL-* RTL
|
|
|
|
cd RTL
|
2022-04-05 00:12:51 +00:00
|
|
|
sudo -u bitcoin NG_CLI_ANALYTICS=false npm install --only=production --legacy-peer-deps
|
2020-08-27 01:12:48 +00:00
|
|
|
|
2020-08-30 03:32:54 +00:00
|
|
|
echo $RTL_VERSION > $RTL_VERSION_FILE
|
2019-06-30 21:13:04 +00:00
|
|
|
fi
|
2019-06-26 04:15:07 +00:00
|
|
|
|
|
|
|
|
2020-03-26 01:02:40 +00:00
|
|
|
# Install BTC RPC Explorer
|
2020-08-27 01:12:48 +00:00
|
|
|
BTCRPCEXPLORER_UPGRADE_URL=https://github.com/janoside/btc-rpc-explorer/archive/$BTCRPCEXPLORER_VERSION.tar.gz
|
2019-07-28 22:41:37 +00:00
|
|
|
CURRENT=""
|
2020-09-07 21:13:45 +00:00
|
|
|
if [ -f $BTCRPCEXPLORER_VERSION_FILE ]; then
|
|
|
|
CURRENT=$(cat $BTCRPCEXPLORER_VERSION_FILE)
|
2019-07-28 22:41:37 +00:00
|
|
|
fi
|
2020-09-07 21:13:45 +00:00
|
|
|
if [ "$CURRENT" != "$BTCRPCEXPLORER_VERSION" ]; then
|
2019-06-30 21:13:04 +00:00
|
|
|
cd /opt/mynode
|
|
|
|
rm -rf btc-rpc-explorer
|
2019-07-28 22:41:37 +00:00
|
|
|
sudo -u bitcoin wget $BTCRPCEXPLORER_UPGRADE_URL -O btc-rpc-explorer.tar.gz
|
2019-06-30 21:13:04 +00:00
|
|
|
sudo -u bitcoin tar -xvf btc-rpc-explorer.tar.gz
|
|
|
|
sudo -u bitcoin rm btc-rpc-explorer.tar.gz
|
|
|
|
sudo -u bitcoin mv btc-rpc-* btc-rpc-explorer
|
|
|
|
cd btc-rpc-explorer
|
2019-11-29 21:55:55 +00:00
|
|
|
sudo -u bitcoin npm install --only=production
|
2019-07-28 22:41:37 +00:00
|
|
|
|
2020-09-07 21:13:45 +00:00
|
|
|
echo $BTCRPCEXPLORER_VERSION > $BTCRPCEXPLORER_VERSION_FILE
|
2019-06-30 21:13:04 +00:00
|
|
|
fi
|
2019-06-26 04:15:07 +00:00
|
|
|
|
|
|
|
|
2020-07-30 00:19:55 +00:00
|
|
|
# Upgrade Specter Desktop
|
|
|
|
CURRENT=""
|
2020-08-30 03:32:36 +00:00
|
|
|
if [ -f $SPECTER_VERSION_FILE ]; then
|
|
|
|
CURRENT=$(cat $SPECTER_VERSION_FILE)
|
2020-07-30 00:19:55 +00:00
|
|
|
fi
|
2020-09-03 02:59:32 +00:00
|
|
|
if [ "$CURRENT" != "$SPECTER_VERSION" ]; then
|
2020-07-30 00:19:55 +00:00
|
|
|
cd /opt/mynode
|
|
|
|
rm -rf specter
|
|
|
|
mkdir -p specter
|
|
|
|
chown -R bitcoin:bitcoin specter
|
|
|
|
cd specter
|
|
|
|
|
|
|
|
# Make venv
|
|
|
|
if [ ! -d env ]; then
|
|
|
|
sudo -u bitcoin python3 -m venv env
|
|
|
|
fi
|
|
|
|
source env/bin/activate
|
|
|
|
pip3 install ecdsa===0.13.3
|
2020-09-03 02:59:32 +00:00
|
|
|
pip3 install cryptoadvance.specter===$SPECTER_VERSION --upgrade
|
2020-07-30 00:19:55 +00:00
|
|
|
deactivate
|
|
|
|
|
2020-09-03 02:59:32 +00:00
|
|
|
echo $SPECTER_VERSION > $SPECTER_VERSION_FILE
|
2020-07-30 00:19:55 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Upgrade Thunderhub
|
2020-08-27 01:12:48 +00:00
|
|
|
THUNDERHUB_UPGRADE_URL=https://github.com/apotdevin/thunderhub/archive/$THUNDERHUB_VERSION.tar.gz
|
2020-07-30 00:19:55 +00:00
|
|
|
CURRENT=""
|
2020-08-30 03:32:36 +00:00
|
|
|
if [ -f $THUNDERHUB_VERSION_FILE ]; then
|
|
|
|
CURRENT=$(cat $THUNDERHUB_VERSION_FILE)
|
2020-07-30 00:19:55 +00:00
|
|
|
fi
|
2020-08-30 03:32:36 +00:00
|
|
|
if [ "$CURRENT" != "$THUNDERHUB_VERSION" ]; then
|
2020-07-30 00:19:55 +00:00
|
|
|
cd /opt/mynode
|
|
|
|
rm -rf thunderhub
|
|
|
|
sudo -u bitcoin wget $THUNDERHUB_UPGRADE_URL -O thunderhub.tar.gz
|
|
|
|
sudo -u bitcoin tar -xvf thunderhub.tar.gz
|
|
|
|
sudo -u bitcoin rm thunderhub.tar.gz
|
|
|
|
sudo -u bitcoin mv thunderhub-* thunderhub
|
|
|
|
cd thunderhub
|
|
|
|
|
2022-05-25 01:45:42 +00:00
|
|
|
# Patch versions
|
2023-09-04 03:27:41 +00:00
|
|
|
#sed -i 's/\^5.3.5/5.3.3/g' package.json || true # Fixes segfault with 5.3.5 on x86
|
2022-05-25 01:45:42 +00:00
|
|
|
|
2023-09-04 03:27:41 +00:00
|
|
|
sudo -u bitcoin npm install # --only=production # (can't build with only production)
|
2020-07-30 00:19:55 +00:00
|
|
|
sudo -u bitcoin npm run build
|
|
|
|
sudo -u bitcoin npx next telemetry disable
|
|
|
|
|
|
|
|
# Setup symlink to service files
|
|
|
|
rm -f /opt/mynode/thunderhub/.env.local
|
|
|
|
sudo ln -s /mnt/hdd/mynode/thunderhub/.env.local /opt/mynode/thunderhub/.env.local
|
2020-08-27 01:12:48 +00:00
|
|
|
|
2020-08-30 03:32:36 +00:00
|
|
|
echo $THUNDERHUB_VERSION > $THUNDERHUB_VERSION_FILE
|
2020-07-30 00:19:55 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2019-06-26 04:15:07 +00:00
|
|
|
# Install LND Connect
|
2019-10-03 03:10:20 +00:00
|
|
|
LNDCONNECTARCH="lndconnect-linux-armv7"
|
|
|
|
if [ $IS_X86 = 1 ]; then
|
|
|
|
LNDCONNECTARCH="lndconnect-linux-amd64"
|
|
|
|
fi
|
2020-08-27 01:12:48 +00:00
|
|
|
LNDCONNECT_UPGRADE_URL=https://github.com/LN-Zap/lndconnect/releases/download/v0.2.0/$LNDCONNECTARCH-$LNDCONNECT_VERSION.tar.gz
|
2019-07-28 22:41:37 +00:00
|
|
|
CURRENT=""
|
2020-09-07 21:13:45 +00:00
|
|
|
if [ -f $LNDCONNECT_VERSION_FILE ]; then
|
|
|
|
CURRENT=$(cat $LNDCONNECT_VERSION_FILE)
|
2019-07-28 22:41:37 +00:00
|
|
|
fi
|
2020-09-07 21:13:45 +00:00
|
|
|
if [ "$CURRENT" != "$LNDCONNECT_VERSION" ]; then
|
2020-02-05 02:17:25 +00:00
|
|
|
rm -rf /opt/download
|
|
|
|
mkdir -p /opt/download
|
|
|
|
cd /opt/download
|
2019-07-28 22:41:37 +00:00
|
|
|
wget $LNDCONNECT_UPGRADE_URL -O lndconnect.tar.gz
|
2019-06-30 21:13:04 +00:00
|
|
|
tar -xvf lndconnect.tar.gz
|
|
|
|
rm lndconnect.tar.gz
|
|
|
|
mv lndconnect-* lndconnect
|
2020-08-27 01:12:48 +00:00
|
|
|
install -m 0755 -o root -g root -t /usr/local/bin lndconnect/*
|
2019-07-28 22:41:37 +00:00
|
|
|
|
2020-09-07 21:13:45 +00:00
|
|
|
echo $LNDCONNECT_VERSION > $LNDCONNECT_VERSION_FILE
|
2019-06-30 21:13:04 +00:00
|
|
|
fi
|
2019-06-26 04:15:07 +00:00
|
|
|
|
2019-10-10 02:50:07 +00:00
|
|
|
|
|
|
|
# Install ngrok for debugging
|
|
|
|
if [ ! -f /usr/bin/ngrok ]; then
|
|
|
|
cd /tmp
|
|
|
|
NGROK_URL=https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-arm.zip
|
|
|
|
if [ $IS_X86 = 1 ]; then
|
|
|
|
NGROK_URL=https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-386.zip
|
|
|
|
fi
|
|
|
|
wget $NGROK_URL
|
|
|
|
unzip ngrok-*.zip
|
|
|
|
cp ngrok /usr/bin/
|
|
|
|
fi
|
|
|
|
|
2022-09-24 02:51:16 +00:00
|
|
|
# Make sure "Remote Access" apps are marked installed
|
|
|
|
touch /home/bitcoin/.mynode/install_tor
|
|
|
|
touch /home/bitcoin/.mynode/install_premium_plus
|
|
|
|
touch /home/bitcoin/.mynode/install_vpn
|
2021-02-10 05:37:43 +00:00
|
|
|
|
2021-06-16 03:42:17 +00:00
|
|
|
# Mark docker images for install (on SD so install occurs after drive attach)
|
|
|
|
touch /home/bitcoin/.mynode/install_mempool
|
2021-12-08 02:31:06 +00:00
|
|
|
touch /home/bitcoin/.mynode/install_btcpayserver
|
2021-02-10 05:37:43 +00:00
|
|
|
|
2022-08-12 03:25:00 +00:00
|
|
|
# SKIPPING LNBITS - OPTIONAL ALL
|
|
|
|
# SKIPPING CKBUNKER - OPTIONAL APP
|
|
|
|
# SKIPPING SPHINX - OPTIONAL APP
|
2021-05-18 04:02:54 +00:00
|
|
|
# SKIPPING BOS - OPTIONAL APP
|
2021-05-14 03:50:05 +00:00
|
|
|
# SKIPPING PYBLOCK - OPTIONAL APP
|
|
|
|
# SKIPPING WARDEN - OPTIONAL APP
|
|
|
|
|
|
|
|
|
2020-03-06 00:26:36 +00:00
|
|
|
# Make sure we are using legacy iptables
|
|
|
|
update-alternatives --set iptables /usr/sbin/iptables-legacy || true
|
|
|
|
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy || true
|
|
|
|
|
2020-02-05 02:17:25 +00:00
|
|
|
|
2019-06-26 04:15:07 +00:00
|
|
|
#########################################################
|
|
|
|
|
|
|
|
|
2021-04-22 05:19:12 +00:00
|
|
|
# Install files (downloaded and extracted earlier)
|
2022-01-25 03:50:13 +00:00
|
|
|
rsync -r -K /tmp/upgrade/out/rootfs_*/* /
|
2019-06-26 04:15:07 +00:00
|
|
|
sync
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
|
2022-05-12 04:40:57 +00:00
|
|
|
# Mark dynamic applications as defalt application
|
|
|
|
# ... (none yet)
|
|
|
|
|
|
|
|
# Upgrade Dyanmic Applications (must be done after file installation)
|
|
|
|
# mynode-manage-apps upgrade # not yet working during setup process
|
|
|
|
|
|
|
|
|
2020-02-10 01:36:09 +00:00
|
|
|
# Enable fan control
|
|
|
|
if [ $IS_ROCKPRO64 = 1 ]; then
|
|
|
|
systemctl enable fan_control
|
|
|
|
fi
|
|
|
|
|
2021-11-24 02:52:30 +00:00
|
|
|
# Random Cleanup
|
|
|
|
rm -rf /opt/download
|
|
|
|
mkdir -p /opt/download
|
|
|
|
|
|
|
|
# Clean apt-cache
|
|
|
|
apt-get clean
|
2020-02-10 01:36:09 +00:00
|
|
|
|
2023-12-01 22:06:57 +00:00
|
|
|
# Setup MyNode Startup Script
|
2019-06-26 04:15:07 +00:00
|
|
|
systemctl daemon-reload
|
2020-07-30 00:19:55 +00:00
|
|
|
systemctl enable check_in
|
2022-02-17 03:49:16 +00:00
|
|
|
systemctl enable premium_plus_connect
|
2020-09-10 03:10:14 +00:00
|
|
|
systemctl enable background
|
2020-07-07 01:43:28 +00:00
|
|
|
systemctl enable docker
|
2019-06-26 04:15:07 +00:00
|
|
|
systemctl enable mynode
|
|
|
|
systemctl enable quicksync
|
|
|
|
systemctl enable torrent_check
|
|
|
|
systemctl enable firewall
|
|
|
|
systemctl enable bandwidth
|
|
|
|
systemctl enable www
|
|
|
|
systemctl enable drive_check
|
2021-04-11 00:51:26 +00:00
|
|
|
systemctl enable bitcoin
|
2020-08-24 01:26:26 +00:00
|
|
|
systemctl enable seed_bitcoin_peers
|
2019-06-26 04:15:07 +00:00
|
|
|
systemctl enable lnd
|
2021-04-11 00:51:26 +00:00
|
|
|
systemctl enable loop
|
|
|
|
systemctl enable pool
|
|
|
|
systemctl enable lit
|
2021-06-20 04:36:18 +00:00
|
|
|
#systemctl enable lnd_unlock # NOT NECESSARY WITH LND 0.13+
|
2019-06-26 04:15:07 +00:00
|
|
|
systemctl enable lnd_backup
|
|
|
|
systemctl enable lnd_admin_files
|
|
|
|
systemctl enable lndconnect
|
|
|
|
systemctl enable redis-server
|
2019-11-30 17:40:59 +00:00
|
|
|
#systemctl enable mongodb
|
2019-06-26 04:15:07 +00:00
|
|
|
#systemctl enable electrs # DISABLED BY DEFAULT
|
|
|
|
#systemctl enable lndhub # DISABLED BY DEFAULT
|
2021-04-11 00:51:26 +00:00
|
|
|
#systemctl enable btcrpcexplorer # DISABLED BY DEFAULT
|
2019-06-26 04:15:07 +00:00
|
|
|
systemctl enable rtl
|
2019-06-29 15:53:33 +00:00
|
|
|
systemctl enable tor
|
2019-09-24 01:50:19 +00:00
|
|
|
systemctl enable invalid_block_check
|
2019-10-14 01:47:14 +00:00
|
|
|
systemctl enable usb_driver_check
|
2019-11-30 03:29:55 +00:00
|
|
|
systemctl enable docker_images
|
2019-11-12 02:35:05 +00:00
|
|
|
systemctl enable glances
|
2020-04-02 01:54:50 +00:00
|
|
|
#systemctl enable netdata # DISABLED BY DEFAULT
|
2019-11-29 22:08:54 +00:00
|
|
|
systemctl enable webssh2
|
2020-02-10 03:25:47 +00:00
|
|
|
systemctl enable rotate_logs
|
2020-06-06 01:46:39 +00:00
|
|
|
systemctl enable corsproxy_btcrpc
|
2021-12-29 18:50:03 +00:00
|
|
|
systemctl enable usb_extras
|
2022-11-24 01:22:45 +00:00
|
|
|
systemctl enable ob-watcher
|
2023-03-24 01:56:25 +00:00
|
|
|
systemctl enable rathole
|
2019-06-26 04:15:07 +00:00
|
|
|
|
|
|
|
|
2019-12-09 03:46:22 +00:00
|
|
|
# Disable services
|
2020-02-23 05:47:54 +00:00
|
|
|
systemctl disable hitch || true
|
|
|
|
systemctl disable mongodb || true
|
2019-12-22 01:55:42 +00:00
|
|
|
systemctl disable dhcpcd || true
|
2023-12-14 04:24:14 +00:00
|
|
|
systemctl disable dphys-swapfile || true
|
2019-12-09 03:46:22 +00:00
|
|
|
|
2019-09-28 02:00:48 +00:00
|
|
|
|
2019-06-26 04:15:07 +00:00
|
|
|
# Delete junk
|
|
|
|
rm -rf /home/admin/download
|
|
|
|
rm -rf /home/admin/.bash_history
|
|
|
|
rm -rf /home/bitcoin/.bash_history
|
|
|
|
rm -rf /root/.bash_history
|
|
|
|
rm -rf /root/.ssh/known_hosts
|
|
|
|
rm -rf /etc/resolv.conf
|
|
|
|
rm -rf /tmp/*
|
2019-07-03 02:13:08 +00:00
|
|
|
rm -rf ~/setup_device.sh
|
2019-07-06 01:45:42 +00:00
|
|
|
rm -rf /etc/motd # Remove simple motd for update-motd.d
|
2019-06-26 04:15:07 +00:00
|
|
|
|
2022-08-01 01:50:16 +00:00
|
|
|
# Remove default debian stuff
|
|
|
|
deluser mynode || true
|
|
|
|
rm -rf /home/mynode || true
|
|
|
|
|
|
|
|
# Remove default Pi stuff
|
|
|
|
deluser pi || true
|
|
|
|
rm -rf /home/pi || true
|
|
|
|
|
2022-01-25 03:50:13 +00:00
|
|
|
# Regenerate MAC address for some Armbian devices
|
|
|
|
if [ $IS_ROCK64 = 1 ] || [ $IS_ROCKPRO64 = 1 ] ; then
|
2020-03-06 00:51:52 +00:00
|
|
|
. /usr/lib/armbian/armbian-common
|
|
|
|
CONNECTION="$(nmcli -f UUID,ACTIVE,DEVICE,TYPE connection show --active | tail -n1)"
|
|
|
|
UUID=$(awk -F" " '/ethernet/ {print $1}' <<< "${CONNECTION}")
|
|
|
|
get_random_mac
|
|
|
|
nmcli connection modify $UUID ethernet.cloned-mac-address $MACADDR
|
|
|
|
nmcli connection modify $UUID -ethernet.mac-address ""
|
|
|
|
fi
|
|
|
|
|
2022-11-24 01:22:45 +00:00
|
|
|
# Add fsck force to startup for x86
|
|
|
|
if [ $IS_X86 = 1 ]; then
|
2022-11-30 22:17:05 +00:00
|
|
|
sed -i "s/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"quiet fsck.mode=force fsck.repair=yes\"/g" /etc/default/grub
|
2022-11-24 01:22:45 +00:00
|
|
|
update-grub
|
|
|
|
fi
|
|
|
|
|
2022-05-20 02:52:32 +00:00
|
|
|
# Add generic boot option if UEFI
|
|
|
|
if [ -f /boot/efi/EFI/debian/grubx64.efi ]; then
|
|
|
|
mkdir -p /boot/efi/EFI/BOOT
|
|
|
|
cp -f /boot/efi/EFI/debian/grubx64.efi /boot/efi/EFI/BOOT/bootx64.efi
|
|
|
|
fi
|
|
|
|
|
2019-06-26 04:15:07 +00:00
|
|
|
sync
|
|
|
|
|
2019-06-30 21:13:04 +00:00
|
|
|
set +x
|
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
echo "##################################"
|
|
|
|
echo " SETUP COMPLETE "
|
|
|
|
echo " Reboot your device to begin! "
|
|
|
|
echo "##################################"
|
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
|
2019-06-26 04:15:07 +00:00
|
|
|
### MAKE IMAGE NOW ###
|
|
|
|
# This prevents auto gen files like certs to be part of the base image
|
|
|
|
# Must make sure image can boot after this point and fully come up
|