From c8b24f321bbd6eb649130224dd520acf17988149 Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Wed, 27 Oct 2021 20:44:23 -0500 Subject: [PATCH] Updates to setup_device.sh for fresh image creation --- .../standard/usr/bin/mynode_post_upgrade.sh | 15 +++++++++----- setup/setup_device.sh | 20 +++++++++++++------ 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/rootfs/standard/usr/bin/mynode_post_upgrade.sh b/rootfs/standard/usr/bin/mynode_post_upgrade.sh index e2b411b6..1efdc378 100755 --- a/rootfs/standard/usr/bin/mynode_post_upgrade.sh +++ b/rootfs/standard/usr/bin/mynode_post_upgrade.sh @@ -65,9 +65,11 @@ if ! skip_base_upgrades ; then # Add sources apt-get -y install apt-transport-https DEBIAN_VERSION=$(lsb_release -c | awk '{ print $2 }') - # Tor - 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 + # 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 # Raspbian mirrors #if [ $IS_RASPI = 1 ]; then # grep -qxF "deb http://plug-mirror.rcac.purdue.edu/raspbian/ ${DEBIAN_VERSION} main" /etc/apt/sources.list || echo "deb http://plug-mirror.rcac.purdue.edu/raspbian/ ${DEBIAN_VERSION} main" >> /etc/apt/sources.list @@ -84,7 +86,7 @@ if ! skip_base_upgrades ; then gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys E777299FC265DD04793070EB944D35F9AC3DB76A # Bitcoin - Michael Ford (fanquake) curl https://keybase.io/suheb/pgp_keys.asc | gpg --import curl https://samouraiwallet.com/pgp.txt | gpg --import # two keys from Samourai team - gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys DE23E73BFA8A0AD5587D2FCDE80D2F3F311FD87E #loopd + gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys DE23E73BFA8A0AD5587D2FCDE80D2F3F311FD87E #loopd $TORIFY curl https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --import # tor gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add - # tor set -e @@ -172,7 +174,7 @@ if ! skip_base_upgrades ; then pip3 install lndmanage==$LNDMANAGE_VERSION --no-cache-dir echo $LNDMANAGE_VERSION > $LNDMANAGE_VERSION_FILE - # Update Node (not well tested, especially app re-install) + # Update Node if [ -f /etc/apt/sources.list.d/nodesource.list ]; then CURRENT_NODE_VERSION=$(cat /etc/apt/sources.list.d/nodesource.list) if [[ "$CURRENT_NODE_VERSION" != *"node_${NODE_JS_VERSION}"* ]]; then @@ -195,6 +197,9 @@ if ! skip_base_upgrades ; then else echo "No node apt sources file?" fi + + # Update NPM (Node Package Manager) + npm install -g npm@latest # Install Docker if [ ! -f /usr/bin/docker ]; then diff --git a/setup/setup_device.sh b/setup/setup_device.sh index 7afc91be..57eae68b 100755 --- a/setup/setup_device.sh +++ b/setup/setup_device.sh @@ -23,6 +23,7 @@ IS_RASPI3=0 IS_RASPI4=0 IS_RASPI4_ARM64=0 IS_X86=0 +IS_64_BIT=0 IS_UNKNOWN=0 DEVICE_TYPE="unknown" MODEL=$(cat /proc/device-tree/model) || IS_UNKNOWN=1 @@ -30,9 +31,11 @@ uname -a | grep amd64 && IS_X86=1 && IS_UNKNOWN=0 || true if [[ $MODEL == *"Rock64"* ]]; then IS_ARMBIAN=1 IS_ROCK64=1 + IS_64_BIT=1 elif [[ $MODEL == *"RockPro64"* ]]; then IS_ARMBIAN=1 IS_ROCKPRO64=1 + IS_64_BIT=1 elif [[ $MODEL == *"Raspberry Pi 3"* ]]; then IS_RASPI=1 IS_RASPI3=1 @@ -42,6 +45,7 @@ elif [[ $MODEL == *"Raspberry Pi 4"* ]]; then UNAME=$(uname -a) if [[ $UNAME == *"aarch64"* ]]; then IS_RASPI4_ARM64=1 + IS_64_BIT=1 fi fi @@ -117,14 +121,16 @@ chown bitcoin:bitcoin /home/bitcoin chown -R bitcoin:bitcoin /home/bitcoin/.mynode/ # Update sources -apt-get -y update +apt-get -y update --allow-releaseinfo-change # Add sources apt-get -y install apt-transport-https curl gnupg DEBIAN_VERSION=$(lsb_release -c | awk '{ print $2 }') -# Tor -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 +# 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 # Raspbian mirrors # if [ $IS_RASPI = 1 ]; then # grep -qxF "deb http://plug-mirror.rcac.purdue.edu/raspbian/ ${DEBIAN_VERSION} main" /etc/apt/sources.list || echo "deb http://plug-mirror.rcac.purdue.edu/raspbian/ ${DEBIAN_VERSION} main" >> /etc/apt/sources.list @@ -137,9 +143,10 @@ curl https://keybase.io/bitconner/pgp_keys.asc | gpg --import curl https://keybase.io/guggero/pgp_keys.asc | gpg --import # Pool curl https://raw.githubusercontent.com/JoinMarket-Org/joinmarket-clientserver/master/pubkeys/AdamGibson.asc | gpg --import gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 01EA5486DE18A882D4C2684590C8019E36C2E964 +gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys E777299FC265DD04793070EB944D35F9AC3DB76A # Bitcoin - Michael Ford (fanquake) curl https://keybase.io/suheb/pgp_keys.asc | gpg --import curl https://samouraiwallet.com/pgp.txt | gpg --import # two keys from Samourai team -gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys DE23E73BFA8A0AD5587D2FCDE80D2F3F311FD87E #loopd +gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys DE23E73BFA8A0AD5587D2FCDE80D2F3F311FD87E #loopd curl https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --import # tor gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add - # tor @@ -283,6 +290,7 @@ usermod -aG docker root # Install node packages npm install -g pug-cli browserify uglify-js babel-cli +npm install -g npm@latest # Remove existing MOTD login info rm -rf /etc/motd @@ -324,7 +332,7 @@ if [ "$CURRENT" != "$BTC_VERSION" ]; then wget $BTC_UPGRADE_SHA256SUM_URL -O SHA256SUMS wget $BTC_UPGRADE_SHA256SUM_ASC_URL -O SHA256SUMS.asc - sha256sum --ignore-missing --check SHA256SUMS.asc + sha256sum --ignore-missing --check SHA256SUMS gpg --verify SHA256SUMS.asc SHA256SUMS |& grep "gpg: Good signature" # Install Bitcoin