#!/bin/bash # This script automatically downloads and installs the appropriate Netrinos EdgeNode # for the current system architecture. It should be run with superuser privileges. # # Usage: # sudo ./install-edgenode.sh [version] # # or directly from the shell with: # # curl -fsSL https://dist.netrinos.com/edgenode/install-edgenode.sh | sudo bash -s [version] # # Examples: # sudo bash install-edgenode.sh daily # sudo bash install-edgenode.sh latest # sudo bash install-edgenode.sh 1.2.5 # Detect the system architecture detected_arch=$(uname -m) # Get the version from the command line argument, or use a default value version=${1:-latest} version=${version,,} # to lowercase # Define the base URL of the .deb packages base_url="https://dist.netrinos.com/edgenode" # Set subfolder based on version case "$version" in beta) base_url="$base_url/beta" ;; daily) base_url="$base_url/daily" ;; latest) # latest is in main folder ;; *) base_url="$base_url/archive" ;; esac # Choose the appropriate .deb package based on the architecture case "$detected_arch" in x86_64) arch="amd64" ;; arm) arch="arm" ;; aarch64) arch="arm64" ;; armhf|armv6l|armv7l) arch="armhf" ;; *) echo "Unsupported architecture: $detected_arch" exit 1 ;; esac # Define the filename filename="netrinos-edgenode-linux_${version}_${arch}.deb" # Define the URL url="$base_url/$filename" echo Using: $url # Define the temporary file tmpfile=$(mktemp) # Download the .deb package wget -O "$tmpfile" "$url" # Install the .deb package sudo dpkg -i "$tmpfile" # If dpkg reports an error due to missing dependencies, you can install them with apt: sudo apt-get install -f -y # Save the upgrade channel preference if [ -x /usr/local/bin/netrinos ]; then echo "Setting upgrade channel to: $version" /usr/local/bin/netrinos upgrade channel "$version" >/dev/null 2>&1 || true fi