Add Go (language)

This commit is contained in:
Taylor Helsper 2022-12-28 22:08:54 -06:00
parent 576696c5d5
commit a47c7b7775
3 changed files with 61 additions and 0 deletions

View File

@ -179,6 +179,35 @@ if ! skip_base_upgrades ; then
dpkg --configure -a
# 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
# 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

View File

@ -194,6 +194,9 @@ NODE_NPM_VERSION="^8.1.0"
RUST_VERSION="1.56.1"
GO_VERSION="1.19.4"
GO_VERSION_FILE=/home/bitcoin/.mynode/go_version
# Check for override files
if [ -f /usr/share/mynode/mynode_app_versions_custom.sh ]; then
source /usr/share/mynode/mynode_app_versions_custom.sh

View File

@ -273,6 +273,35 @@ adduser joinmarket bitcoin
grep "joinmarket" /etc/sudoers || (echo 'joinmarket ALL=(ALL) NOPASSWD:ALL' | EDITOR='tee -a' visudo)
# 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
# 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